检测到您已登录华为云国际站账号,为了您更好的体验,建议您访问国际站服务网站 https://www.huaweicloud.com/intl/zh-cn
不再显示此消息
Examples Example 1: Using a Timer Trigger to Periodically Download Files from an OBS Bucket Example 2: Creating a Function by Uploading Code to an OBS Bucket Example 3: Using a Function to Invoke a Subfunction
OBS FunctionGraph functions are created to process OBS bucket events, such as object creation or deletion events. For example, when an image is uploaded to the specified bucket, OBS invokes the function to read the image and create a thumbnail. For details, see OBS User Guide.
Table 1 Environment variables Environment Variable Description obs_address OBS endpoint. To obtain the OBS endpoint, see Regions and Endpoints. obs_store_bucket Name of the destination bucket for storing logs. obs_store_objName Name of the target file for storing logs.
None Instruction Creating a Function from Scratch 02:41 Creating a Function from Scratch Creating a Dependency 02:25 Creating a Dependency Using a Timer Trigger 02:09 Using a Timer Trigger Using an OBS Trigger 03:16 Using an OBS Trigger Using an SMN Trigger 03:09 Using an SMN Trigger
Enumeration values: inline zip obs jar code_url No String If code_type is set to obs, enter the OBS URL of the function code package. If code_type is not set to obs, leave this parameter blank. code_filename No String Name of a function file.
client - smnsdk SMN access (public cloud) 1.0.1 Other third-party libraries For other third-party libraries not listed in the preceding tables, package and upload them to an OBS bucket or on the function details page.
Workflow + Function: Automatically Processing Data in OBS Use FunctionGraph to process OBS data.
Uploading a File to Generate an Event Log in to the OBS console, go to the object page of the dew-bucket-input bucket, and upload the image.jpg file, as shown in Figure 1.
Typical Scenarios Download files stored in Object Storage Service (OBS) to the /tmp directory for processing. To store function execution data in OBS, create a file in the /tmp directory, write the data into the file, and then upload the file to OBS. Parent topic: General FAQs
Upload from OBS: Specify an OBS link URL. For details about how to obtain the URL, see Accessing an Object Using Its URL. Runtime Select a runtime. Description Description of the dependency. This parameter is optional. Click OK. By default, a new dependency is version 1.
OBS SMN DIS FunctionGraph Enumeration values: OBS SMN DIS FunctionGraph param No String Parameters (in JSON format) corresponding to the target service. OBS: Parameters related to the bucket name, object directory prefix, and object expiration time are included.
Figure 2 Upload Files to OBS Action Name: Enter Upload Function Package to OBS. Build Directory: Enter helloworld/code/helloworld.zip. Bucket Name: Specify a private bucket to store the function code ZIP package. OBS Directory: Enter function.
Workflow + Function: Automatically Processing Data in OBS Use a function flow to automatically process data in OBS, such as video analysis, image transcoding, and video frame capturing (available only in CN East-Shanghai1 and AP-Singapore).
Data source integration FunctionGraph supports multiple data source triggering modes, such as OBS and message queue. Parent topic: Scenarios
To obtain the DEW endpoint, see Regions and Endpoints. dew_key_id User master key ID. input_bucket OBS bucket for storing input files. output_bucket OBS bucket for storing encrypted and uploaded files. obs_endpoint OBS endpoint.
Event list APIG Events OBS Events Parent topic: Serverless Framework
Enumeration values: inline zip obs jar Custom-Image-Swr code_url String If code_type is set to obs, enter the OBS URL of the function code package. If code_type is not set to obs, leave this parameter blank. code_filename String Name of a function file.
OBS Administrator SFS FullAccess SFS Turbo FullAccess VPC Administrator (If you select this policy, SWR Admin is automatically selected.) SWR Admin Figure 2 Selecting a policy Select a scope for the permissions as required.
Enumeration values: inline zip obs jar Custom-Image-Swr code_url String If code_type is set to obs, enter the OBS URL of the function code package. If code_type is not set to obs, leave this parameter blank. code_filename String Name of a function file.
Files are uploaded to OBS to trigger file processing functions. You will be billed only for resources used to process files as needed (you are not billed for idle resources during lows in demand).