-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathACS::RDS::StopInstance.yml
89 lines (89 loc) · 2.34 KB
/
ACS::RDS::StopInstance.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
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS::RDS::StopInstance
name-zh-cn: 停止RDS实例
en: Stops a RDS instance
zh-cn: 停止RDS实例
Parameters:
regionId:
Label:
en: RegionId
zh-cn: 地域ID
Type: String
AssociationProperty: ALIYUN::ECS::RegionId
Default: '{{ ACS::RegionId }}'
instanceId:
Label:
en: RDSInstanceId
zh-cn: RDS实例ID
Type: String
AssociationProperty: ALIYUN::RDS::Instance::InstanceId
AssociationPropertyMetadata:
RegionId: regionId
Tasks:
- Name: getInstanceStatus
Description:
en: Gets the RDS instance status
zh-cn: 获取RDS实例的状态
Action: ACS::ExecuteApi
Properties:
Service: RDS
API: DescribeDBInstances
Parameters:
RegionId: '{{ regionId }}'
DBInstanceId: '{{ instanceId }}'
Outputs:
status:
Type: String
ValueSelector: Items.DBInstance[].DBInstanceStatus
- Name: whetherInstanceIsStopped
Action: 'ACS::Choice'
Description:
en: Choose next task by instance STOPPED status
zh-cn: 根据实例的已停止状态选择下一个任务
Properties:
DefaultTask: whetherInstanceIsStopping
Choices:
- When:
'Fn::Equals':
- 'STOPPED'
- '{{ getInstanceStatus.status }}'
NextTask: ACS::END
- Name: whetherInstanceIsStopping
Action: 'ACS::Choice'
Description:
en: Choose next task by instance STOPPING status
zh-cn: 根据实例的停止中状态选择下一个任务
Properties:
DefaultTask: stopDBInstance
Choices:
- When:
'Fn::Equals':
- 'STOPPING'
- '{{ getInstanceStatus.status }}'
NextTask: untilInstanceReady
- Name: stopDBInstance
Action: ACS::ExecuteAPI
Description:
en: Stops the RDS instance
zh-cn: 停止RDS实例
Properties:
Service: RDS
API: StopDBInstance
Parameters:
RegionId: '{{ regionId }}'
DBInstanceId: '{{ instanceId }}'
- Name: untilInstanceReady
Action: ACS::WaitFor
Description:
en: Waits for the RDS instance to enter STOPPED status
zh-cn: 等待RDS实例进入已停止状态
Properties:
Service: RDS
API: DescribeDBInstances
Parameters:
RegionId: '{{ regionId }}'
DBInstanceId: '{{ instanceId }}'
DesiredValues:
- STOPPED
PropertySelector: Items.DBInstance[].DBInstanceStatus