-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathACS::FC::InvokeFunction.yml
138 lines (138 loc) · 3.76 KB
/
ACS::FC::InvokeFunction.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS::FC::InvokeFunction
name-zh-cn: 执行函数(FC)
en: Invoke Created Function
zh-cn: 执行创建的函数
Parameters:
regionId:
Label:
en: RegionId
zh-cn: 地域ID
Type: String
Default: '{{ ACS::RegionId }}'
serviceName:
Label:
en: ServiceName
zh-cn: 服务名称
Type: String
AssociationProperty: ALIYUN::FC::Service::ServiceName
AssociationPropertyMetadata:
RegionId: regionId
functionName:
Label:
en: FunctionName
zh-cn: 函数名称
Type: String
AssociationProperty: ALIYUN::FC::Function::FunctionName
AssociationPropertyMetadata:
RegionId: regionId
ServiceName: serviceName
invocationType:
Label:
en: InvocationType
zh-cn: 执行类型
Type: String
AllowedValues:
- Sync
- Async
Default: Sync
event:
Label:
en: The parameters of function invocation
zh-cn: 函数调用参数
Description:
en: 'JSON Format: {"key": "value"} Please refer to <a href="https://www.alibabacloud.com/help/en/functioncompute/user-guide/event-handlers#section-qv4-7ev-s0q" target="_blank">document</a>'
zh-cn: 'JSON格式:{"key": "value"} 详情请<a href="https://help.aliyun.com/zh/functioncompute/user-guide/event-handlers#section-qv4-7ev-s0q" target="_blank">参考</a>'
Type: String
Default: ''
Tasks:
- Name: invokeFunction
Action: 'ACS::ExecuteAPI'
Description:
en: Invokes function
zh-cn: 执行函数
Properties:
Service: FC-OPEN
API: InvokeFunction
Method: POST
URI: '/services/{{serviceName}}/functions/{{functionName}}/invocations'
Headers:
X-Fc-Invocation-Type: '{{ invocationType }}'
X-Fc-Stateful-Async-Invocation-Enable:
Fn::If:
- Fn::Equals:
- '{{ invocationType }}'
- Async
- 'true'
- 'false'
X-Fc-Stateful-Async-Invocation-Id:
Fn::If:
- Fn::Equals:
- '{{ invocationType }}'
- Async
- Fn::Replace:
- .: _
- '{{ ACS::ExecutionId }}'
- ''
Parameters:
AccountId: '{{ acs::accountid }}'
RegionId: '{{ regionId }}'
Body: '{{event}}'
Outputs:
data:
Type: String
ValueSelector: .data
- Name: waitForAsyncInvocation
Action: ACS::WaitFor
Description:
en: Wait For AsyncInvocation Result
zh-cn: 等待异步执行结果
When:
Fn::Equals:
- '{{ invocationType }}'
- Async
MaxRetryInterval: 60
Retries: 296
DelayType: Exponential
Delay: 2
BackOff: 2
Properties:
Service: FC-OPEN
API: GetStatefulAsyncInvocation
Method: GET
URI:
Fn::Replace:
- .: _
- /services/{{serviceName}}/functions/{{functionName}}/stateful-async-invocations/{{ACS::ExecutionId}}
Parameters:
serviceName: '{{ serviceName }}'
functionName: '{{ functionName }}'
invocationId:
Fn::Replace:
- .: _
- '{{ ACS::ExecutionId }}'
AccountId: '{{ acs::accountid }}'
PropertySelector: status
DesiredValues:
- Succeeded
StopRetryValues:
- Invalid
- Expired
- Stopped
- Failed
NotDesiredValues: [ ]
Outputs:
invocationDetail:
Type: List
ValueSelector: events[] | select((.eventDetail // "") != "") | .eventDetail
Outputs:
data:
Type: String
Value:
Fn::If:
- Fn::Equals:
- '{{ invocationType }}'
- Async
- '{{ waitForAsyncInvocation.invocationDetail }}'
- '{{ invokeFunction.data }}'