FGS.Function
Element Description
HuaweiCloud.FGS.Function is used to create function resources for FunctionGraph.
Element Properties
Property |
Required |
Descripiton |
---|---|---|
code |
Yes |
The function code. Type: string Value Description: When codeType is inline, the field must be selected, and the code size is no more than 10K. When codeType is obs, the field is empty. Edit the function code block directly in the template, using the special symbol"|"to preserve the carriage return and space in the function code block. YAML writing specifications please refer to: http://yaml.org/spec/1.2/spec.html Default: '' Value Constraint: If you upload the function code by online editing, the size of the code can not exceed 10K. If the code is large, the obs type is recommended to upload the code to the OBS bucket, and then configure the codeUrl attribute. Suggestion: Fill in the field by copying and paste the correct function code completed by the editor. |
description |
No |
The description of the function. Type: string Value Description: The field is optional, and the description information is not more than 512 characters. Suggestion: Use the get_input function to import this field. The value can be automatically obtained on the AOS page. |
memorySize |
Yes |
Size of the memory allocated per invocation in MB. Type: integer Value Description: The unit is MB. The value is a multiplier of 128. Default: 128 Value Constraint: Valid values can only be 128, 256, 512, 768, 1024, 1280, 1536 Suggestion: Use the get_input function to import this field. The value can be obtained on the AOS page. |
environment |
No |
Environment variables in key-value pair format. Type: FGS.Environment Value Description: User defined key/value environment variable information, parameters used in functions. For example: if a function wants to access a host, you can set the environment variable: "Host": "192.168.1.1". A function can have a maximum of 20 key-value pairs, and their total length cannot exceed 2048 characters. To avoid information leakage, do not include sensitive information, such as accounts and passwords, in environment variables. Default: {u'variables': {}} |
dependencyPkg |
No |
Dependency package of the function code. Type: string Value Description: The field is optional. Before configuring this field, please upload a third-party dependent library to OBS. If multiple dependent libraries are needed, package and upload them through a ZIP file. Suggestion: Use the get_input function to import this field. The value can be automatically obtained on the AOS page. |
handler |
Yes |
Function within your code that is called to begin execution. Type: string Value Description: Rule: xx.xx, must be included ".". For example: for the node.js function, the function execution entry: myfunction.handler, the file name of the function is myfunction.js, and the execution of the entry function is named handler. Default: index.handler Suggestion: Use the get_input function to import this field. The value can be automatically obtained on the AOS page. |
role |
No |
The Huawei IAM execution role to access to other Huawei Cloud services. Type: string Value Description: IAM service support is required and a delegate is created on the IAM interface. When the function needs to access other services, it must provide the field. |
timeout |
Yes |
Maximum time that the function can run before it is killed in seconds. Type: integer Value Description: If timeout, the function will be forced to stop. Default: 3 Value Constraint: The value ranges from 3 to 300 days. Suggestion: Use the get_input function to import this field. The value can be obtained on the AOS page. |
codeType |
Yes |
The type of uploading the function code Type: string Value Description: Support inline and obs. The inline type represents the online editing of the function code. The obs type uploads the function code to the OBS bucket in advance, and then configures the codeUrl property. Value Constraint: Valid values can only be "inline", "obs" Suggestion: Use the get_input function to import this field. The value can be obtained on the AOS page. |
runtime |
Yes |
Runtime language Type: string Value Description: Support Node.js6.10, Python2.7, Python3.6, Java8, Go1.8, Node.js8.10, C#(.NET Core 2.0), C#(.NET Core 2.1). Value Constraint: Valid values can only be "Node.js6.10", "Python2.7", "Python3.6", "Java8", "Go1.8", "Node.js8.10","C#(.NET Core 2.0)","C#(.NET Core 2.1)" Suggestion: Use the get_input function to import this field. The value can be obtained on the AOS page. |
codeUrl |
Yes |
Url location of the function code. Type: string Value Description: When CodeType is OBS, the field must be selected. The value is the address of the function code package on OBS. When CodeType is inline, the field is empty. Default: '' Suggestion: Use the get_input function to import this field. The value can be automatically obtained on the AOS page. |
name |
Yes |
Function name Type: string Value Description: Supports customization. Value Constraint: You can only begin with uppercase letters, and contain only letters, numbers, underlines, and middle scribe, ending with letters or numbers. Suggestion: Use the get_input function to import this field. The value can be automatically obtained on the AOS page. |
Relationships Between Elements
None.
Return Value
Property |
Type |
Description |
---|---|---|
refID |
string |
function ID |
Blueprint Example
tosca_definitions_version: huaweicloud_tosca_version_1_0 inputs: codeUrl: description: >- The address of the function code package on OBS. You need to upload the function code to OBS barrel in advance. label: Function type: string handler: default: index.handler description: >- The Execution Entry of the function. Default value is index. handler. It can be configured independently by code file name and entry function name. label: Function type: string memorySize: constraints: valid_values: - 128 - 256 - 512 - 768 - 1024 - 1280 - 1536 default: 128 description: The memory size of the function. label: Function type: integer name: constraints: regex: '^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$' default: image_watermark description: The name of the function. label: Function type: string runtime: constraints: valid_values: - Node.js6.10 - Python2.7 - Python3.6 - Java8 - Go1.8 - Node.js8.10 description: The runtime of the function. label: Function type: string timeout: constraints: in_range: - 3 - 300 default: 3 description: The timeout of the function. The effective range is 3~300. label: Function type: integer xrole: description: The agency of the function. It should be created in advance. label: Function type: string node_templates: fgsf36en: properties: codeUrl: get_input: codeUrl handler: get_input: handler memorySize: get_input: memorySize name: get_input: name role: get_input: xrole runtime: get_input: runtime timeout: get_input: timeout code: '' codeType: obs environment: variables: key1: value1 key2: value2 type: HuaweiCloud.FGS.Function outputs: function-urn: description: function URN value: get_attribute: - fgsf36en - refID
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.