aws-sdk-autoscaling 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.
@@ -0,0 +1,199 @@
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 AutoScaling
10
+ class NotificationConfiguration
11
+
12
+ extend Aws::Deprecations
13
+
14
+ # @overload def initialize(group_name, type, topic_arn, options = {})
15
+ # @param [String] group_name
16
+ # @param [String] type
17
+ # @param [String] topic_arn
18
+ # @option options [Client] :client
19
+ # @overload def initialize(options = {})
20
+ # @option options [required, String] :group_name
21
+ # @option options [required, String] :type
22
+ # @option options [required, String] :topic_arn
23
+ # @option options [Client] :client
24
+ def initialize(*args)
25
+ options = Hash === args.last ? args.pop.dup : {}
26
+ @group_name = extract_group_name(args, options)
27
+ @type = extract_type(args, options)
28
+ @topic_arn = extract_topic_arn(args, options)
29
+ @data = options.delete(:data)
30
+ @client = options.delete(:client) || Client.new(options)
31
+ end
32
+
33
+ # @!group Read-Only Attributes
34
+
35
+ # @return [String]
36
+ def group_name
37
+ @group_name
38
+ end
39
+ alias :auto_scaling_group_name :group_name
40
+
41
+ # @return [String]
42
+ def type
43
+ @type
44
+ end
45
+ alias :notification_type :type
46
+
47
+ # @return [String]
48
+ def topic_arn
49
+ @topic_arn
50
+ end
51
+
52
+ # @!endgroup
53
+
54
+ # @return [Client]
55
+ def client
56
+ @client
57
+ end
58
+
59
+ # @raise [Errors::ResourceNotLoadable]
60
+ # @api private
61
+ def load
62
+ msg = "#load is not implemented, data only available via enumeration"
63
+ raise Errors::ResourceNotLoadable, msg
64
+ end
65
+ alias :reload :load
66
+
67
+ # @raise [Errors::ResourceNotLoadableError] Raises when {#data_loaded?} is `false`.
68
+ # @return [Types::NotificationConfiguration]
69
+ # Returns the data for this {NotificationConfiguration}.
70
+ def data
71
+ load unless @data
72
+ @data
73
+ end
74
+
75
+ # @return [Boolean]
76
+ # Returns `true` if this resource is loaded. Accessing attributes or
77
+ # {#data} on an unloaded resource will trigger a call to {#load}.
78
+ def data_loaded?
79
+ !!@data
80
+ end
81
+
82
+ # @!group Actions
83
+
84
+ # @example Request syntax with placeholder values
85
+ #
86
+ # notification_configuration.delete()
87
+ # @param [Hash] options ({})
88
+ # @return [EmptyStructure]
89
+ def delete(options = {})
90
+ options = options.merge(
91
+ auto_scaling_group_name: @group_name,
92
+ topic_arn: @topic_arn
93
+ )
94
+ resp = @client.delete_notification_configuration(options)
95
+ resp.data
96
+ end
97
+
98
+ # @example Request syntax with placeholder values
99
+ #
100
+ # notification_configuration.put()
101
+ # @param [Hash] options ({})
102
+ # @return [EmptyStructure]
103
+ def put(options = {})
104
+ options = Aws::Util.deep_merge(options,
105
+ auto_scaling_group_name: @name,
106
+ topic_arn: @topic_arn,
107
+ notification_types: [@notification_type]
108
+ )
109
+ resp = @client.put_notification_configuration(options)
110
+ resp.data
111
+ end
112
+
113
+ # @!group Associations
114
+
115
+ # @return [AutoScalingGroup]
116
+ def group
117
+ AutoScalingGroup.new(
118
+ name: @group_name,
119
+ client: @client
120
+ )
121
+ end
122
+
123
+ # @deprecated
124
+ # @api private
125
+ def identifiers
126
+ {
127
+ group_name: @group_name,
128
+ type: @type,
129
+ topic_arn: @topic_arn
130
+ }
131
+ end
132
+ deprecated(:identifiers)
133
+
134
+ private
135
+
136
+ def extract_group_name(args, options)
137
+ value = args[0] || options.delete(:group_name)
138
+ case value
139
+ when String then value
140
+ when nil then raise ArgumentError, "missing required option :group_name"
141
+ else
142
+ msg = "expected :group_name to be a String, got #{value.class}"
143
+ raise ArgumentError, msg
144
+ end
145
+ end
146
+
147
+ def extract_type(args, options)
148
+ value = args[1] || options.delete(:type)
149
+ case value
150
+ when String then value
151
+ when nil then raise ArgumentError, "missing required option :type"
152
+ else
153
+ msg = "expected :type to be a String, got #{value.class}"
154
+ raise ArgumentError, msg
155
+ end
156
+ end
157
+
158
+ def extract_topic_arn(args, options)
159
+ value = args[2] || options.delete(:topic_arn)
160
+ case value
161
+ when String then value
162
+ when nil then raise ArgumentError, "missing required option :topic_arn"
163
+ else
164
+ msg = "expected :topic_arn to be a String, got #{value.class}"
165
+ raise ArgumentError, msg
166
+ end
167
+ end
168
+
169
+ class Collection < Aws::Resources::Collection
170
+
171
+ # @!group Batch Actions
172
+
173
+ # @example Request syntax with placeholder values
174
+ #
175
+ # notification_configuration.batch_put()
176
+ # @param options ({})
177
+ # @return [void]
178
+ def batch_put(options = {})
179
+ batch_enum.each do |batch|
180
+ params = Aws::Util.copy_hash(options)
181
+ params[:auto_scaling_group_name] = batch[0].name
182
+ params[:topic_arn] = batch[0].topic_arn
183
+ params[:notification_types] ||= []
184
+ batch.each do |item|
185
+ params[:notification_types] << {
186
+ notification_type: item.notification_type
187
+ }
188
+ end
189
+ batch[0].client.put_notification_configuration(params)
190
+ end
191
+ nil
192
+ end
193
+
194
+ # @!endgroup
195
+
196
+ end
197
+ end
198
+ end
199
+ end
@@ -0,0 +1,695 @@
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 AutoScaling
10
+ class Resource
11
+
12
+ # @param options ({})
13
+ # @option options [Client] :client
14
+ def initialize(options = {})
15
+ @client = options[:client] || Client.new(options)
16
+ end
17
+
18
+ # @return [Client]
19
+ def client
20
+ @client
21
+ end
22
+
23
+ # @!group Actions
24
+
25
+ # @example Request syntax with placeholder values
26
+ #
27
+ # autoscalinggroup = auto_scaling.create_group({
28
+ # auto_scaling_group_name: "XmlStringMaxLen255", # required
29
+ # launch_configuration_name: "ResourceName",
30
+ # instance_id: "XmlStringMaxLen19",
31
+ # min_size: 1, # required
32
+ # max_size: 1, # required
33
+ # desired_capacity: 1,
34
+ # default_cooldown: 1,
35
+ # availability_zones: ["XmlStringMaxLen255"],
36
+ # load_balancer_names: ["XmlStringMaxLen255"],
37
+ # target_group_arns: ["XmlStringMaxLen511"],
38
+ # health_check_type: "XmlStringMaxLen32",
39
+ # health_check_grace_period: 1,
40
+ # placement_group: "XmlStringMaxLen255",
41
+ # vpc_zone_identifier: "XmlStringMaxLen2047",
42
+ # termination_policies: ["XmlStringMaxLen1600"],
43
+ # new_instances_protected_from_scale_in: false,
44
+ # tags: [
45
+ # {
46
+ # resource_id: "XmlString",
47
+ # resource_type: "XmlString",
48
+ # key: "TagKey", # required
49
+ # value: "TagValue",
50
+ # propagate_at_launch: false,
51
+ # },
52
+ # ],
53
+ # })
54
+ # @param [Hash] options ({})
55
+ # @option options [required, String] :auto_scaling_group_name
56
+ # The name of the group. This name must be unique within the scope of
57
+ # your AWS account.
58
+ # @option options [String] :launch_configuration_name
59
+ # The name of the launch configuration. Alternatively, specify an EC2
60
+ # instance instead of a launch configuration.
61
+ # @option options [String] :instance_id
62
+ # The ID of the instance used to create a launch configuration for the
63
+ # group. Alternatively, specify a launch configuration instead of an EC2
64
+ # instance.
65
+ #
66
+ # When you specify an ID of an instance, Auto Scaling creates a new
67
+ # launch configuration and associates it with the group. This launch
68
+ # configuration derives its attributes from the specified instance, with
69
+ # the exception of the block device mapping.
70
+ #
71
+ # For more information, see [Create an Auto Scaling Group Using an EC2
72
+ # Instance][1] in the *Auto Scaling User Guide*.
73
+ #
74
+ #
75
+ #
76
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/create-asg-from-instance.html
77
+ # @option options [required, Integer] :min_size
78
+ # The minimum size of the group.
79
+ # @option options [required, Integer] :max_size
80
+ # The maximum size of the group.
81
+ # @option options [Integer] :desired_capacity
82
+ # The number of EC2 instances that should be running in the group. This
83
+ # number must be greater than or equal to the minimum size of the group
84
+ # and less than or equal to the maximum size of the group.
85
+ # @option options [Integer] :default_cooldown
86
+ # The amount of time, in seconds, after a scaling activity completes
87
+ # before another scaling activity can start. The default is 300.
88
+ #
89
+ # For more information, see [Auto Scaling Cooldowns][1] in the *Auto
90
+ # Scaling User Guide*.
91
+ #
92
+ #
93
+ #
94
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/Cooldown.html
95
+ # @option options [Array<String>] :availability_zones
96
+ # One or more Availability Zones for the group. This parameter is
97
+ # optional if you specify one or more subnets.
98
+ # @option options [Array<String>] :load_balancer_names
99
+ # One or more Classic load balancers. To specify an Application load
100
+ # balancer, use `TargetGroupARNs` instead.
101
+ #
102
+ # For more information, see [Using a Load Balancer With an Auto Scaling
103
+ # Group][1] in the *Auto Scaling User Guide*.
104
+ #
105
+ #
106
+ #
107
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/create-asg-from-instance.html
108
+ # @option options [Array<String>] :target_group_arns
109
+ # The Amazon Resource Names (ARN) of the target groups.
110
+ # @option options [String] :health_check_type
111
+ # The service to use for the health checks. The valid values are `EC2`
112
+ # and `ELB`.
113
+ #
114
+ # By default, health checks use Amazon EC2 instance status checks to
115
+ # determine the health of an instance. For more information, see [Health
116
+ # Checks][1] in the *Auto Scaling User Guide*.
117
+ #
118
+ #
119
+ #
120
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/healthcheck.html
121
+ # @option options [Integer] :health_check_grace_period
122
+ # The amount of time, in seconds, that Auto Scaling waits before
123
+ # checking the health status of an EC2 instance that has come into
124
+ # service. During this time, any health check failures for the instance
125
+ # are ignored. The default is 0.
126
+ #
127
+ # This parameter is required if you are adding an `ELB` health check.
128
+ #
129
+ # For more information, see [Health Checks][1] in the *Auto Scaling User
130
+ # Guide*.
131
+ #
132
+ #
133
+ #
134
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/healthcheck.html
135
+ # @option options [String] :placement_group
136
+ # The name of the placement group into which you'll launch your
137
+ # instances, if any. For more information, see [Placement Groups][1] in
138
+ # the *Amazon Elastic Compute Cloud User Guide*.
139
+ #
140
+ #
141
+ #
142
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html
143
+ # @option options [String] :vpc_zone_identifier
144
+ # A comma-separated list of subnet identifiers for your virtual private
145
+ # cloud (VPC).
146
+ #
147
+ # If you specify subnets and Availability Zones with this call, ensure
148
+ # that the subnets' Availability Zones match the Availability Zones
149
+ # specified.
150
+ #
151
+ # For more information, see [Launching Auto Scaling Instances in a
152
+ # VPC][1] in the *Auto Scaling User Guide*.
153
+ #
154
+ #
155
+ #
156
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/asg-in-vpc.html
157
+ # @option options [Array<String>] :termination_policies
158
+ # One or more termination policies used to select the instance to
159
+ # terminate. These policies are executed in the order that they are
160
+ # listed.
161
+ #
162
+ # For more information, see [Controlling Which Instances Auto Scaling
163
+ # Terminates During Scale In][1] in the *Auto Scaling User Guide*.
164
+ #
165
+ #
166
+ #
167
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/as-instance-termination.html
168
+ # @option options [Boolean] :new_instances_protected_from_scale_in
169
+ # Indicates whether newly launched instances are protected from
170
+ # termination by Auto Scaling when scaling in.
171
+ # @option options [Array<Types::Tag>] :tags
172
+ # One or more tags.
173
+ #
174
+ # For more information, see [Tagging Auto Scaling Groups and
175
+ # Instances][1] in the *Auto Scaling User Guide*.
176
+ #
177
+ #
178
+ #
179
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/autoscaling-tagging.html
180
+ # @return [AutoScalingGroup]
181
+ def create_group(options = {})
182
+ resp = @client.create_auto_scaling_group(options)
183
+ AutoScalingGroup.new(
184
+ name: options[:auto_scaling_group_name],
185
+ client: @client
186
+ )
187
+ end
188
+
189
+ # @example Request syntax with placeholder values
190
+ #
191
+ # launchconfiguration = auto_scaling.create_launch_configuration({
192
+ # launch_configuration_name: "XmlStringMaxLen255", # required
193
+ # image_id: "XmlStringMaxLen255",
194
+ # key_name: "XmlStringMaxLen255",
195
+ # security_groups: ["XmlString"],
196
+ # classic_link_vpc_id: "XmlStringMaxLen255",
197
+ # classic_link_vpc_security_groups: ["XmlStringMaxLen255"],
198
+ # user_data: "XmlStringUserData",
199
+ # instance_id: "XmlStringMaxLen19",
200
+ # instance_type: "XmlStringMaxLen255",
201
+ # kernel_id: "XmlStringMaxLen255",
202
+ # ramdisk_id: "XmlStringMaxLen255",
203
+ # block_device_mappings: [
204
+ # {
205
+ # virtual_name: "XmlStringMaxLen255",
206
+ # device_name: "XmlStringMaxLen255", # required
207
+ # ebs: {
208
+ # snapshot_id: "XmlStringMaxLen255",
209
+ # volume_size: 1,
210
+ # volume_type: "BlockDeviceEbsVolumeType",
211
+ # delete_on_termination: false,
212
+ # iops: 1,
213
+ # encrypted: false,
214
+ # },
215
+ # no_device: false,
216
+ # },
217
+ # ],
218
+ # instance_monitoring: {
219
+ # enabled: false,
220
+ # },
221
+ # spot_price: "SpotPrice",
222
+ # iam_instance_profile: "XmlStringMaxLen1600",
223
+ # ebs_optimized: false,
224
+ # associate_public_ip_address: false,
225
+ # placement_tenancy: "XmlStringMaxLen64",
226
+ # })
227
+ # @param [Hash] options ({})
228
+ # @option options [required, String] :launch_configuration_name
229
+ # The name of the launch configuration. This name must be unique within
230
+ # the scope of your AWS account.
231
+ # @option options [String] :image_id
232
+ # The ID of the Amazon Machine Image (AMI) to use to launch your EC2
233
+ # instances. For more information, see [Finding an AMI][1] in the
234
+ # *Amazon Elastic Compute Cloud User Guide*.
235
+ #
236
+ #
237
+ #
238
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html
239
+ # @option options [String] :key_name
240
+ # The name of the key pair. For more information, see [Amazon EC2 Key
241
+ # Pairs][1] in the *Amazon Elastic Compute Cloud User Guide*.
242
+ #
243
+ #
244
+ #
245
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html
246
+ # @option options [Array<String>] :security_groups
247
+ # One or more security groups with which to associate the instances.
248
+ #
249
+ # If your instances are launched in EC2-Classic, you can either specify
250
+ # security group names or the security group IDs. For more information
251
+ # about security groups for EC2-Classic, see [Amazon EC2 Security
252
+ # Groups][1] in the *Amazon Elastic Compute Cloud User Guide*.
253
+ #
254
+ # If your instances are launched into a VPC, specify security group IDs.
255
+ # For more information, see [Security Groups for Your VPC][2] in the
256
+ # *Amazon Virtual Private Cloud User Guide*.
257
+ #
258
+ #
259
+ #
260
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html
261
+ # [2]: http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html
262
+ # @option options [String] :classic_link_vpc_id
263
+ # The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances
264
+ # to. This parameter is supported only if you are launching EC2-Classic
265
+ # instances. For more information, see [ClassicLink][1] in the *Amazon
266
+ # Elastic Compute Cloud User Guide*.
267
+ #
268
+ #
269
+ #
270
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html
271
+ # @option options [Array<String>] :classic_link_vpc_security_groups
272
+ # The IDs of one or more security groups for the specified
273
+ # ClassicLink-enabled VPC. This parameter is required if you specify a
274
+ # ClassicLink-enabled VPC, and is not supported otherwise. For more
275
+ # information, see [ClassicLink][1] in the *Amazon Elastic Compute Cloud
276
+ # User Guide*.
277
+ #
278
+ #
279
+ #
280
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html
281
+ # @option options [String] :user_data
282
+ # The user data to make available to the launched EC2 instances. For
283
+ # more information, see [Instance Metadata and User Data][1] in the
284
+ # *Amazon Elastic Compute Cloud User Guide*.
285
+ #
286
+ #
287
+ #
288
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
289
+ # @option options [String] :instance_id
290
+ # The ID of the instance to use to create the launch configuration.
291
+ #
292
+ # The new launch configuration derives attributes from the instance,
293
+ # with the exception of the block device mapping.
294
+ #
295
+ # To create a launch configuration with a block device mapping or
296
+ # override any other instance attributes, specify them as part of the
297
+ # same request.
298
+ #
299
+ # For more information, see [Create a Launch Configuration Using an EC2
300
+ # Instance][1] in the *Auto Scaling User Guide*.
301
+ #
302
+ #
303
+ #
304
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/create-lc-with-instanceID.html
305
+ # @option options [String] :instance_type
306
+ # The instance type of the EC2 instance. For information about available
307
+ # instance types, see [ Available Instance Types][1] in the *Amazon
308
+ # Elastic Compute Cloud User Guide.*
309
+ #
310
+ #
311
+ #
312
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#AvailableInstanceTypes
313
+ # @option options [String] :kernel_id
314
+ # The ID of the kernel associated with the AMI.
315
+ # @option options [String] :ramdisk_id
316
+ # The ID of the RAM disk associated with the AMI.
317
+ # @option options [Array<Types::BlockDeviceMapping>] :block_device_mappings
318
+ # One or more mappings that specify how block devices are exposed to the
319
+ # instance. For more information, see [Block Device Mapping][1] in the
320
+ # *Amazon Elastic Compute Cloud User Guide*.
321
+ #
322
+ #
323
+ #
324
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html
325
+ # @option options [Types::InstanceMonitoring] :instance_monitoring
326
+ # Enables detailed monitoring (`true`) or basic monitoring (`false`) for
327
+ # the Auto Scaling instances.
328
+ # @option options [String] :spot_price
329
+ # The maximum hourly price to be paid for any Spot Instance launched to
330
+ # fulfill the request. Spot Instances are launched when the price you
331
+ # specify exceeds the current Spot market price. For more information,
332
+ # see [Launching Spot Instances in Your Auto Scaling Group][1] in the
333
+ # *Auto Scaling User Guide*.
334
+ #
335
+ #
336
+ #
337
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/US-SpotInstances.html
338
+ # @option options [String] :iam_instance_profile
339
+ # The name or the Amazon Resource Name (ARN) of the instance profile
340
+ # associated with the IAM role for the instance.
341
+ #
342
+ # EC2 instances launched with an IAM role will automatically have AWS
343
+ # security credentials available. You can use IAM roles with Auto
344
+ # Scaling to automatically enable applications running on your EC2
345
+ # instances to securely access other AWS resources. For more
346
+ # information, see [Launch Auto Scaling Instances with an IAM Role][1]
347
+ # in the *Auto Scaling User Guide*.
348
+ #
349
+ #
350
+ #
351
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/us-iam-role.html
352
+ # @option options [Boolean] :ebs_optimized
353
+ # Indicates whether the instance is optimized for Amazon EBS I/O. By
354
+ # default, the instance is not optimized for EBS I/O. The optimization
355
+ # provides dedicated throughput to Amazon EBS and an optimized
356
+ # configuration stack to provide optimal I/O performance. This
357
+ # optimization is not available with all instance types. Additional
358
+ # usage charges apply. For more information, see [Amazon EBS-Optimized
359
+ # Instances][1] in the *Amazon Elastic Compute Cloud User Guide*.
360
+ #
361
+ #
362
+ #
363
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html
364
+ # @option options [Boolean] :associate_public_ip_address
365
+ # Used for groups that launch instances into a virtual private cloud
366
+ # (VPC). Specifies whether to assign a public IP address to each
367
+ # instance. For more information, see [Launching Auto Scaling Instances
368
+ # in a VPC][1] in the *Auto Scaling User Guide*.
369
+ #
370
+ # If you specify this parameter, be sure to specify at least one subnet
371
+ # when you create your group.
372
+ #
373
+ # Default: If the instance is launched into a default subnet, the
374
+ # default is `true`. If the instance is launched into a nondefault
375
+ # subnet, the default is `false`. For more information, see [Supported
376
+ # Platforms][2] in the *Amazon Elastic Compute Cloud User Guide*.
377
+ #
378
+ #
379
+ #
380
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/asg-in-vpc.html
381
+ # [2]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-supported-platforms.html
382
+ # @option options [String] :placement_tenancy
383
+ # The tenancy of the instance. An instance with a tenancy of `dedicated`
384
+ # runs on single-tenant hardware and can only be launched into a VPC.
385
+ #
386
+ # You must set the value of this parameter to `dedicated` if want to
387
+ # launch Dedicated Instances into a shared tenancy VPC (VPC with
388
+ # instance placement tenancy attribute set to `default`).
389
+ #
390
+ # If you specify this parameter, be sure to specify at least one subnet
391
+ # when you create your group.
392
+ #
393
+ # For more information, see [Launching Auto Scaling Instances in a
394
+ # VPC][1] in the *Auto Scaling User Guide*.
395
+ #
396
+ # Valid values: `default` \| `dedicated`
397
+ #
398
+ #
399
+ #
400
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/asg-in-vpc.html
401
+ # @return [LaunchConfiguration]
402
+ def create_launch_configuration(options = {})
403
+ resp = @client.create_launch_configuration(options)
404
+ LaunchConfiguration.new(
405
+ name: options[:launch_configuration_name],
406
+ client: @client
407
+ )
408
+ end
409
+
410
+ # @!group Associations
411
+
412
+ # @example Request syntax with placeholder values
413
+ #
414
+ # activities = auto_scaling.activities({
415
+ # activity_ids: ["XmlString"],
416
+ # auto_scaling_group_name: "ResourceName",
417
+ # })
418
+ # @param [Hash] options ({})
419
+ # @option options [Array<String>] :activity_ids
420
+ # The activity IDs of the desired scaling activities. If you omit this
421
+ # parameter, all activities for the past six weeks are described. If you
422
+ # specify an Auto Scaling group, the results are limited to that group.
423
+ # The list of requested activities cannot contain more than 50 items. If
424
+ # unknown activities are requested, they are ignored with no error.
425
+ # @option options [String] :auto_scaling_group_name
426
+ # The name of the group.
427
+ # @return [Activity::Collection]
428
+ def activities(options = {})
429
+ batches = Enumerator.new do |y|
430
+ resp = @client.describe_scaling_activities(options)
431
+ resp.each_page do |page|
432
+ batch = []
433
+ page.data.activities.each do |a|
434
+ batch << Activity.new(
435
+ id: a.activity_id,
436
+ data: a,
437
+ client: @client
438
+ )
439
+ end
440
+ y.yield(batch)
441
+ end
442
+ end
443
+ Activity::Collection.new(batches)
444
+ end
445
+
446
+ # @param [String] id
447
+ # @return [Activity]
448
+ def activity(id)
449
+ Activity.new(
450
+ id: id,
451
+ client: @client
452
+ )
453
+ end
454
+
455
+ # @param [String] name
456
+ # @return [AutoScalingGroup]
457
+ def group(name)
458
+ AutoScalingGroup.new(
459
+ name: name,
460
+ client: @client
461
+ )
462
+ end
463
+
464
+ # @example Request syntax with placeholder values
465
+ #
466
+ # groups = auto_scaling.groups({
467
+ # auto_scaling_group_names: ["ResourceName"],
468
+ # })
469
+ # @param [Hash] options ({})
470
+ # @option options [Array<String>] :auto_scaling_group_names
471
+ # The group names. If you omit this parameter, all Auto Scaling groups
472
+ # are described.
473
+ # @return [AutoScalingGroup::Collection]
474
+ def groups(options = {})
475
+ batches = Enumerator.new do |y|
476
+ resp = @client.describe_auto_scaling_groups(options)
477
+ resp.each_page do |page|
478
+ batch = []
479
+ page.data.auto_scaling_groups.each do |a|
480
+ batch << AutoScalingGroup.new(
481
+ name: a.auto_scaling_group_name,
482
+ data: a,
483
+ client: @client
484
+ )
485
+ end
486
+ y.yield(batch)
487
+ end
488
+ end
489
+ AutoScalingGroup::Collection.new(batches)
490
+ end
491
+
492
+ # @example Request syntax with placeholder values
493
+ #
494
+ # instances = auto_scaling.instances({
495
+ # instance_ids: ["XmlStringMaxLen19"],
496
+ # })
497
+ # @param [Hash] options ({})
498
+ # @option options [Array<String>] :instance_ids
499
+ # The instances to describe; up to 50 instance IDs. If you omit this
500
+ # parameter, all Auto Scaling instances are described. If you specify an
501
+ # ID that does not exist, it is ignored with no error.
502
+ # @return [Instance::Collection]
503
+ def instances(options = {})
504
+ batches = Enumerator.new do |y|
505
+ resp = @client.describe_auto_scaling_instances(options)
506
+ resp.each_page do |page|
507
+ batch = []
508
+ page.data.auto_scaling_instances.each do |a|
509
+ batch << Instance.new(
510
+ group_name: a.auto_scaling_group_name,
511
+ id: a.instance_id,
512
+ data: a,
513
+ client: @client
514
+ )
515
+ end
516
+ y.yield(batch)
517
+ end
518
+ end
519
+ Instance::Collection.new(batches)
520
+ end
521
+
522
+ # @param [String] name
523
+ # @return [LaunchConfiguration]
524
+ def launch_configuration(name)
525
+ LaunchConfiguration.new(
526
+ name: name,
527
+ client: @client
528
+ )
529
+ end
530
+
531
+ # @example Request syntax with placeholder values
532
+ #
533
+ # launchconfigurations = auto_scaling.launch_configurations({
534
+ # launch_configuration_names: ["ResourceName"],
535
+ # })
536
+ # @param [Hash] options ({})
537
+ # @option options [Array<String>] :launch_configuration_names
538
+ # The launch configuration names. If you omit this parameter, all launch
539
+ # configurations are described.
540
+ # @return [LaunchConfiguration::Collection]
541
+ def launch_configurations(options = {})
542
+ batches = Enumerator.new do |y|
543
+ resp = @client.describe_launch_configurations(options)
544
+ resp.each_page do |page|
545
+ batch = []
546
+ page.data.launch_configurations.each do |l|
547
+ batch << LaunchConfiguration.new(
548
+ name: l.launch_configuration_name,
549
+ data: l,
550
+ client: @client
551
+ )
552
+ end
553
+ y.yield(batch)
554
+ end
555
+ end
556
+ LaunchConfiguration::Collection.new(batches)
557
+ end
558
+
559
+ # @example Request syntax with placeholder values
560
+ #
561
+ # policies = auto_scaling.policies({
562
+ # auto_scaling_group_name: "ResourceName",
563
+ # policy_names: ["ResourceName"],
564
+ # policy_types: ["XmlStringMaxLen64"],
565
+ # })
566
+ # @param [Hash] options ({})
567
+ # @option options [String] :auto_scaling_group_name
568
+ # The name of the group.
569
+ # @option options [Array<String>] :policy_names
570
+ # One or more policy names or policy ARNs to be described. If you omit
571
+ # this parameter, all policy names are described. If an group name is
572
+ # provided, the results are limited to that group. This list is limited
573
+ # to 50 items. If you specify an unknown policy name, it is ignored with
574
+ # no error.
575
+ # @option options [Array<String>] :policy_types
576
+ # One or more policy types. Valid values are `SimpleScaling` and
577
+ # `StepScaling`.
578
+ # @return [ScalingPolicy::Collection]
579
+ def policies(options = {})
580
+ batches = Enumerator.new do |y|
581
+ resp = @client.describe_policies(options)
582
+ resp.each_page do |page|
583
+ batch = []
584
+ page.data.scaling_policies.each do |s|
585
+ batch << ScalingPolicy.new(
586
+ name: s.policy_name,
587
+ data: s,
588
+ client: @client
589
+ )
590
+ end
591
+ y.yield(batch)
592
+ end
593
+ end
594
+ ScalingPolicy::Collection.new(batches)
595
+ end
596
+
597
+ # @param [String] name
598
+ # @return [ScalingPolicy]
599
+ def policy(name)
600
+ ScalingPolicy.new(
601
+ name: name,
602
+ client: @client
603
+ )
604
+ end
605
+
606
+ # @param [String] name
607
+ # @return [ScheduledAction]
608
+ def scheduled_action(name)
609
+ ScheduledAction.new(
610
+ name: name,
611
+ client: @client
612
+ )
613
+ end
614
+
615
+ # @example Request syntax with placeholder values
616
+ #
617
+ # scheduledactions = auto_scaling.scheduled_actions({
618
+ # auto_scaling_group_name: "ResourceName",
619
+ # scheduled_action_names: ["ResourceName"],
620
+ # start_time: Time.now,
621
+ # end_time: Time.now,
622
+ # })
623
+ # @param [Hash] options ({})
624
+ # @option options [String] :auto_scaling_group_name
625
+ # The name of the group.
626
+ # @option options [Array<String>] :scheduled_action_names
627
+ # Describes one or more scheduled actions. If you omit this parameter,
628
+ # all scheduled actions are described. If you specify an unknown
629
+ # scheduled action, it is ignored with no error.
630
+ #
631
+ # You can describe up to a maximum of 50 instances with a single call.
632
+ # If there are more items to return, the call returns a token. To get
633
+ # the next set of items, repeat the call with the returned token.
634
+ # @option options [Time,DateTime,Date,Integer,String] :start_time
635
+ # The earliest scheduled start time to return. If scheduled action names
636
+ # are provided, this parameter is ignored.
637
+ # @option options [Time,DateTime,Date,Integer,String] :end_time
638
+ # The latest scheduled start time to return. If scheduled action names
639
+ # are provided, this parameter is ignored.
640
+ # @return [ScheduledAction::Collection]
641
+ def scheduled_actions(options = {})
642
+ batches = Enumerator.new do |y|
643
+ resp = @client.describe_scheduled_actions(options)
644
+ resp.each_page do |page|
645
+ batch = []
646
+ page.data.scheduled_update_group_actions.each do |s|
647
+ batch << ScheduledAction.new(
648
+ name: s.scheduled_action_name,
649
+ data: s,
650
+ client: @client
651
+ )
652
+ end
653
+ y.yield(batch)
654
+ end
655
+ end
656
+ ScheduledAction::Collection.new(batches)
657
+ end
658
+
659
+ # @example Request syntax with placeholder values
660
+ #
661
+ # tags = auto_scaling.tags({
662
+ # filters: [
663
+ # {
664
+ # name: "XmlString",
665
+ # values: ["XmlString"],
666
+ # },
667
+ # ],
668
+ # })
669
+ # @param [Hash] options ({})
670
+ # @option options [Array<Types::Filter>] :filters
671
+ # A filter used to scope the tags to return.
672
+ # @return [Tag::Collection]
673
+ def tags(options = {})
674
+ batches = Enumerator.new do |y|
675
+ resp = @client.describe_tags(options)
676
+ resp.each_page do |page|
677
+ batch = []
678
+ page.data.tags.each do |t|
679
+ batch << Tag.new(
680
+ key: t.key,
681
+ resource_id: t.resource_id,
682
+ resource_type: t.resource_type,
683
+ data: t,
684
+ client: @client
685
+ )
686
+ end
687
+ y.yield(batch)
688
+ end
689
+ end
690
+ Tag::Collection.new(batches)
691
+ end
692
+
693
+ end
694
+ end
695
+ end