-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathACS::ECD::RunCommand.yml
111 lines (111 loc) · 2.95 KB
/
ACS::ECD::RunCommand.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
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS::ECD::RunCommand
name-zh-cn: 在云桌面中执行命令
en: Creates a cloud assistant command and invoke it on desktop
zh-cn: 在云桌面中执行命令
Parameters:
regionId:
Description:
en: The ID of region
zh-cn: 地域ID
Type: String
Default: '{{ ACS::RegionId }}'
desktopId:
Description:
en: The ID of desktop
zh-cn: 云桌面ID
Type: String
commandType:
Description:
en: The type of command
zh-cn: 云助手命令类型
Type: String
AllowedValues:
- RunBatScript
- RunPowerShellScript
contentEncoding:
Description:
en: The encoding mode of the command content
zh-cn: 脚本内容的编码方式
Type: String
AllowedValues:
- PlainText
- Base64
Default: PlainText
commandContent:
Description:
en: The content of command
zh-cn: 云助手命令内容
Type: String
AssociationProperty: Code
timeout:
Description:
en: The value of the invocation timeout period of a command
zh-cn: 执行脚本的超时时间
Type: Number
Default: 600
Tasks:
- Name: runCommand
Action: 'ACS::ExecuteAPI'
Description:
en: Executes cloud assistant command
zh-cn: 执行云助手命令
Properties:
Service: ECD
API: RunCommand
Parameters:
RegionId: '{{ regionId }}'
CommandContent: '{{ commandContent }}'
DesktopId:
- '{{desktopId}}'
Type: '{{ commandType }}'
ContentEncoding: '{{ contentEncoding }}'
Timeout: '{{ timeout }}'
Outputs:
invokeId:
Type: String
ValueSelector: InvokeId
- Name: untilInvocationReady
Action: 'ACS::WaitFor'
Description:
en: Waits for the command to be completed
zh-cn: 等待云助手命令执行完成
OnError: 'ACS::END'
Retries: 20
Properties:
Service: ECD
API: DescribeInvocations
Parameters:
RegionId: '{{ regionId }}'
InvokeId: '{{ runCommand.invokeId }}'
IncludeOutput: true
DesiredValues:
- Success
StopRetryValues:
- Failed
PropertySelector: '.Invocations[].InvokeDesktops[].InvocationStatus'
Outputs:
invocationResult:
Type: String
ValueSelector: '.Invocations[].InvokeDesktops[].Output'
- Name: checkInvocationResult
Action: 'ACS::CheckFor'
Description:
en: Checks the command exitcode of a cloud assistant command
zh-cn: 检测云助手命令的退出码
OnError: 'ACS::END'
Properties:
Service: ECD
API: DescribeInvocations
Parameters:
RegionId: '{{ regionId }}'
InvokeId: '{{ runCommand.InvokeId }}'
PropertySelector: '.Invocations[].InvokeDesktops[].ExitCode'
DesiredValues:
- 0
Outputs:
invocationOutput:
Type: String
Value:
'Fn::Base64Decode': '{{ untilInvocationReady.invocationResult }}'