ALIYUN::FC::FunctionInvoker is used to invoke a function.

Syntax

{
  "Type": "ALIYUN::FC::FunctionInvoker",
  "Properties": {
    "Qualifier": String,
    "ServiceName": String,
    "ExecuteVersion": Integer,
    "Async": Boolean,
    "Event": String,
    "FunctionName": String,
    "CheckError": Boolean,
    "ServiceRegionId": String
  }
}

Properties

Property Type Required Editable Description Constraint
ServiceName String Yes Yes The name of the service. The name must be 1 to 128 characters in length.
FunctionName String Yes Yes The name of the function. None
Async Boolean No Yes Specifies whether to enable asynchronous function invocation. Default value: false. Valid values:
  • true
  • false
Event String No Yes The event that is processed by the function. The parameter value is passed into the function as a UTF-8 encoded string. If the value is a binary string, encode it in Base64 before it is passed in.
Qualifier String No Yes The version of the service. Valid values:
  • versionId
  • aliasName
ExecuteVersion Integer No Yes

The version of the identifier for the function to be invoked. If you specify this parameter when you create the resource, the function is invoked. Otherwise, the function is not invoked.

If the parameter value changes and the new value is valid when you update the resource, the function is invoked. Otherwise, the function is not invoked.

None
CheckError Boolean No No Specifies whether to check the results of the invocation. Default value: false. Valid values:
  • true
    Note If this parameter is set to true and the invocation fails, the resource fails to be created.
  • false
ServiceRegionId String No No The region ID of the function service. None

Response parameters

Fn::GetAtt

  • ResultType:
    • If Async is set to true and ResultType is set to NoResult, no result is returned.
    • If Async is set to false and ResultType is set to Success, the invocation is successful.
    • If Async is set to false and ResultType is set to Failure, the invocation fails.
  • Result:
    • If ResultType is set to NoResult, the value of Result is null.
    • If ResultType is set to Success, the value of Result is the function invocation result. Users can interpret this response based on their function implementation. The returned result must be a UTF-8 encoded string. Otherwise, the function invocation fails. If the result is a binary string, encode it in Base64 before it is returned.
    • If ResultType is set to Failure, an error message is returned for Result.

Examples

  • YAMLformat

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters: {}
    Resources:
      FunctionInvoker:
        Type: ALIYUN::FC::FunctionInvoker
        Properties:
          ServiceName: mytest
          FunctionName: PythonFunc
          ExecuteVersion: 1
    Outputs: {}
  • JSONformat

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
      },
      "Resources": {
        "FunctionInvoker": {
          "Type": "ALIYUN::FC::FunctionInvoker",
          "Properties": {
            "ServiceName": "mytest",
            "FunctionName": "PythonFunc",
            "ExecuteVersion": 1.0
          }
        }
      },
      "Outputs": {
      }
    }