-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS::ECS::CheckAvailableInstanceTypes.json
88 lines (88 loc) · 3.04 KB
/
ACS::ECS::CheckAvailableInstanceTypes.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
{
"FormatVersion": "OOS-2019-06-01",
"Description": {
"name-en": "ACS::ECS::CheckAvailableInstanceTypes",
"name-zh-cn": "检查instanceTypes参数列表中存在的可用实例类型",
"en": "Check the available instance types that exist in the list of instanceTypes parameter",
"zh-cn": "检查instanceTypes参数列表中存在的可用实例类型"
},
"Parameters": {
"instanceTypes": {
"Description": {
"en": "The source instance types to check",
"zh-cn": "要检查的源实例类型"
},
"Type": "List"
},
"regionId": {
"Description": {
"en": "The source region ID",
"zh-cn": "源地域ID"
},
"Type": "String",
"Default": "{{ACS::RegionId}}"
},
"zoneId": {
"Description": {
"en": "The source zone ID",
"zh-cn": "源可用区ID"
},
"Type": "String"
},
"instanceChargeType": {
"Description": {
"en": "The source instance charge type",
"zh-cn": "源实例的收费类型"
},
"Type": "String",
"Default": "PostPaid"
},
"networkCategory": {
"Description": {
"en": "The resource type",
"zh-cn": "资源类型"
},
"Type": "String",
"Default": "vpc"
}
},
"Tasks": [
{
"Name": "checkAvailableInstanceTypesExist",
"Action": "ACS::CheckFor",
"OnError": "ACS::END",
"Description": {
"en": "Queries current available resource in instance types input",
"zh-cn": "在输入的实例类型中查询当前可用的资源"
},
"Properties": {
"Service": "ECS",
"API": "DescribeAvailableResource",
"Parameters": {
"RegionId": "{{regionId}}",
"ZoneId": "{{ zoneId }}",
"DestinationResource": "InstanceType",
"ResourceType": "instance",
"InstanceChargeType": "{{instanceChargeType}}",
"NetworkCategory": "{{networkCategory}}"
},
"DesiredValues": [
"true"
],
"PropertySelector": ".AvailableZones.AvailableZone[0].AvailableResources.AvailableResource[0].SupportedResources.SupportedResource|map(select(.StatusCategory==\"WithStock\" or .StatusCategory==\"ClosedWithStock\")|.Value)|map({(.):null})|add as $available_types|$available_types|{{instanceTypes}}|map(.|in($available_types))|any|tostring"
},
"Outputs": {
"availableInstanceTypes": {
"Type": "List",
"ValueSelector": ".AvailableZones.AvailableZone[0].AvailableResources.AvailableResource[0].SupportedResources.SupportedResource|map(select(.StatusCategory==\"WithStock\" or .StatusCategory==\"ClosedWithStock\")|.Value)|map({(.):null})|add as $available_types|{{instanceTypes}} as $user_types |$user_types|map(.|in($available_types)) as $result|$result|select(any)|index(true) as $index|$user_types[$index]"
}
}
}
],
"Outputs": {
"availableInstanceTypes": {
"Type": "List",
"Value": "{{ checkAvailableInstanceTypesExist.availableInstanceTypes }}"
}
}
}