-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS::TAG::TagResourceByTagIgnoreCaseSensitive.yml
84 lines (84 loc) · 2.19 KB
/
ACS::TAG::TagResourceByTagIgnoreCaseSensitive.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
FormatVersion: OOS-2019-06-01
Description:
en: Create and bind a single tag for a specified single cloud resource
zh-cn: 为指定的单个云资源创建并绑定单个标签
name-en: ACS::TAG::TagResourceByTagIgnoreCaseSensitive
name-zh-cn: 为指定的单个云资源创建并绑定单个标签(忽略标签大小写)
Parameters:
regionId:
Description:
en: The id of region
zh-cn: 地域ID
Type: String
Default: '{{ ACS::RegionId }}'
tagKey:
Description:
en: The resource tag key
zh-cn: 资源标签键
Type: String
tagValue:
Description:
en: The resource tag value
zh-cn: 资源标签值
Type: String
resourceARN:
Description:
en: Resource ARN
zh-cn: 资源ARN
Type: String
Tasks:
- Name: listTagResources
Action: ACS::ExecuteAPI
Description:
en: Query the resource tags
zh-cn: 查询资源标签信息
Properties:
Service: TAG
API: ListTagResources
Parameters:
RegionId: '{{ regionId }}'
ResourceARN:
- '{{ resourceARN }}'
Outputs:
duplicateKey:
Type: String
ValueSelector: '.TagResources[].Tags[].Key | match("^{{ tagKey }}$"; "ig") | .string'
tags:
Type: List
ValueSelector: .TagResources[].Tags[]
- Name: unTagResource
Action: ACS::ExecuteApi
When:
Fn::Not:
Fn::Equals:
- Null
- '{{ listTagResources.duplicateKey }}'
Description:
en: Untag the resources
zh-cn: 解绑标签
Properties:
Service: TAG
API: UnTagResources
Parameters:
RegionId: '{{ regionId }}'
ResourceARN:
- '{{ resourceARN }}'
TagKey:
- '{{listTagResources.duplicateKey}}'
- Name: tagResource
Action: ACS::ExecuteApi
Description:
en: Tag the resources through resource management
zh-cn: 通过资源管理给资源打标签
Properties:
Service: TAG
API: TagResources
Parameters:
RegionId: '{{ regionId }}'
ResourceARN:
- '{{ resourceARN }}'
Tags:
Fn::Jq:
- First
- '{"{{tagKey}}":"{{tagValue}}"}'
- {}