aws-sdk-opsworks 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,468 @@
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 OpsWorks
10
+ class Stack
11
+
12
+ extend Aws::Deprecations
13
+
14
+ # @overload def initialize(id, options = {})
15
+ # @param [String] id
16
+ # @option options [Client] :client
17
+ # @overload def initialize(options = {})
18
+ # @option options [required, String] :id
19
+ # @option options [Client] :client
20
+ def initialize(*args)
21
+ options = Hash === args.last ? args.pop.dup : {}
22
+ @id = extract_id(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 id
31
+ @id
32
+ end
33
+
34
+ # The stack ID.
35
+ # @return [String]
36
+ def stack_id
37
+ data.stack_id
38
+ end
39
+
40
+ # The stack name.
41
+ # @return [String]
42
+ def name
43
+ data.name
44
+ end
45
+
46
+ # The stack's ARN.
47
+ # @return [String]
48
+ def arn
49
+ data.arn
50
+ end
51
+
52
+ # The stack AWS region, such as "ap-northeast-2". For more information
53
+ # about AWS regions, see [Regions and Endpoints][1].
54
+ #
55
+ #
56
+ #
57
+ # [1]: http://docs.aws.amazon.com/general/latest/gr/rande.html
58
+ # @return [String]
59
+ def region
60
+ data.region
61
+ end
62
+
63
+ # The VPC ID; applicable only if the stack is running in a VPC.
64
+ # @return [String]
65
+ def vpc_id
66
+ data.vpc_id
67
+ end
68
+
69
+ # The stack's attributes.
70
+ # @return [Hash<String,String>]
71
+ def attributes
72
+ data.attributes
73
+ end
74
+
75
+ # The stack AWS Identity and Access Management (IAM) role.
76
+ # @return [String]
77
+ def service_role_arn
78
+ data.service_role_arn
79
+ end
80
+
81
+ # The ARN of an IAM profile that is the default profile for all of the
82
+ # stack's EC2 instances. For more information about IAM ARNs, see
83
+ # [Using Identifiers][1].
84
+ #
85
+ #
86
+ #
87
+ # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
88
+ # @return [String]
89
+ def default_instance_profile_arn
90
+ data.default_instance_profile_arn
91
+ end
92
+
93
+ # The stack's default operating system.
94
+ # @return [String]
95
+ def default_os
96
+ data.default_os
97
+ end
98
+
99
+ # The stack host name theme, with spaces replaced by underscores.
100
+ # @return [String]
101
+ def hostname_theme
102
+ data.hostname_theme
103
+ end
104
+
105
+ # The stack's default Availability Zone. For more information, see
106
+ # [Regions and Endpoints][1].
107
+ #
108
+ #
109
+ #
110
+ # [1]: http://docs.aws.amazon.com/general/latest/gr/rande.html
111
+ # @return [String]
112
+ def default_availability_zone
113
+ data.default_availability_zone
114
+ end
115
+
116
+ # The default subnet ID; applicable only if the stack is running in a
117
+ # VPC.
118
+ # @return [String]
119
+ def default_subnet_id
120
+ data.default_subnet_id
121
+ end
122
+
123
+ # A JSON object that contains user-defined attributes to be added to the
124
+ # stack configuration and deployment attributes. You can use custom JSON
125
+ # to override the corresponding default stack configuration attribute
126
+ # values or to pass data to recipes. The string should be in the
127
+ # following format:
128
+ #
129
+ # `"\{"key1": "value1", "key2": "value2",...\}"`
130
+ #
131
+ # For more information on custom JSON, see [Use Custom JSON to Modify
132
+ # the Stack Configuration Attributes][1].
133
+ #
134
+ #
135
+ #
136
+ # [1]: http://docs.aws.amazon.com/opsworks/latest/userguide/workingstacks-json.html
137
+ # @return [String]
138
+ def custom_json
139
+ data.custom_json
140
+ end
141
+
142
+ # The configuration manager.
143
+ # @return [Types::StackConfigurationManager]
144
+ def configuration_manager
145
+ data.configuration_manager
146
+ end
147
+
148
+ # A `ChefConfiguration` object that specifies whether to enable
149
+ # Berkshelf and the Berkshelf version. For more information, see [Create
150
+ # a New Stack][1].
151
+ #
152
+ #
153
+ #
154
+ # [1]: http://docs.aws.amazon.com/opsworks/latest/userguide/workingstacks-creating.html
155
+ # @return [Types::ChefConfiguration]
156
+ def chef_configuration
157
+ data.chef_configuration
158
+ end
159
+
160
+ # Whether the stack uses custom cookbooks.
161
+ # @return [Boolean]
162
+ def use_custom_cookbooks
163
+ data.use_custom_cookbooks
164
+ end
165
+
166
+ # Whether the stack automatically associates the AWS OpsWorks built-in
167
+ # security groups with the stack's layers.
168
+ # @return [Boolean]
169
+ def use_opsworks_security_groups
170
+ data.use_opsworks_security_groups
171
+ end
172
+
173
+ # Contains the information required to retrieve an app or cookbook from
174
+ # a repository. For more information, see [Creating Apps][1] or [Custom
175
+ # Recipes and Cookbooks][2].
176
+ #
177
+ #
178
+ #
179
+ # [1]: http://docs.aws.amazon.com/opsworks/latest/userguide/workingapps-creating.html
180
+ # [2]: http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook.html
181
+ # @return [Types::Source]
182
+ def custom_cookbooks_source
183
+ data.custom_cookbooks_source
184
+ end
185
+
186
+ # A default Amazon EC2 key pair for the stack's instances. You can
187
+ # override this value when you create or update an instance.
188
+ # @return [String]
189
+ def default_ssh_key_name
190
+ data.default_ssh_key_name
191
+ end
192
+
193
+ # The date when the stack was created.
194
+ # @return [String]
195
+ def created_at
196
+ data.created_at
197
+ end
198
+
199
+ # The default root device type. This value is used by default for all
200
+ # instances in the stack, but you can override it when you create an
201
+ # instance. For more information, see [Storage for the Root Device][1].
202
+ #
203
+ #
204
+ #
205
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ComponentsAMIs.html#storage-for-the-root-device
206
+ # @return [String]
207
+ def default_root_device_type
208
+ data.default_root_device_type
209
+ end
210
+
211
+ # The agent version. This parameter is set to `LATEST` for auto-update.
212
+ # or a version number for a fixed agent version.
213
+ # @return [String]
214
+ def agent_version
215
+ data.agent_version
216
+ end
217
+
218
+ # @!endgroup
219
+
220
+ # @return [Client]
221
+ def client
222
+ @client
223
+ end
224
+
225
+ # Loads, or reloads {#data} for the current {Stack}.
226
+ # Returns `self` making it possible to chain methods.
227
+ #
228
+ # stack.reload.data
229
+ #
230
+ # @return [self]
231
+ def load
232
+ resp = @client.describe_stacks(stack_ids: [@id])
233
+ @data = resp.stacks[0]
234
+ self
235
+ end
236
+ alias :reload :load
237
+
238
+ # @return [Types::Stack]
239
+ # Returns the data for this {Stack}. Calls
240
+ # {Client#describe_stacks} if {#data_loaded?} is `false`.
241
+ def data
242
+ load unless @data
243
+ @data
244
+ end
245
+
246
+ # @return [Boolean]
247
+ # Returns `true` if this resource is loaded. Accessing attributes or
248
+ # {#data} on an unloaded resource will trigger a call to {#load}.
249
+ def data_loaded?
250
+ !!@data
251
+ end
252
+
253
+ # @!group Actions
254
+
255
+ # @example Request syntax with placeholder values
256
+ #
257
+ # layer = stack.create_layer({
258
+ # type: "aws-flow-ruby", # required, accepts aws-flow-ruby, ecs-cluster, java-app, lb, web, php-app, rails-app, nodejs-app, memcached, db-master, monitoring-master, custom
259
+ # name: "String", # required
260
+ # shortname: "String", # required
261
+ # attributes: {
262
+ # "EcsClusterArn" => "String",
263
+ # },
264
+ # custom_instance_profile_arn: "String",
265
+ # custom_json: "String",
266
+ # custom_security_group_ids: ["String"],
267
+ # packages: ["String"],
268
+ # volume_configurations: [
269
+ # {
270
+ # mount_point: "String", # required
271
+ # raid_level: 1,
272
+ # number_of_disks: 1, # required
273
+ # size: 1, # required
274
+ # volume_type: "String",
275
+ # iops: 1,
276
+ # },
277
+ # ],
278
+ # enable_auto_healing: false,
279
+ # auto_assign_elastic_ips: false,
280
+ # auto_assign_public_ips: false,
281
+ # custom_recipes: {
282
+ # setup: ["String"],
283
+ # configure: ["String"],
284
+ # deploy: ["String"],
285
+ # undeploy: ["String"],
286
+ # shutdown: ["String"],
287
+ # },
288
+ # install_updates_on_boot: false,
289
+ # use_ebs_optimized_instances: false,
290
+ # lifecycle_event_configuration: {
291
+ # shutdown: {
292
+ # execution_timeout: 1,
293
+ # delay_until_elb_connections_drained: false,
294
+ # },
295
+ # },
296
+ # })
297
+ # @param [Hash] options ({})
298
+ # @option options [required, String] :type
299
+ # The layer type. A stack cannot have more than one built-in layer of
300
+ # the same type. It can have any number of custom layers. Built-in
301
+ # layers are not available in Chef 12 stacks.
302
+ # @option options [required, String] :name
303
+ # The layer name, which is used by the console.
304
+ # @option options [required, String] :shortname
305
+ # For custom layers only, use this parameter to specify the layer's
306
+ # short name, which is used internally by AWS OpsWorks and by Chef
307
+ # recipes. The short name is also used as the name for the directory
308
+ # where your app files are installed. It can have a maximum of 200
309
+ # characters, which are limited to the alphanumeric characters, '-',
310
+ # '\_', and '.'.
311
+ #
312
+ # The built-in layers' short names are defined by AWS OpsWorks. For
313
+ # more information, see the [Layer Reference][1].
314
+ #
315
+ #
316
+ #
317
+ # [1]: http://docs.aws.amazon.com/opsworks/latest/userguide/layers.html
318
+ # @option options [Hash<String,String>] :attributes
319
+ # One or more user-defined key-value pairs to be added to the stack
320
+ # attributes.
321
+ #
322
+ # To create a cluster layer, set the `EcsClusterArn` attribute to the
323
+ # cluster's ARN.
324
+ # @option options [String] :custom_instance_profile_arn
325
+ # The ARN of an IAM profile to be used for the layer's EC2 instances.
326
+ # For more information about IAM ARNs, see [Using Identifiers][1].
327
+ #
328
+ #
329
+ #
330
+ # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
331
+ # @option options [String] :custom_json
332
+ # A JSON-formatted string containing custom stack configuration and
333
+ # deployment attributes to be installed on the layer's instances. For
334
+ # more information, see [ Using Custom JSON][1]. This feature is
335
+ # supported as of version 1.7.42 of the AWS CLI.
336
+ #
337
+ #
338
+ #
339
+ # [1]: http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-json-override.html
340
+ # @option options [Array<String>] :custom_security_group_ids
341
+ # An array containing the layer custom security group IDs.
342
+ # @option options [Array<String>] :packages
343
+ # An array of `Package` objects that describes the layer packages.
344
+ # @option options [Array<Types::VolumeConfiguration>] :volume_configurations
345
+ # A `VolumeConfigurations` object that describes the layer's Amazon EBS
346
+ # volumes.
347
+ # @option options [Boolean] :enable_auto_healing
348
+ # Whether to disable auto healing for the layer.
349
+ # @option options [Boolean] :auto_assign_elastic_ips
350
+ # Whether to automatically assign an [Elastic IP address][1] to the
351
+ # layer's instances. For more information, see [How to Edit a
352
+ # Layer][2].
353
+ #
354
+ #
355
+ #
356
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html
357
+ # [2]: http://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-edit.html
358
+ # @option options [Boolean] :auto_assign_public_ips
359
+ # For stacks that are running in a VPC, whether to automatically assign
360
+ # a public IP address to the layer's instances. For more information,
361
+ # see [How to Edit a Layer][1].
362
+ #
363
+ #
364
+ #
365
+ # [1]: http://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-edit.html
366
+ # @option options [Types::Recipes] :custom_recipes
367
+ # A `LayerCustomRecipes` object that specifies the layer custom recipes.
368
+ # @option options [Boolean] :install_updates_on_boot
369
+ # Whether to install operating system and package updates when the
370
+ # instance boots. The default value is `true`. To control when updates
371
+ # are installed, set this value to `false`. You must then update your
372
+ # instances manually by using CreateDeployment to run the
373
+ # `update_dependencies` stack command or by manually running `yum`
374
+ # (Amazon Linux) or `apt-get` (Ubuntu) on the instances.
375
+ #
376
+ # <note markdown="1"> To ensure that your instances have the latest security updates, we
377
+ # strongly recommend using the default value of `true`.
378
+ #
379
+ # </note>
380
+ # @option options [Boolean] :use_ebs_optimized_instances
381
+ # Whether to use Amazon EBS-optimized instances.
382
+ # @option options [Types::LifecycleEventConfiguration] :lifecycle_event_configuration
383
+ # A `LifeCycleEventConfiguration` object that you can use to configure
384
+ # the Shutdown event to specify an execution timeout and enable or
385
+ # disable Elastic Load Balancer connection draining.
386
+ # @return [Layer]
387
+ def create_layer(options = {})
388
+ options = options.merge(stack_id: @id)
389
+ resp = @client.create_layer(options)
390
+ Layer.new(
391
+ id: resp.data.layer_id,
392
+ client: @client
393
+ )
394
+ end
395
+
396
+ # @example Request syntax with placeholder values
397
+ #
398
+ # stack.delete()
399
+ # @param [Hash] options ({})
400
+ # @return [EmptyStructure]
401
+ def delete(options = {})
402
+ options = options.merge(stack_id: @id)
403
+ resp = @client.delete_stack(options)
404
+ resp.data
405
+ end
406
+
407
+ # @!group Associations
408
+
409
+ # @example Request syntax with placeholder values
410
+ #
411
+ # layers = stack.layers({
412
+ # layer_ids: ["String"],
413
+ # })
414
+ # @param [Hash] options ({})
415
+ # @option options [Array<String>] :layer_ids
416
+ # An array of layer IDs that specify the layers to be described. If you
417
+ # omit this parameter, `DescribeLayers` returns a description of every
418
+ # layer in the specified stack.
419
+ # @return [Layer::Collection]
420
+ def layers(options = {})
421
+ batches = Enumerator.new do |y|
422
+ batch = []
423
+ options = options.merge(stack_id: @id)
424
+ resp = @client.describe_layers(options)
425
+ resp.data.layers.each do |l|
426
+ batch << Layer.new(
427
+ id: l.layer_id,
428
+ data: l,
429
+ client: @client
430
+ )
431
+ end
432
+ y.yield(batch)
433
+ end
434
+ Layer::Collection.new(batches)
435
+ end
436
+
437
+ # @return [StackSummary]
438
+ def summary
439
+ StackSummary.new(
440
+ stack_id: @id,
441
+ client: @client
442
+ )
443
+ end
444
+
445
+ # @deprecated
446
+ # @api private
447
+ def identifiers
448
+ { id: @id }
449
+ end
450
+ deprecated(:identifiers)
451
+
452
+ private
453
+
454
+ def extract_id(args, options)
455
+ value = args[0] || options.delete(:id)
456
+ case value
457
+ when String then value
458
+ when nil then raise ArgumentError, "missing required option :id"
459
+ else
460
+ msg = "expected :id to be a String, got #{value.class}"
461
+ raise ArgumentError, msg
462
+ end
463
+ end
464
+
465
+ class Collection < Aws::Resources::Collection; end
466
+ end
467
+ end
468
+ end