forked from ManageIQ/manageiq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorchestration_template_cfn_dialog_service.rb
138 lines (129 loc) · 4.79 KB
/
orchestration_template_cfn_dialog_service.rb
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
class OrchestrationTemplateCfnDialogService < OrchestrationTemplateDialogService
private
def add_deployment_options(dialog_group, position)
add_on_failure_field(dialog_group, position)
add_timeout_field(dialog_group, position + 1)
add_notifications_field(dialog_group, position + 2)
add_capabilities_field(dialog_group, position + 3)
add_resource_types_field(dialog_group, position + 4)
add_role_field(dialog_group, position + 5)
add_tags_field(dialog_group, position + 6)
add_policy_field(dialog_group, position + 7)
end
def add_on_failure_field(group, position)
group.dialog_fields.build(
:type => "DialogFieldDropDownList",
:name => "stack_onfailure",
:description => "Select what to do if stack creation failed",
:data_type => "string",
:display => "edit",
:required => true,
:values => [%w(ROLLBACK Rollback), %w(DO_NOTHING Do\ nothing), %w(DELETE Delete\ stack)],
:default_value => "ROLLBACK",
:options => {:sort_by => :description, :sort_order => :ascending},
:label => "On Failure",
:position => position,
:dialog_group => group
)
end
def add_timeout_field(group, position)
group.dialog_fields.build(
:type => "DialogFieldTextBox",
:name => "stack_timeout",
:description => "Abort the creation if it does not complete in a proper time window",
:data_type => "integer",
:display => "edit",
:required => false,
:options => {:protected => false},
:label => "Timeout(minutes)",
:position => position,
:dialog_group => group
)
end
def add_notifications_field(group, position)
group.dialog_fields.build(
:type => "DialogFieldTextAreaBox",
:name => "stack_notifications",
:description => "Notification SNS topic ARNs, one ARN per line",
:data_type => "string",
:display => "edit",
:required => false,
:options => {:protected => false},
:label => "Notification ARNs",
:position => position,
:dialog_group => group
)
end
def add_capabilities_field(group, position)
group.dialog_fields.build(
:type => "DialogFieldDropDownList",
:name => "stack_capabilities",
:description => "Choose one or both capabilities",
:data_type => "string",
:display => "edit",
:required => false,
:values => [['', '<default>'], %w(CAPABILITY_IAM CAPABILITY_IAM), %w(CAPABILITY_NAMED_IAM CAPABILITY_NAMED_IAM)],
:default_value => "",
:options => {:sort_by => :description, :sort_order => :ascending},
:label => "Capabilities",
:position => position,
:dialog_group => group
)
end
def add_resource_types_field(group, position)
group.dialog_fields.build(
:type => "DialogFieldTextAreaBox",
:name => "stack_resource_types",
:description => "Grand permissions to selected types, one type per line",
:data_type => "string",
:display => "edit",
:required => false,
:options => {:protected => false},
:label => "Permitted resource types",
:position => position,
:dialog_group => group
)
end
def add_role_field(group, position)
group.dialog_fields.build(
:type => "DialogFieldTextBox",
:name => "stack_role",
:description => "ARN of an IAM role used to create the stack",
:data_type => "string",
:display => "edit",
:required => false,
:options => {:protected => false},
:label => "Role ARN",
:position => position,
:dialog_group => group
)
end
def add_tags_field(group, position)
group.dialog_fields.build(
:type => "DialogFieldTextAreaBox",
:name => "stack_tags",
:description => "Key-value pairs with format key1=>val1, one pair per line",
:data_type => "string",
:display => "edit",
:required => false,
:options => {:protected => false},
:label => "AWS Tags",
:position => position,
:dialog_group => group
)
end
def add_policy_field(group, position)
group.dialog_fields.build(
:type => "DialogFieldTextAreaBox",
:name => "stack_policy",
:description => "URL of an policy file or the actual content of the policy",
:data_type => "string",
:display => "edit",
:required => false,
:options => {:protected => false},
:label => "Policy",
:position => position,
:dialog_group => group
)
end
end