-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathACS::RDS::GrantAccountPrivilege.json
182 lines (182 loc) · 5.04 KB
/
ACS::RDS::GrantAccountPrivilege.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
{
"FormatVersion": "OOS-2019-06-01",
"Description": {
"name-en": "ACS::RDS::GrantAccountPrivilege",
"name-zh-cn": "将帐户权限授予实例的指定或所有dbs",
"en": "Grant account privilege to specified or all dbs of the instance",
"zh-cn": "将帐户权限授予实例的指定或所有dbs"
},
"Parameters": {
"regionId": {
"Label": {
"en": "RegionId",
"zh-cn": "地域ID"
},
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::RegionId",
"Default": "{{ ACS::RegionId }}"
},
"dbInstanceId": {
"Label": {
"en": "RDSInstanceId",
"zh-cn": "RDS实例ID"
},
"Type": "String",
"AssociationProperty": "ALIYUN::RDS::Instance::InstanceId",
"AssociationPropertyMetadata": {
"RegionId": "regionId"
}
},
"accountName": {
"Label": {
"en": "AccountName",
"zh-cn": "要授权的帐户名"
},
"Type": "String"
},
"dbNames": {
"Label": {
"en": "DBNameList",
"zh-cn": "DB名称列表"
},
"Description": {
"en": "The wildcard parameter value [\"all\"] that represents all dbs is only suoported when all dbs count of single instance not greater than 100",
"zh-cn": "只有当单个实例的所有dbs计数不大于100时,才支持代表所有dbs的通配符参数值[\"all\"]"
},
"Type": "List"
},
"accountPrivilege": {
"Label": {
"en": "AccountPrivilege",
"zh-cn": "要授予目标帐户的权限"
},
"Type": "String",
"AllowedValues": [
"ReadWrite",
"ReadOnly",
"DDLOnly",
"DMLOnly",
"DBOwner"
],
"Default": "ReadOnly"
}
},
"Tasks": [
{
"Name": "checkForInstanceReady",
"Action": "ACS::CheckFor",
"Description": {
"en": "Check wether the DB instance is running status",
"zh-cn": "检查DB实例是否为running状态"
},
"Properties": {
"Service": "RDS",
"API": "DescribeDBInstanceAttribute",
"Parameters": {
"RegionId": "{{ regionId }}",
"DBInstanceId": "{{ dbInstanceId }}"
},
"DesiredValues": [
"Running"
],
"PropertySelector": "Items.DBInstanceAttribute[].DBInstanceStatus"
}
},
{
"Name": "whetherSpecifiedDBNames",
"Action": "ACS::Choice",
"Description": {
"en": "Choose next task by the dbNames parameter value",
"zh-cn": "根据dbNames参数值选择下一个任务"
},
"Properties": {
"DefaultTask": "grantAccountPrivilege",
"Choices": [
{
"When": {
"Fn::Equals": [
[
"all"
],
"{{ dbNames }}"
]
},
"NextTask": "describeDatabases"
}
]
}
},
{
"Name": "describeDatabases",
"Action": "ACS::ExecuteAPI",
"OnSuccess": "grantAccountPrivilegeForAllDBs",
"OnError": "ACS::END",
"Description": {
"en": "Queries all running databases name of the instance",
"zh-cn": "获取实例的所有正在运行的数据库名称"
},
"Properties": {
"Service": "RDS",
"API": "DescribeDatabases",
"Parameters": {
"RegionId": "{{ regionId }}",
"DBInstanceId": "{{ dbInstanceId }}",
"DBStatus": "Running",
"PageSize": 100
}
},
"Outputs": {
"dbNames": {
"Type": "List",
"ValueSelector": ".Databases.Database[].DBName"
}
}
},
{
"Name": "grantAccountPrivilege",
"Action": "ACS::ExecuteAPI",
"OnSuccess": "ACS::END",
"OnError": "ACS::END",
"Description": {
"en": "Grant account privilege to specified dbs of instance",
"zh-cn": "将帐户权限授予实例的指定dbs"
},
"Properties": {
"Service": "RDS",
"API": "GrantAccountPrivilege",
"Parameters": {
"RegionId": "{{ regionId }}",
"DBInstanceId": "{{ dbInstanceId }}",
"AccountName": "{{ accountName }}",
"DBName": "{{ ACS::TaskLoopItem }}",
"AccountPrivilege": "{{ accountPrivilege }}"
}
},
"Loop": {
"Items": "{{ dbNames }}"
}
},
{
"Name": "grantAccountPrivilegeForAllDBs",
"Action": "ACS::ExecuteAPI",
"Description": {
"en": "Grant account privilege to all dbs of instance",
"zh-cn": "将帐户权限授予实例的所有dbs"
},
"Properties": {
"Service": "RDS",
"API": "GrantAccountPrivilege",
"Parameters": {
"RegionId": "{{ regionId }}",
"DBInstanceId": "{{ dbInstanceId }}",
"AccountName": "{{ accountName }}",
"DBName": "{{ ACS::TaskLoopItem }}",
"AccountPrivilege": "{{ accountPrivilege }}"
}
},
"Loop": {
"Items": "{{ describeDatabases.dbNames }}"
}
}
]
}