-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS-ECS-RevokeSecurityGroupRules.json
213 lines (213 loc) · 5.67 KB
/
ACS-ECS-RevokeSecurityGroupRules.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
{
"FormatVersion": "OOS-2019-06-01",
"Description": {
"en": "Del the security gorup rule",
"zh-cn": "删除安全组规则",
"name-en": "ACS-ECS-RevokeSecurityGroupRules",
"name-zh-cn": "删除安全组规则",
"categories": [
"instance_manage",
"computenest"
]
},
"Parameters": {
"regionId": {
"Label": {
"en": "RegionId",
"zh-cn": "地域ID"
},
"Type": "String",
"AssociationProperty": "RegionId",
"Default": "{{ ACS::RegionId }}"
},
"securityGroupId": {
"Label": {
"en": "SecurityGroupId",
"zh-cn": "安全组ID"
},
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
"AssociationPropertyMetadata": {
"regionId": "regionId"
}
},
"direction": {
"Label": {
"en": "Direction",
"zh-cn": "安全组规则授权方向"
},
"Description": {
"en": "<ul class=\"ul\"> <li class=\"li\" >egress: security group outbound direction</li> <li class=\"li\" >ingress: security group incoming direction</li> <li class=\"li\">all: direction-insensitive</li></ul>",
"zh-cn": "<ul class=\"ul\"> <li class=\"li\" >egress:安全组出方向</li> <li class=\"li\" >ingress:安全组入方向</li> <li class=\"li\">all:不区分方向</li></ul>"
},
"Type": "String",
"AllowedValues": [
"egress",
"ingress",
"all"
]
},
"policy": {
"Label": {
"en": "Policy",
"zh-cn": "安全组规则访问权限"
},
"Description": {
"en": "<ul class=\"ul\"> <li class=\"li\">Accept:Accept access</li> <li class=\"li\">Arop:Access denied</li> </ul>",
"zh-cn": "<ul class=\"ul\"> <li class=\"li\">Accept:接受访问</li> <li class=\"li\">Arop:拒绝访问</li> </ul>"
},
"Type": "String",
"AllowedValues": [
"Accept",
"Drop"
]
},
"portRange": {
"Label": {
"en": "PortRange",
"zh-cn": "端口范围"
},
"Description": {
"en": "Use a slash (/) to separate the start and end ports. Example: 1/200, -1/-1, 22/22",
"zh-cn": "使用斜线(/)隔开起始端口和终止端口。例如:1/200,-1/-1,22/22"
},
"Type": "String"
},
"sourceCidrIp": {
"Label": {
"en": "SourceCidrIp",
"zh-cn": "源端IPv4 CIDR地址块"
},
"Description": {
"en": "Example: 10.0.0.0/8,10.0.0.0/0",
"zh-cn": "例如:10.0.0.0/8,0.0.0.0/0"
},
"Type": "String"
},
"OOSAssumeRole": {
"Label": {
"en": "OOSAssumeRole",
"zh-cn": "OOS扮演的RAM角色"
},
"Type": "String",
"Default": ""
}
},
"RamRole": "{{ OOSAssumeRole }}",
"Tasks": [
{
"Name": "describeSecurityGroupRules",
"Action": "ACS::ExecuteAPI",
"Description": {
"en": "Get security group rules",
"zh-cn": "获取安全组规则"
},
"Properties": {
"Service": "ECS",
"API": "DescribeSecurityGroupAttribute",
"Parameters": {
"RegionId": "{{ regionId }}",
"SecurityGroupId": "{{ securityGroupId }}",
"Direction": "{{ direction }}"
}
},
"Outputs": {
"rules": {
"Type": "Json",
"ValueSelector": ".Permissions.Permission | map( select(.Policy == \"{{ policy }}\") ) | map( select(.PortRange == \"{{ portRange }}\") ) | map( select(.SourceCidrIp == \"{{ sourceCidrIp }}\") )"
}
}
},
{
"Name": "delSecurityGroupRule",
"Action": "ACS::ExecuteAPI",
"Description": {
"en": "Delete security group rule",
"zh-cn": "删除安全组规则"
},
"Properties": {
"Service": "ECS",
"API": "RevokeSecurityGroup",
"Parameters": {
"SecurityGroupId": "{{ securityGroupId }}",
"RegionId": "{{ regionId }}",
"Policy": {
"Fn::Select": [
"Policy",
"{{ ACS::TaskLoopItem }}"
]
},
"PortRange": {
"Fn::Select": [
"PortRange",
"{{ ACS::TaskLoopItem }}"
]
},
"SourceCidrIp": {
"Fn::Select": [
"SourceCidrIp",
"{{ ACS::TaskLoopItem }}"
]
},
"IpProtocol": {
"Fn::Select": [
"IpProtocol",
"{{ ACS::TaskLoopItem }}"
]
}
}
},
"Loop": {
"Items": "{{ describeSecurityGroupRules.rules }}",
"RateControl": {
"MaxErrors": 0,
"Mode": "Concurrency",
"Concurrency": 1
}
}
}
],
"Metadata": {
"ALIYUN::OOS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"direction",
"policy",
"portRange",
"sourceCidrIp"
],
"Label": {
"default": {
"zh-cn": "设置参数",
"en": "Configure Parameters"
}
}
},
{
"Parameters": [
"regionId",
"securityGroupId"
],
"Label": {
"default": {
"zh-cn": "选择安全组",
"en": "Select Security Group"
}
}
},
{
"Parameters": [
"OOSAssumeRole"
],
"Label": {
"default": {
"zh-cn": "高级选项",
"en": "Control Options"
}
}
}
]
}
}
}