ALIYUN::FC::FunctionInvoker は、関数を呼び出す場合に使用します。
構文
{ “Type”: “ALIYUN::FC::FunctionInvoker”, “Properties”: { “Qualifier”: String, “ServiceName”: String, “ExecuteVersion”: Integer, “Async”: Boolean, “Event”: String, “FunctionName”: String }}
プロパティ
名前 | データ型 | 必須/省略可能 | 更新可/不可 | 説明 | 制約 |
---|---|---|---|---|---|
ServiceName | String | 必須 | 可 | 関数が属するサービスの名前。 | 名前は 1 から 128 文字にしなければなりません。 |
FunctionName | String | 必須 | 可 | 関数の名前。 | なし |
Async | Boolean | 省略可能 | 不可 | 非同期関数呼び出しを有効にするかどうかを指定します。 デフォルト値:False。 | なし |
Event | String | 省略可能 | 可 | 関数で処理されるイベント。 パラメーター値は、UTF-8 でエンコードされた文字列として関数に渡されます。 値がバイナリ文字列の場合、渡される前に Base64 でエンコードしてください。 | なし |
Qualifier | String | 省略可能 | 可 | サービスのバージョン。バージョン ID またはエイリアス名を指定できます。 | なし |
ExecuteVersion | Integer | 省略可能 | 可 | 呼び出される関数のバージョン ID。 リソースの作成時にこのパラメーターを設定すると、関数が呼び出されます。 設定していない場合、関数は呼び出されません。 リソースの更新時にパラメーター値が変更され、新しい値が有効な場合、関数が呼び出されます。 それ以外の場合、関数は呼び出されません。 | なし |
レスポンスパラメーター
Fn::GetAtt
ResultType:関数呼び出し結果のタイプ。 有効な値:
- NoResult:Async パラメーターが true に設定されている場合、結果は返されません。
- Success:Async パラメーターが false に設定されている場合、実行は成功します。
- Failure:Async パラメーターが false に設定されている場合、実行は失敗します。
Result:関数呼び出し結果。ResultType パラメーター値によって異なります。 有効な値:
- NoResult:null です。
- Success:呼び出された関数によって返された結果。 ユーザーは、関数の実装に基づいてこのレスポンスを解析できます。 返される結果は、UTF-8 でエンコードされた文字列でなければなりません。 それ以外の場合、関数の実行は失敗します。 結果がバイナリ文字列の場合、返される前に Base64 でエンコードします。
- Failure:エラーメッセージです。
例
{ “ROSTemplateFormatVersion”: “2015-09-01”, “Resources”: { “FunctionInvoker”: { “Type”: “ALIYUN::FC::FunctionInvoker”, “Properties”: { “FunctionName”: { “Ref”: “FunctionName” }, “ServiceName”: { “Ref”: “ServiceName” }, “ExecuteVersion”: { “Ref”: “ExecuteVersion” }, “Async”: { “Ref”: “Async” }, “Event”: { “Ref”: “Event” }, “Qualifier”: { “Ref”: “Qualifier” } } } }, “Parameters”: { “FunctionName”: { “Type”: “String”, “Description”: “Function name” }, “ServiceName”: { “MinLength”: 1, “Type”: “String”, “Description”: “Service name”, “MaxLength”: 128 }, “ExecuteVersion”: { “Type”: “Number”, “Description”: “If the property is not specified for creation and update, the function will not be invoked. The change of the property leads to the invocation of the function.” }, “Async”: { “Default”: false, “Type”: “Boolean”, “Description”: “Invocation type, Sync or Async. Defaults to Sync.”, “AllowedValues”: [ “True”, “true”, “False”, “false” ] }, “Event”: { “Type”: “String”, “Description”: “Event, binary type. This value is passed to function without any transformation. It\u2019s function\u2019s responsibility to interpret the value.\nUse Fn::Base64Decode to pass value if needed.” }, “Qualifier”: { “Type”: “String”, “Description”: “service version, which can be versionId or aliasName” } }, “Outputs”: { “ResultType”: { “Description”: “Result type:\nNoResult: Async invocation has no result.\nSuccess: Sync invocation succeeds.\nFailure: Sync invocation fails.”, “Value”: { “Fn::GetAtt”: [ “FunctionInvoker”, “ResultType” ] } }, “Result”: { “Description”: “Depends on result type:\nNoResult: Async invocation has no result.\nSuccess: The response of the function execution. It\u2019s in binary format. Users can interpret the data according to their function implementation.\nFailure: Error Message.”, “Value”: { “Fn::GetAtt”: [ “FunctionInvoker”, “Result” ] } } }}
</article>
</main>