-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS::ECS::InvokeCommand.yml
108 lines (108 loc) · 3.21 KB
/
ACS::ECS::InvokeCommand.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
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS::ECS::InvokeCommand
name-zh-cn: 执行云助手命令
en: Triggers an exisiting cloud assistant command on one ECS instance
zh-cn: 在ECS实例上执行云助手命令
Parameters:
regionId:
Description:
en: The ID of region
zh-cn: 地域ID
Type: String
Default: '{{ ACS::RegionId }}'
commandId:
Description:
en: The ID of the cloud assistant command
zh-cn: 云助手命令ID
Type: String
instanceId:
Description:
en: The ID of ECS instance where the command need to be executed
zh-cn: 将要执行云助手命令的ECS实例ID
Type: String
MinLength: 1
MaxLength: 30
username:
Description:
en: The username that is used to run the command on the ECS instance
zh-cn: 在ECS实例中执行命令的用户名称
Type: String
Default: ""
parameters:
Description:
en: Specifies the values of the custom parameters when the custom parameter feature is enabled. The values are key-value pairs
zh-cn: 启用自定义参数功能时,执行命令时传入的自定义参数的键值对
Type: Json
Default: {"": ""}
Tasks:
- Name: invokeCommand
Action: ACS::ExecuteAPI
Description:
en: Triggers a cloud assistant command on one ECS instance
zh-cn: 在ECS实例上执行云助手命令
Properties:
Service: ECS
API: InvokeCommand
Parameters:
RegionId: '{{ regionId }}'
CommandId: '{{ commandId }}'
Parameters: '{{ parameters }}'
Username: '{{ username }}'
InstanceIds:
- '{{ instanceId }}'
Outputs:
invokeId:
Type: String
ValueSelector: InvokeId
- Name: untilInvocationReady
Action: ACS::WaitFor
Description:
en: Waits for the command to be completed
zh-cn: 等待云助手命令执行完成
Properties:
Service: ECS
API: DescribeInvocations
Parameters:
RegionId: '{{ regionId }}'
InvokeId: '{{ invokeCommand.invokeId }}'
DesiredValues:
- Finished
StopRetryValues:
- Failed
PropertySelector: Invocations.Invocation[].InvokeStatus
- Name: describeInvocationResults
Action: ACS::ExecuteAPI
Description:
en: Queries the command output of a cloud assistant command in the specified ECS instance
zh-cn: 查看在ECS实例上执行云助手命令的返回结果
Properties:
Service: ECS
API: DescribeInvocationResults
Parameters:
RegionId: '{{ regionId }}'
InvokeId: '{{ invokeCommand.invokeId }}'
Outputs:
invocationResult:
Type: String
ValueSelector: Invocation.InvocationResults.InvocationResult[].Output
- Name: checkInvocationResult
Action: 'ACS::CheckFor'
Description:
en: Checks the command exitcode of a cloud assistant command
zh-cn: 检测云助手命令的退出码
OnError: 'ACS::END'
Properties:
Service: ECS
API: DescribeInvocationResults
Parameters:
RegionId: '{{ regionId }}'
InvokeId: '{{ invokeCommand.invokeId }}'
PropertySelector: 'Invocation.InvocationResults.InvocationResult[].ExitCode'
DesiredValues:
- 0
Outputs:
invocationOutput:
Type: String
Value:
Fn::Base64Decode: '{{ describeInvocationResults.invocationResult }}'