-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS::ECS::InstallCloudAssistant.json
233 lines (233 loc) · 6.27 KB
/
ACS::ECS::InstallCloudAssistant.json
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
{
"FormatVersion": "OOS-2019-06-01",
"Description": {
"name-en": "ACS::ECS::InstallCloudAssistant",
"name-zh-cn": "在ECS实例中安装云助手Agent",
"en": "Installs cloud assistant on ECS instance",
"zh-cn": "在ECS实例中安装云助手Agent"
},
"Parameters": {
"regionId": {
"Description": {
"en": "The ID of region",
"zh-cn": "地域ID"
},
"Type": "String",
"Default": "{{ ACS::RegionId }}"
},
"instanceId": {
"Description": {
"en": "The Id of ECS instance you will install cloud assistant",
"zh-cn": "将要安装云助手客户端的ECS实例ID"
},
"Type": "String",
"MinLength": 1,
"MaxLength": 30
}
},
"Tasks": [
{
"Name": "checkInstanceReady",
"Action": "ACS::CheckFor",
"Description": {
"en": "Checks whether the ECS instance status is running or stopped",
"zh-cn": "检测实例的状态是否为Running或Stopped"
},
"Properties": {
"Service": "ECS",
"API": "DescribeInstances",
"Parameters": {
"RegionId": "{{ regionId }}",
"InstanceIds": [
"{{ instanceId }}"
]
},
"DesiredValues": [
"Running"
],
"PropertySelector": "Instances.Instance[].Status"
}
},
{
"Name": "queryCloudAssistantReady",
"Action": "ACS::ExecuteAPI",
"Description": {
"en": "Queries the cloud assistanat status",
"zh-cn": "查看云助手客户端的状态"
},
"Properties": {
"Service": "ECS",
"API": "DescribeCloudAssistantStatus",
"Parameters": {
"RegionId": "{{ regionId }}",
"InstanceId": [
"{{ instanceId }}"
]
}
},
"Outputs": {
"cloudAssistantStatus": {
"Type": "String",
"ValueSelector": "InstanceCloudAssistantStatusSet.InstanceCloudAssistantStatus[].CloudAssistantStatus"
}
}
},
{
"Name": "whetherCloudAssistantIsReady",
"Action": "ACS::Choice",
"Description": {
"en": "Choose next task by CloudAssistant status",
"zh-cn": "通过云助手客户端的状态来选择下一个任务的类型"
},
"Properties": {
"DefaultTask": "waitDataRecover",
"Choices": [
{
"When": {
"Fn::Equals": [
"true",
"{{ queryCloudAssistantReady.cloudAssistantStatus }}"
]
},
"NextTask": "waitCloudAssistantStatusReachtrue"
}
]
}
},
{
"Name": "waitDataRecover",
"Action": "ACS::Sleep",
"Description": {
"en": "Waits for the cloud assistant to install successfully",
"zh-cn": "等待云助手安装成功"
},
"Properties": {
"Duration": "PT1M"
}
},
{
"Name": "queryCloudAssistantStatus",
"Action": "ACS::ExecuteAPI",
"Description": {
"en": "Queries the cloud assistanat status",
"zh-cn": "查看云助手客户端状态"
},
"Properties": {
"Service": "ECS",
"API": "DescribeCloudAssistantStatus",
"Parameters": {
"RegionId": "{{ regionId }}",
"InstanceId": [
"{{ instanceId }}"
]
}
},
"Outputs": {
"cloudAssistantStatus": {
"Type": "String",
"ValueSelector": "InstanceCloudAssistantStatusSet.InstanceCloudAssistantStatus[].CloudAssistantStatus"
}
}
},
{
"Name": "whetherCloudAssistantStatusIsTrue",
"Action": "ACS::Choice",
"Description": {
"en": "Choose next task by CloudAssistant status",
"zh-cn": "根据云助手客户端的状态选择下一步的任务"
},
"Properties": {
"DefaultTask": "installCloudAssistant",
"Choices": [
{
"When": {
"Fn::Equals": [
"true",
"{{ queryCloudAssistantStatus.cloudAssistantStatus }}"
]
},
"NextTask": "waitCloudAssistantStatusReachtrue"
}
]
}
},
{
"Name": "installCloudAssistant",
"Action": "ACS::ExecuteAPI",
"Description": {
"en": "Install cloud assistant with specified instance ID",
"zh-cn": "下载云助手客户端到指定的实例上"
},
"Properties": {
"Service": "ECS",
"API": "InstallCloudAssistant",
"Parameters": {
"RegionId": "{{ regionId }}",
"InstanceIds": [
"{{ instanceId }}"
]
}
}
},
{
"Name": "rebootInstance",
"Action": "ACS::ExecuteAPI",
"Description": {
"en": "Restarts the ECS instance",
"zh-cn": "重启ECS实例"
},
"Properties": {
"Service": "ECS",
"API": "RebootInstance",
"Parameters": {
"RegionId": "{{ regionId }}",
"InstanceId": "{{ instanceId }}"
}
}
},
{
"Name": "untilInstanceReady",
"Action": "ACS::WaitFor",
"Description": {
"en": "Waits for the instance restart successfully",
"zh-cn": "等待实例重启成功"
},
"Properties": {
"Service": "ECS",
"API": "DescribeInstances",
"Parameters": {
"RegionId": "{{ regionId }}",
"InstanceIds": [
"{{ instanceId }}"
]
},
"DesiredValues": [
"Running"
],
"PropertySelector": "Instances.Instance[].Status"
}
},
{
"Name": "waitCloudAssistantStatusReachtrue",
"Action": "ACS::WaitFor",
"Description": {
"en": "Wait for the cloud assistant status reach true",
"zh-cn": "等待云助手客户端进入可用状态"
},
"Properties": {
"Service": "ECS",
"API": "DescribeCloudAssistantStatus",
"Parameters": {
"RegionId": "{{ regionId }}",
"InstanceIds": [
"{{ instanceId }}"
]
},
"DesiredValues": [
"true"
],
"PropertySelector": "InstanceCloudAssistantStatusSet.InstanceCloudAssistantStatus[].CloudAssistantStatus"
}
}
]
}