aws-sdk-cloudformation 1.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/aws-sdk-cloudformation.rb +52 -0
- data/lib/aws-sdk-cloudformation/client.rb +2014 -0
- data/lib/aws-sdk-cloudformation/client_api.rb +886 -0
- data/lib/aws-sdk-cloudformation/customizations.rb +7 -0
- data/lib/aws-sdk-cloudformation/errors.rb +23 -0
- data/lib/aws-sdk-cloudformation/event.rb +148 -0
- data/lib/aws-sdk-cloudformation/resource.rb +271 -0
- data/lib/aws-sdk-cloudformation/stack.rb +712 -0
- data/lib/aws-sdk-cloudformation/stack_resource.rb +188 -0
- data/lib/aws-sdk-cloudformation/stack_resource_summary.rb +157 -0
- data/lib/aws-sdk-cloudformation/types.rb +2684 -0
- data/lib/aws-sdk-cloudformation/waiters.rb +266 -0
- metadata +85 -0
@@ -0,0 +1,712 @@
|
|
1
|
+
# WARNING ABOUT GENERATED CODE
|
2
|
+
#
|
3
|
+
# This file is generated. See the contributing for info on making contributions:
|
4
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
|
+
#
|
6
|
+
# WARNING ABOUT GENERATED CODE
|
7
|
+
|
8
|
+
module Aws
|
9
|
+
module CloudFormation
|
10
|
+
class Stack
|
11
|
+
|
12
|
+
extend Aws::Deprecations
|
13
|
+
|
14
|
+
# @overload def initialize(name, options = {})
|
15
|
+
# @param [String] name
|
16
|
+
# @option options [Client] :client
|
17
|
+
# @overload def initialize(options = {})
|
18
|
+
# @option options [required, String] :name
|
19
|
+
# @option options [Client] :client
|
20
|
+
def initialize(*args)
|
21
|
+
options = Hash === args.last ? args.pop.dup : {}
|
22
|
+
@name = extract_name(args, options)
|
23
|
+
@data = options.delete(:data)
|
24
|
+
@client = options.delete(:client) || Client.new(options)
|
25
|
+
end
|
26
|
+
|
27
|
+
# @!group Read-Only Attributes
|
28
|
+
|
29
|
+
# @return [String]
|
30
|
+
def name
|
31
|
+
@name
|
32
|
+
end
|
33
|
+
alias :stack_name :name
|
34
|
+
|
35
|
+
# Unique identifier of the stack.
|
36
|
+
# @return [String]
|
37
|
+
def stack_id
|
38
|
+
data.stack_id
|
39
|
+
end
|
40
|
+
|
41
|
+
# The unique ID of the change set.
|
42
|
+
# @return [String]
|
43
|
+
def change_set_id
|
44
|
+
data.change_set_id
|
45
|
+
end
|
46
|
+
|
47
|
+
# A user-defined description associated with the stack.
|
48
|
+
# @return [String]
|
49
|
+
def description
|
50
|
+
data.description
|
51
|
+
end
|
52
|
+
|
53
|
+
# A list of `Parameter` structures.
|
54
|
+
# @return [Array<Types::Parameter>]
|
55
|
+
def parameters
|
56
|
+
data.parameters
|
57
|
+
end
|
58
|
+
|
59
|
+
# The time at which the stack was created.
|
60
|
+
# @return [Time]
|
61
|
+
def creation_time
|
62
|
+
data.creation_time
|
63
|
+
end
|
64
|
+
|
65
|
+
# The time the stack was last updated. This field will only be returned
|
66
|
+
# if the stack has been updated at least once.
|
67
|
+
# @return [Time]
|
68
|
+
def last_updated_time
|
69
|
+
data.last_updated_time
|
70
|
+
end
|
71
|
+
|
72
|
+
# Current status of the stack.
|
73
|
+
# @return [String]
|
74
|
+
def stack_status
|
75
|
+
data.stack_status
|
76
|
+
end
|
77
|
+
|
78
|
+
# Success/failure message associated with the stack status.
|
79
|
+
# @return [String]
|
80
|
+
def stack_status_reason
|
81
|
+
data.stack_status_reason
|
82
|
+
end
|
83
|
+
|
84
|
+
# Boolean to enable or disable rollback on stack creation failures:
|
85
|
+
#
|
86
|
+
# * `true`\: disable rollback
|
87
|
+
#
|
88
|
+
# * `false`\: enable rollback
|
89
|
+
# @return [Boolean]
|
90
|
+
def disable_rollback
|
91
|
+
data.disable_rollback
|
92
|
+
end
|
93
|
+
|
94
|
+
# SNS topic ARNs to which stack related events are published.
|
95
|
+
# @return [Array<String>]
|
96
|
+
def notification_arns
|
97
|
+
data.notification_arns
|
98
|
+
end
|
99
|
+
|
100
|
+
# The amount of time within which stack creation should complete.
|
101
|
+
# @return [Integer]
|
102
|
+
def timeout_in_minutes
|
103
|
+
data.timeout_in_minutes
|
104
|
+
end
|
105
|
+
|
106
|
+
# The capabilities allowed in the stack.
|
107
|
+
# @return [Array<String>]
|
108
|
+
def capabilities
|
109
|
+
data.capabilities
|
110
|
+
end
|
111
|
+
|
112
|
+
# A list of output structures.
|
113
|
+
# @return [Array<Types::Output>]
|
114
|
+
def outputs
|
115
|
+
data.outputs
|
116
|
+
end
|
117
|
+
|
118
|
+
# The Amazon Resource Name (ARN) of an AWS Identity and Access
|
119
|
+
# Management (IAM) role that is associated with the stack. During a
|
120
|
+
# stack operation, AWS CloudFormation uses this role's credentials to
|
121
|
+
# make calls on your behalf.
|
122
|
+
# @return [String]
|
123
|
+
def role_arn
|
124
|
+
data.role_arn
|
125
|
+
end
|
126
|
+
|
127
|
+
# A list of `Tag`s that specify information about the stack.
|
128
|
+
# @return [Array<Types::Tag>]
|
129
|
+
def tags
|
130
|
+
data.tags
|
131
|
+
end
|
132
|
+
|
133
|
+
# @!endgroup
|
134
|
+
|
135
|
+
# @return [Client]
|
136
|
+
def client
|
137
|
+
@client
|
138
|
+
end
|
139
|
+
|
140
|
+
# Loads, or reloads {#data} for the current {Stack}.
|
141
|
+
# Returns `self` making it possible to chain methods.
|
142
|
+
#
|
143
|
+
# stack.reload.data
|
144
|
+
#
|
145
|
+
# @return [self]
|
146
|
+
def load
|
147
|
+
resp = @client.describe_stacks(stack_name: @name)
|
148
|
+
@data = resp.stacks[0]
|
149
|
+
self
|
150
|
+
end
|
151
|
+
alias :reload :load
|
152
|
+
|
153
|
+
# @return [Types::Stack]
|
154
|
+
# Returns the data for this {Stack}. Calls
|
155
|
+
# {Client#describe_stacks} if {#data_loaded?} is `false`.
|
156
|
+
def data
|
157
|
+
load unless @data
|
158
|
+
@data
|
159
|
+
end
|
160
|
+
|
161
|
+
# @return [Boolean]
|
162
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
163
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
164
|
+
def data_loaded?
|
165
|
+
!!@data
|
166
|
+
end
|
167
|
+
|
168
|
+
# @param [Hash] options ({})
|
169
|
+
# @return [Boolean]
|
170
|
+
# Returns `true` if the Stack exists.
|
171
|
+
def exists?(options = {})
|
172
|
+
begin
|
173
|
+
wait_until_exists(options.merge(max_attempts: 1))
|
174
|
+
true
|
175
|
+
rescue Aws::Waiters::Errors::UnexpectedError => e
|
176
|
+
raise e.error
|
177
|
+
rescue Aws::Waiters::Errors::WaiterFailed
|
178
|
+
false
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# @param [Hash] options ({})
|
183
|
+
# @option options [Integer] :max_attempts (20)
|
184
|
+
# @option options [Float] :delay (5)
|
185
|
+
# @option options [Proc] :before_attempt
|
186
|
+
# @option options [Proc] :before_wait
|
187
|
+
# @return [Stack]
|
188
|
+
def wait_until_exists(options = {})
|
189
|
+
options, params = separate_params_and_options(options)
|
190
|
+
waiter = Waiters::StackExists.new(options)
|
191
|
+
yield_waiter_and_warn(waiter, &Proc.new) if block_given?
|
192
|
+
waiter.wait(params.merge(stack_name: @name))
|
193
|
+
Stack.new({
|
194
|
+
name: @name,
|
195
|
+
client: @client
|
196
|
+
})
|
197
|
+
end
|
198
|
+
|
199
|
+
# @!group Actions
|
200
|
+
|
201
|
+
# @example Request syntax with placeholder values
|
202
|
+
#
|
203
|
+
# stack.cancel_update()
|
204
|
+
# @param [Hash] options ({})
|
205
|
+
# @return [EmptyStructure]
|
206
|
+
def cancel_update(options = {})
|
207
|
+
options = options.merge(stack_name: @name)
|
208
|
+
resp = @client.cancel_update_stack(options)
|
209
|
+
resp.data
|
210
|
+
end
|
211
|
+
|
212
|
+
# @example Request syntax with placeholder values
|
213
|
+
#
|
214
|
+
# stack.create({
|
215
|
+
# template_body: "TemplateBody",
|
216
|
+
# template_url: "TemplateURL",
|
217
|
+
# parameters: [
|
218
|
+
# {
|
219
|
+
# parameter_key: "ParameterKey",
|
220
|
+
# parameter_value: "ParameterValue",
|
221
|
+
# use_previous_value: false,
|
222
|
+
# },
|
223
|
+
# ],
|
224
|
+
# disable_rollback: false,
|
225
|
+
# timeout_in_minutes: 1,
|
226
|
+
# notification_arns: ["NotificationARN"],
|
227
|
+
# capabilities: ["CAPABILITY_IAM"], # accepts CAPABILITY_IAM, CAPABILITY_NAMED_IAM
|
228
|
+
# resource_types: ["ResourceType"],
|
229
|
+
# role_arn: "RoleARN",
|
230
|
+
# on_failure: "DO_NOTHING", # accepts DO_NOTHING, ROLLBACK, DELETE
|
231
|
+
# stack_policy_body: "StackPolicyBody",
|
232
|
+
# stack_policy_url: "StackPolicyURL",
|
233
|
+
# tags: [
|
234
|
+
# {
|
235
|
+
# key: "TagKey",
|
236
|
+
# value: "TagValue",
|
237
|
+
# },
|
238
|
+
# ],
|
239
|
+
# })
|
240
|
+
# @param [Hash] options ({})
|
241
|
+
# @option options [String] :template_body
|
242
|
+
# Structure containing the template body with a minimum length of 1 byte
|
243
|
+
# and a maximum length of 51,200 bytes. For more information, go to
|
244
|
+
# [Template Anatomy][1] in the AWS CloudFormation User Guide.
|
245
|
+
#
|
246
|
+
# Conditional: You must specify either the `TemplateBody` or the
|
247
|
+
# `TemplateURL` parameter, but not both.
|
248
|
+
#
|
249
|
+
#
|
250
|
+
#
|
251
|
+
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html
|
252
|
+
# @option options [String] :template_url
|
253
|
+
# Location of file containing the template body. The URL must point to a
|
254
|
+
# template (max size: 460,800 bytes) that is located in an Amazon S3
|
255
|
+
# bucket. For more information, go to the [Template Anatomy][1] in the
|
256
|
+
# AWS CloudFormation User Guide.
|
257
|
+
#
|
258
|
+
# Conditional: You must specify either the `TemplateBody` or the
|
259
|
+
# `TemplateURL` parameter, but not both.
|
260
|
+
#
|
261
|
+
#
|
262
|
+
#
|
263
|
+
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html
|
264
|
+
# @option options [Array<Types::Parameter>] :parameters
|
265
|
+
# A list of `Parameter` structures that specify input parameters for the
|
266
|
+
# stack. For more information, see the [Parameter][1] data type.
|
267
|
+
#
|
268
|
+
#
|
269
|
+
#
|
270
|
+
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Parameter.html
|
271
|
+
# @option options [Boolean] :disable_rollback
|
272
|
+
# Set to `true` to disable rollback of the stack if stack creation
|
273
|
+
# failed. You can specify either `DisableRollback` or `OnFailure`, but
|
274
|
+
# not both.
|
275
|
+
#
|
276
|
+
# Default: `false`
|
277
|
+
# @option options [Integer] :timeout_in_minutes
|
278
|
+
# The amount of time that can pass before the stack status becomes
|
279
|
+
# CREATE\_FAILED; if `DisableRollback` is not set or is set to `false`,
|
280
|
+
# the stack will be rolled back.
|
281
|
+
# @option options [Array<String>] :notification_arns
|
282
|
+
# The Simple Notification Service (SNS) topic ARNs to publish stack
|
283
|
+
# related events. You can find your SNS topic ARNs using the [SNS
|
284
|
+
# console][1] or your Command Line Interface (CLI).
|
285
|
+
#
|
286
|
+
#
|
287
|
+
#
|
288
|
+
# [1]: https://console.aws.amazon.com/sns
|
289
|
+
# @option options [Array<String>] :capabilities
|
290
|
+
# A list of values that you must specify before AWS CloudFormation can
|
291
|
+
# create certain stacks. Some stack templates might include resources
|
292
|
+
# that can affect permissions in your AWS account, for example, by
|
293
|
+
# creating new AWS Identity and Access Management (IAM) users. For those
|
294
|
+
# stacks, you must explicitly acknowledge their capabilities by
|
295
|
+
# specifying this parameter.
|
296
|
+
#
|
297
|
+
# The only valid values are `CAPABILITY_IAM` and `CAPABILITY_NAMED_IAM`.
|
298
|
+
# The following resources require you to specify this parameter: [
|
299
|
+
# AWS::IAM::AccessKey][1], [ AWS::IAM::Group][2], [
|
300
|
+
# AWS::IAM::InstanceProfile][3], [ AWS::IAM::Policy][4], [
|
301
|
+
# AWS::IAM::Role][5], [ AWS::IAM::User][6], and [
|
302
|
+
# AWS::IAM::UserToGroupAddition][7]. If your stack template contains
|
303
|
+
# these resources, we recommend that you review all permissions
|
304
|
+
# associated with them and edit their permissions if necessary.
|
305
|
+
#
|
306
|
+
# If you have IAM resources, you can specify either capability. If you
|
307
|
+
# have IAM resources with custom names, you must specify
|
308
|
+
# `CAPABILITY_NAMED_IAM`. If you don't specify this parameter, this
|
309
|
+
# action returns an `InsufficientCapabilities` error.
|
310
|
+
#
|
311
|
+
# For more information, see [Acknowledging IAM Resources in AWS
|
312
|
+
# CloudFormation Templates][8].
|
313
|
+
#
|
314
|
+
#
|
315
|
+
#
|
316
|
+
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html
|
317
|
+
# [2]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html
|
318
|
+
# [3]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html
|
319
|
+
# [4]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html
|
320
|
+
# [5]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html
|
321
|
+
# [6]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html
|
322
|
+
# [7]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html
|
323
|
+
# [8]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities
|
324
|
+
# @option options [Array<String>] :resource_types
|
325
|
+
# The template resource types that you have permissions to work with for
|
326
|
+
# this create stack action, such as `AWS::EC2::Instance`, `AWS::EC2::*`,
|
327
|
+
# or `Custom::MyCustomInstance`. Use the following syntax to describe
|
328
|
+
# template resource types: `AWS::*` (for all AWS resource), `Custom::*`
|
329
|
+
# (for all custom resources), `Custom::logical_ID ` (for a specific
|
330
|
+
# custom resource), `AWS::service_name::*` (for all resources of a
|
331
|
+
# particular AWS service), and `AWS::service_name::resource_logical_ID `
|
332
|
+
# (for a specific AWS resource).
|
333
|
+
#
|
334
|
+
# If the list of resource types doesn't include a resource that you're
|
335
|
+
# creating, the stack creation fails. By default, AWS CloudFormation
|
336
|
+
# grants permissions to all resource types. AWS Identity and Access
|
337
|
+
# Management (IAM) uses this parameter for AWS CloudFormation-specific
|
338
|
+
# condition keys in IAM policies. For more information, see [Controlling
|
339
|
+
# Access with AWS Identity and Access Management][1].
|
340
|
+
#
|
341
|
+
#
|
342
|
+
#
|
343
|
+
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html
|
344
|
+
# @option options [String] :role_arn
|
345
|
+
# The Amazon Resource Name (ARN) of an AWS Identity and Access
|
346
|
+
# Management (IAM) role that AWS CloudFormation assumes to create the
|
347
|
+
# stack. AWS CloudFormation uses the role's credentials to make calls
|
348
|
+
# on your behalf. AWS CloudFormation always uses this role for all
|
349
|
+
# future operations on the stack. As long as users have permission to
|
350
|
+
# operate on the stack, AWS CloudFormation uses this role even if the
|
351
|
+
# users don't have permission to pass it. Ensure that the role grants
|
352
|
+
# least privilege.
|
353
|
+
#
|
354
|
+
# If you don't specify a value, AWS CloudFormation uses the role that
|
355
|
+
# was previously associated with the stack. If no role is available, AWS
|
356
|
+
# CloudFormation uses a temporary session that is generated from your
|
357
|
+
# user credentials.
|
358
|
+
# @option options [String] :on_failure
|
359
|
+
# Determines what action will be taken if stack creation fails. This
|
360
|
+
# must be one of: DO\_NOTHING, ROLLBACK, or DELETE. You can specify
|
361
|
+
# either `OnFailure` or `DisableRollback`, but not both.
|
362
|
+
#
|
363
|
+
# Default: `ROLLBACK`
|
364
|
+
# @option options [String] :stack_policy_body
|
365
|
+
# Structure containing the stack policy body. For more information, go
|
366
|
+
# to [ Prevent Updates to Stack Resources][1] in the *AWS CloudFormation
|
367
|
+
# User Guide*. You can specify either the `StackPolicyBody` or the
|
368
|
+
# `StackPolicyURL` parameter, but not both.
|
369
|
+
#
|
370
|
+
#
|
371
|
+
#
|
372
|
+
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/protect-stack-resources.html
|
373
|
+
# @option options [String] :stack_policy_url
|
374
|
+
# Location of a file containing the stack policy. The URL must point to
|
375
|
+
# a policy (maximum size: 16 KB) located in an S3 bucket in the same
|
376
|
+
# region as the stack. You can specify either the `StackPolicyBody` or
|
377
|
+
# the `StackPolicyURL` parameter, but not both.
|
378
|
+
# @option options [Array<Types::Tag>] :tags
|
379
|
+
# Key-value pairs to associate with this stack. AWS CloudFormation also
|
380
|
+
# propagates these tags to the resources created in the stack. A maximum
|
381
|
+
# number of 10 tags can be specified.
|
382
|
+
# @return [Types::CreateStackOutput]
|
383
|
+
def create(options = {})
|
384
|
+
options = options.merge(stack_name: @name)
|
385
|
+
resp = @client.create_stack(options)
|
386
|
+
resp.data
|
387
|
+
end
|
388
|
+
|
389
|
+
# @example Request syntax with placeholder values
|
390
|
+
#
|
391
|
+
# stack.delete({
|
392
|
+
# retain_resources: ["LogicalResourceId"],
|
393
|
+
# role_arn: "RoleARN",
|
394
|
+
# })
|
395
|
+
# @param [Hash] options ({})
|
396
|
+
# @option options [Array<String>] :retain_resources
|
397
|
+
# For stacks in the `DELETE_FAILED` state, a list of resource logical
|
398
|
+
# IDs that are associated with the resources you want to retain. During
|
399
|
+
# deletion, AWS CloudFormation deletes the stack but does not delete the
|
400
|
+
# retained resources.
|
401
|
+
#
|
402
|
+
# Retaining resources is useful when you cannot delete a resource, such
|
403
|
+
# as a non-empty S3 bucket, but you want to delete the stack.
|
404
|
+
# @option options [String] :role_arn
|
405
|
+
# The Amazon Resource Name (ARN) of an AWS Identity and Access
|
406
|
+
# Management (IAM) role that AWS CloudFormation assumes to delete the
|
407
|
+
# stack. AWS CloudFormation uses the role's credentials to make calls
|
408
|
+
# on your behalf.
|
409
|
+
#
|
410
|
+
# If you don't specify a value, AWS CloudFormation uses the role that
|
411
|
+
# was previously associated with the stack. If no role is available, AWS
|
412
|
+
# CloudFormation uses a temporary session that is generated from your
|
413
|
+
# user credentials.
|
414
|
+
# @return [EmptyStructure]
|
415
|
+
def delete(options = {})
|
416
|
+
options = options.merge(stack_name: @name)
|
417
|
+
resp = @client.delete_stack(options)
|
418
|
+
resp.data
|
419
|
+
end
|
420
|
+
|
421
|
+
# @example Request syntax with placeholder values
|
422
|
+
#
|
423
|
+
# stack.update({
|
424
|
+
# template_body: "TemplateBody",
|
425
|
+
# template_url: "TemplateURL",
|
426
|
+
# use_previous_template: false,
|
427
|
+
# stack_policy_during_update_body: "StackPolicyDuringUpdateBody",
|
428
|
+
# stack_policy_during_update_url: "StackPolicyDuringUpdateURL",
|
429
|
+
# parameters: [
|
430
|
+
# {
|
431
|
+
# parameter_key: "ParameterKey",
|
432
|
+
# parameter_value: "ParameterValue",
|
433
|
+
# use_previous_value: false,
|
434
|
+
# },
|
435
|
+
# ],
|
436
|
+
# capabilities: ["CAPABILITY_IAM"], # accepts CAPABILITY_IAM, CAPABILITY_NAMED_IAM
|
437
|
+
# resource_types: ["ResourceType"],
|
438
|
+
# role_arn: "RoleARN",
|
439
|
+
# stack_policy_body: "StackPolicyBody",
|
440
|
+
# stack_policy_url: "StackPolicyURL",
|
441
|
+
# notification_arns: ["NotificationARN"],
|
442
|
+
# tags: [
|
443
|
+
# {
|
444
|
+
# key: "TagKey",
|
445
|
+
# value: "TagValue",
|
446
|
+
# },
|
447
|
+
# ],
|
448
|
+
# })
|
449
|
+
# @param [Hash] options ({})
|
450
|
+
# @option options [String] :template_body
|
451
|
+
# Structure containing the template body with a minimum length of 1 byte
|
452
|
+
# and a maximum length of 51,200 bytes. (For more information, go to
|
453
|
+
# [Template Anatomy][1] in the AWS CloudFormation User Guide.)
|
454
|
+
#
|
455
|
+
# Conditional: You must specify either the `TemplateBody` or the
|
456
|
+
# `TemplateURL` parameter, but not both.
|
457
|
+
#
|
458
|
+
#
|
459
|
+
#
|
460
|
+
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html
|
461
|
+
# @option options [String] :template_url
|
462
|
+
# Location of file containing the template body. The URL must point to a
|
463
|
+
# template that is located in an Amazon S3 bucket. For more information,
|
464
|
+
# go to [Template Anatomy][1] in the AWS CloudFormation User Guide.
|
465
|
+
#
|
466
|
+
# Conditional: You must specify either the `TemplateBody` or the
|
467
|
+
# `TemplateURL` parameter, but not both.
|
468
|
+
#
|
469
|
+
#
|
470
|
+
#
|
471
|
+
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html
|
472
|
+
# @option options [Boolean] :use_previous_template
|
473
|
+
# Reuse the existing template that is associated with the stack that you
|
474
|
+
# are updating.
|
475
|
+
# @option options [String] :stack_policy_during_update_body
|
476
|
+
# Structure containing the temporary overriding stack policy body. You
|
477
|
+
# can specify either the `StackPolicyDuringUpdateBody` or the
|
478
|
+
# `StackPolicyDuringUpdateURL` parameter, but not both.
|
479
|
+
#
|
480
|
+
# If you want to update protected resources, specify a temporary
|
481
|
+
# overriding stack policy during this update. If you do not specify a
|
482
|
+
# stack policy, the current policy that is associated with the stack
|
483
|
+
# will be used.
|
484
|
+
# @option options [String] :stack_policy_during_update_url
|
485
|
+
# Location of a file containing the temporary overriding stack policy.
|
486
|
+
# The URL must point to a policy (max size: 16KB) located in an S3
|
487
|
+
# bucket in the same region as the stack. You can specify either the
|
488
|
+
# `StackPolicyDuringUpdateBody` or the `StackPolicyDuringUpdateURL`
|
489
|
+
# parameter, but not both.
|
490
|
+
#
|
491
|
+
# If you want to update protected resources, specify a temporary
|
492
|
+
# overriding stack policy during this update. If you do not specify a
|
493
|
+
# stack policy, the current policy that is associated with the stack
|
494
|
+
# will be used.
|
495
|
+
# @option options [Array<Types::Parameter>] :parameters
|
496
|
+
# A list of `Parameter` structures that specify input parameters for the
|
497
|
+
# stack. For more information, see the [Parameter][1] data type.
|
498
|
+
#
|
499
|
+
#
|
500
|
+
#
|
501
|
+
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Parameter.html
|
502
|
+
# @option options [Array<String>] :capabilities
|
503
|
+
# A list of values that you must specify before AWS CloudFormation can
|
504
|
+
# update certain stacks. Some stack templates might include resources
|
505
|
+
# that can affect permissions in your AWS account, for example, by
|
506
|
+
# creating new AWS Identity and Access Management (IAM) users. For those
|
507
|
+
# stacks, you must explicitly acknowledge their capabilities by
|
508
|
+
# specifying this parameter.
|
509
|
+
#
|
510
|
+
# The only valid values are `CAPABILITY_IAM` and `CAPABILITY_NAMED_IAM`.
|
511
|
+
# The following resources require you to specify this parameter: [
|
512
|
+
# AWS::IAM::AccessKey][1], [ AWS::IAM::Group][2], [
|
513
|
+
# AWS::IAM::InstanceProfile][3], [ AWS::IAM::Policy][4], [
|
514
|
+
# AWS::IAM::Role][5], [ AWS::IAM::User][6], and [
|
515
|
+
# AWS::IAM::UserToGroupAddition][7]. If your stack template contains
|
516
|
+
# these resources, we recommend that you review all permissions
|
517
|
+
# associated with them and edit their permissions if necessary.
|
518
|
+
#
|
519
|
+
# If you have IAM resources, you can specify either capability. If you
|
520
|
+
# have IAM resources with custom names, you must specify
|
521
|
+
# `CAPABILITY_NAMED_IAM`. If you don't specify this parameter, this
|
522
|
+
# action returns an `InsufficientCapabilities` error.
|
523
|
+
#
|
524
|
+
# For more information, see [Acknowledging IAM Resources in AWS
|
525
|
+
# CloudFormation Templates][8].
|
526
|
+
#
|
527
|
+
#
|
528
|
+
#
|
529
|
+
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html
|
530
|
+
# [2]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html
|
531
|
+
# [3]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html
|
532
|
+
# [4]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html
|
533
|
+
# [5]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html
|
534
|
+
# [6]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html
|
535
|
+
# [7]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html
|
536
|
+
# [8]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities
|
537
|
+
# @option options [Array<String>] :resource_types
|
538
|
+
# The template resource types that you have permissions to work with for
|
539
|
+
# this update stack action, such as `AWS::EC2::Instance`, `AWS::EC2::*`,
|
540
|
+
# or `Custom::MyCustomInstance`.
|
541
|
+
#
|
542
|
+
# If the list of resource types doesn't include a resource that you're
|
543
|
+
# updating, the stack update fails. By default, AWS CloudFormation
|
544
|
+
# grants permissions to all resource types. AWS Identity and Access
|
545
|
+
# Management (IAM) uses this parameter for AWS CloudFormation-specific
|
546
|
+
# condition keys in IAM policies. For more information, see [Controlling
|
547
|
+
# Access with AWS Identity and Access Management][1].
|
548
|
+
#
|
549
|
+
#
|
550
|
+
#
|
551
|
+
# [1]: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html
|
552
|
+
# @option options [String] :role_arn
|
553
|
+
# The Amazon Resource Name (ARN) of an AWS Identity and Access
|
554
|
+
# Management (IAM) role that AWS CloudFormation assumes to update the
|
555
|
+
# stack. AWS CloudFormation uses the role's credentials to make calls
|
556
|
+
# on your behalf. AWS CloudFormation always uses this role for all
|
557
|
+
# future operations on the stack. As long as users have permission to
|
558
|
+
# operate on the stack, AWS CloudFormation uses this role even if the
|
559
|
+
# users don't have permission to pass it. Ensure that the role grants
|
560
|
+
# least privilege.
|
561
|
+
#
|
562
|
+
# If you don't specify a value, AWS CloudFormation uses the role that
|
563
|
+
# was previously associated with the stack. If no role is available, AWS
|
564
|
+
# CloudFormation uses a temporary session that is generated from your
|
565
|
+
# user credentials.
|
566
|
+
# @option options [String] :stack_policy_body
|
567
|
+
# Structure containing a new stack policy body. You can specify either
|
568
|
+
# the `StackPolicyBody` or the `StackPolicyURL` parameter, but not both.
|
569
|
+
#
|
570
|
+
# You might update the stack policy, for example, in order to protect a
|
571
|
+
# new resource that you created during a stack update. If you do not
|
572
|
+
# specify a stack policy, the current policy that is associated with the
|
573
|
+
# stack is unchanged.
|
574
|
+
# @option options [String] :stack_policy_url
|
575
|
+
# Location of a file containing the updated stack policy. The URL must
|
576
|
+
# point to a policy (max size: 16KB) located in an S3 bucket in the same
|
577
|
+
# region as the stack. You can specify either the `StackPolicyBody` or
|
578
|
+
# the `StackPolicyURL` parameter, but not both.
|
579
|
+
#
|
580
|
+
# You might update the stack policy, for example, in order to protect a
|
581
|
+
# new resource that you created during a stack update. If you do not
|
582
|
+
# specify a stack policy, the current policy that is associated with the
|
583
|
+
# stack is unchanged.
|
584
|
+
# @option options [Array<String>] :notification_arns
|
585
|
+
# Amazon Simple Notification Service topic Amazon Resource Names (ARNs)
|
586
|
+
# that AWS CloudFormation associates with the stack. Specify an empty
|
587
|
+
# list to remove all notification topics.
|
588
|
+
# @option options [Array<Types::Tag>] :tags
|
589
|
+
# Key-value pairs to associate with this stack. AWS CloudFormation also
|
590
|
+
# propagates these tags to supported resources in the stack. You can
|
591
|
+
# specify a maximum number of 10 tags.
|
592
|
+
#
|
593
|
+
# If you don't specify this parameter, AWS CloudFormation doesn't
|
594
|
+
# modify the stack's tags. If you specify an empty value, AWS
|
595
|
+
# CloudFormation removes all associated tags.
|
596
|
+
# @return [Types::UpdateStackOutput]
|
597
|
+
def update(options = {})
|
598
|
+
options = options.merge(stack_name: @name)
|
599
|
+
resp = @client.update_stack(options)
|
600
|
+
resp.data
|
601
|
+
end
|
602
|
+
|
603
|
+
# @!group Associations
|
604
|
+
|
605
|
+
# @example Request syntax with placeholder values
|
606
|
+
#
|
607
|
+
# events = stack.events()
|
608
|
+
# @param [Hash] options ({})
|
609
|
+
# @return [Event::Collection]
|
610
|
+
def events(options = {})
|
611
|
+
batches = Enumerator.new do |y|
|
612
|
+
options = options.merge(stack_name: @name)
|
613
|
+
resp = @client.describe_stack_events(options)
|
614
|
+
resp.each_page do |page|
|
615
|
+
batch = []
|
616
|
+
page.data.stack_events.each do |s|
|
617
|
+
batch << Event.new(
|
618
|
+
id: s.event_id,
|
619
|
+
data: s,
|
620
|
+
client: @client
|
621
|
+
)
|
622
|
+
end
|
623
|
+
y.yield(batch)
|
624
|
+
end
|
625
|
+
end
|
626
|
+
Event::Collection.new(batches)
|
627
|
+
end
|
628
|
+
|
629
|
+
# @param [String] logical_id
|
630
|
+
# @return [StackResource]
|
631
|
+
def resource(logical_id)
|
632
|
+
StackResource.new(
|
633
|
+
stack_name: @name,
|
634
|
+
logical_id: logical_id,
|
635
|
+
client: @client
|
636
|
+
)
|
637
|
+
end
|
638
|
+
|
639
|
+
# @example Request syntax with placeholder values
|
640
|
+
#
|
641
|
+
# resourcesummaries = stack.resource_summaries()
|
642
|
+
# @param [Hash] options ({})
|
643
|
+
# @return [StackResourceSummary::Collection]
|
644
|
+
def resource_summaries(options = {})
|
645
|
+
batches = Enumerator.new do |y|
|
646
|
+
options = options.merge(stack_name: @name)
|
647
|
+
resp = @client.list_stack_resources(options)
|
648
|
+
resp.each_page do |page|
|
649
|
+
batch = []
|
650
|
+
page.data.stack_resource_summaries.each do |s|
|
651
|
+
batch << StackResourceSummary.new(
|
652
|
+
logical_id: s.logical_resource_id,
|
653
|
+
stack_name: options[:stack_name],
|
654
|
+
data: s,
|
655
|
+
client: @client
|
656
|
+
)
|
657
|
+
end
|
658
|
+
y.yield(batch)
|
659
|
+
end
|
660
|
+
end
|
661
|
+
StackResourceSummary::Collection.new(batches)
|
662
|
+
end
|
663
|
+
|
664
|
+
# @deprecated
|
665
|
+
# @api private
|
666
|
+
def identifiers
|
667
|
+
{ name: @name }
|
668
|
+
end
|
669
|
+
deprecated(:identifiers)
|
670
|
+
|
671
|
+
private
|
672
|
+
|
673
|
+
def extract_name(args, options)
|
674
|
+
value = args[0] || options.delete(:name)
|
675
|
+
case value
|
676
|
+
when String then value
|
677
|
+
when nil then raise ArgumentError, "missing required option :name"
|
678
|
+
else
|
679
|
+
msg = "expected :name to be a String, got #{value.class}"
|
680
|
+
raise ArgumentError, msg
|
681
|
+
end
|
682
|
+
end
|
683
|
+
|
684
|
+
def yield_waiter_and_warn(waiter, &block)
|
685
|
+
if !@waiter_block_warned
|
686
|
+
msg = "pass options to configure the waiter; "
|
687
|
+
msg << "yielding the waiter is deprecated"
|
688
|
+
warn(msg)
|
689
|
+
@waiter_block_warned = true
|
690
|
+
end
|
691
|
+
yield(waiter.waiter)
|
692
|
+
end
|
693
|
+
|
694
|
+
def separate_params_and_options(options)
|
695
|
+
opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
|
696
|
+
waiter_opts = {}
|
697
|
+
waiter_params = {}
|
698
|
+
options.each_pair do |key, value|
|
699
|
+
if opts.include?(key)
|
700
|
+
waiter_opts[key] = value
|
701
|
+
else
|
702
|
+
waiter_params[key] = value
|
703
|
+
end
|
704
|
+
end
|
705
|
+
waiter_opts[:client] ||= @client
|
706
|
+
[waiter_opts, waiter_params]
|
707
|
+
end
|
708
|
+
|
709
|
+
class Collection < Aws::Resources::Collection; end
|
710
|
+
end
|
711
|
+
end
|
712
|
+
end
|