-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS::ECS::DisassociateSharedImages.yml
112 lines (112 loc) · 3.19 KB
/
ACS::ECS::DisassociateSharedImages.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
112
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS::ECS::DisassociateSharedImages
name-zh-cn: 解除镜像共享关系(资源共享)
en: Disassociate shared images.
zh-cn: 解除镜像共享关系(资源共享)
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: 地域ID
Tasks:
- Name: DescribeSnapshotsRelatedToImage
Action: ACS::ExecuteApi
Description:
en: Describe snapshots related to image
zh-cn: 查询被自定义镜像关联快照
Properties:
Service: ECS
API: DescribeSnapshots
Parameters:
RegionId: '{{ regionId }}'
Outputs:
imageSnapshotIds:
Type: List
ValueSelector: .Snapshots.Snapshot | map(select(.Usage == "image" or .Usage == "image_disk" ) | .SnapshotId) | .[]
- Name: DescribeImagesRelatedToSnapshot
Action: ACS::ExecuteApi
Description:
en: Describe images related to snapshot
zh-cn: 查询被快照关联的自定义镜像
Properties:
Service: ECS
API: DescribeImages
Parameters:
RegionId: '{{ regionId }}'
SnapshotId: '{{ ACS::TaskLoopItem }}'
Outputs:
imageIds:
Type: List
ValueSelector: .Images.Image[].ImageId
Loop:
Items: '{{ DescribeSnapshotsRelatedToImage.imageSnapshotIds }}'
RateControl:
MaxErrors: 0
Mode: Concurrency
Concurrency: 1
Outputs:
imageIdList:
AggregateType: Fn::ListJoin
AggregateField: imageIds
- Name: ListSharedResources
Action: ACS::ExecuteApi
Description:
en: List shared resources
zh-cn: 查询被共享自定义镜像的共享单元信息
Properties:
Service: ResourceSharing
API: ListSharedResources
Parameters:
ResourceOwner: Self
ResourceType: Image
ResourceIds:
- '{{ ACS::TaskLoopItem }}'
Outputs:
resourceShareInfo:
Type: Json
ValueSelector: .SharedResources | map({resourceId:.ResourceId, resourceShareId:.ResourceShareId}) | first
Loop:
Items:
Fn::Jq:
- All
- map(select(. != null)) | .[][]
- '{{ DescribeImagesRelatedToSnapshot.imageIdList }}'
RateControl:
MaxErrors: 0
Mode: Concurrency
Concurrency: 1
Outputs:
resourceShareInfos:
AggregateType: Fn::ListJoin
AggregateField: resourceShareInfo
- Name: DisassociateResourceShare
Action: ACS::ExecuteApi
Description:
en: Disassociate resource share
zh-cn: 解除被共享自定义镜像的共享关系
Properties:
Service: ResourceSharing
API: DisassociateResourceShare
Parameters:
ResourceShareId:
Fn::Select:
- resourceShareId
- '{{ ACS::TaskLoopItem }}'
Resources:
- ResourceType: Image
ResourceId:
Fn::Select:
- resourceId
- '{{ ACS::TaskLoopItem }}'
Loop:
Items:
Fn::Jq:
- First
- map(select(.!= null))
- '{{ ListSharedResources.resourceShareInfos }}'
RateControl:
MaxErrors: 0
Mode: Concurrency
Concurrency: 1