aws-sdk-autoscaling 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/aws-sdk-autoscaling.rb +58 -0
- data/lib/aws-sdk-autoscaling/activity.rb +161 -0
- data/lib/aws-sdk-autoscaling/auto_scaling_group.rb +1045 -0
- data/lib/aws-sdk-autoscaling/client.rb +2764 -0
- data/lib/aws-sdk-autoscaling/client_api.rb +1422 -0
- data/lib/aws-sdk-autoscaling/customizations.rb +7 -0
- data/lib/aws-sdk-autoscaling/errors.rb +23 -0
- data/lib/aws-sdk-autoscaling/instance.rb +416 -0
- data/lib/aws-sdk-autoscaling/launch_configuration.rb +236 -0
- data/lib/aws-sdk-autoscaling/lifecycle_hook.rb +329 -0
- data/lib/aws-sdk-autoscaling/load_balancer.rb +219 -0
- data/lib/aws-sdk-autoscaling/notification_configuration.rb +199 -0
- data/lib/aws-sdk-autoscaling/resource.rb +695 -0
- data/lib/aws-sdk-autoscaling/scaling_policy.rb +258 -0
- data/lib/aws-sdk-autoscaling/scheduled_action.rb +183 -0
- data/lib/aws-sdk-autoscaling/tag.rb +260 -0
- data/lib/aws-sdk-autoscaling/types.rb +3557 -0
- data/lib/aws-sdk-autoscaling/waiters.rb +146 -0
- metadata +91 -0
@@ -0,0 +1,23 @@
|
|
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
|
+
module Errors
|
11
|
+
|
12
|
+
extend Aws::Errors::DynamicErrors
|
13
|
+
|
14
|
+
# Raised when calling #load or #data on a resource class that can not be
|
15
|
+
# loaded. This can happen when:
|
16
|
+
#
|
17
|
+
# * A resource class has identifiers, but no data attributes.
|
18
|
+
# * Resource data is only available when making an API call that
|
19
|
+
# enumerates all resources of that type.
|
20
|
+
class ResourceNotLoadable < RuntimeError; end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,416 @@
|
|
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 Instance
|
11
|
+
|
12
|
+
extend Aws::Deprecations
|
13
|
+
|
14
|
+
# @overload def initialize(group_name, id, options = {})
|
15
|
+
# @param [String] group_name
|
16
|
+
# @param [String] id
|
17
|
+
# @option options [Client] :client
|
18
|
+
# @overload def initialize(options = {})
|
19
|
+
# @option options [required, String] :group_name
|
20
|
+
# @option options [required, String] :id
|
21
|
+
# @option options [Client] :client
|
22
|
+
def initialize(*args)
|
23
|
+
options = Hash === args.last ? args.pop.dup : {}
|
24
|
+
@group_name = extract_group_name(args, options)
|
25
|
+
@id = extract_id(args, options)
|
26
|
+
@data = options.delete(:data)
|
27
|
+
@client = options.delete(:client) || Client.new(options)
|
28
|
+
end
|
29
|
+
|
30
|
+
# @!group Read-Only Attributes
|
31
|
+
|
32
|
+
# @return [String]
|
33
|
+
def group_name
|
34
|
+
@group_name
|
35
|
+
end
|
36
|
+
alias :auto_scaling_group_name :group_name
|
37
|
+
|
38
|
+
# @return [String]
|
39
|
+
def id
|
40
|
+
@id
|
41
|
+
end
|
42
|
+
alias :instance_id :id
|
43
|
+
|
44
|
+
# The Availability Zone for the instance.
|
45
|
+
# @return [String]
|
46
|
+
def availability_zone
|
47
|
+
data.availability_zone
|
48
|
+
end
|
49
|
+
|
50
|
+
# The lifecycle state for the instance. For more information, see [Auto
|
51
|
+
# Scaling Lifecycle][1] in the *Auto Scaling User Guide*.
|
52
|
+
#
|
53
|
+
#
|
54
|
+
#
|
55
|
+
# [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/AutoScalingGroupLifecycle.html
|
56
|
+
# @return [String]
|
57
|
+
def lifecycle_state
|
58
|
+
data.lifecycle_state
|
59
|
+
end
|
60
|
+
|
61
|
+
# The last reported health status of this instance. "Healthy" means
|
62
|
+
# that the instance is healthy and should remain in service.
|
63
|
+
# "Unhealthy" means that the instance is unhealthy and Auto Scaling
|
64
|
+
# should terminate and replace it.
|
65
|
+
# @return [String]
|
66
|
+
def health_status
|
67
|
+
data.health_status
|
68
|
+
end
|
69
|
+
|
70
|
+
# The launch configuration associated with the instance.
|
71
|
+
# @return [String]
|
72
|
+
def launch_configuration_name
|
73
|
+
data.launch_configuration_name
|
74
|
+
end
|
75
|
+
|
76
|
+
# Indicates whether the instance is protected from termination by Auto
|
77
|
+
# Scaling when scaling in.
|
78
|
+
# @return [Boolean]
|
79
|
+
def protected_from_scale_in
|
80
|
+
data.protected_from_scale_in
|
81
|
+
end
|
82
|
+
|
83
|
+
# @!endgroup
|
84
|
+
|
85
|
+
# @return [Client]
|
86
|
+
def client
|
87
|
+
@client
|
88
|
+
end
|
89
|
+
|
90
|
+
# Loads, or reloads {#data} for the current {Instance}.
|
91
|
+
# Returns `self` making it possible to chain methods.
|
92
|
+
#
|
93
|
+
# instance.reload.data
|
94
|
+
#
|
95
|
+
# @return [self]
|
96
|
+
def load
|
97
|
+
resp = @client.describe_auto_scaling_instances(instance_ids: [@id])
|
98
|
+
@data = resp.autoscalinginstances[0]
|
99
|
+
self
|
100
|
+
end
|
101
|
+
alias :reload :load
|
102
|
+
|
103
|
+
# @return [Types::AutoScalingInstanceDetails]
|
104
|
+
# Returns the data for this {Instance}. Calls
|
105
|
+
# {Client#describe_auto_scaling_instances} if {#data_loaded?} is `false`.
|
106
|
+
def data
|
107
|
+
load unless @data
|
108
|
+
@data
|
109
|
+
end
|
110
|
+
|
111
|
+
# @return [Boolean]
|
112
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
113
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
114
|
+
def data_loaded?
|
115
|
+
!!@data
|
116
|
+
end
|
117
|
+
|
118
|
+
# @!group Actions
|
119
|
+
|
120
|
+
# @example Request syntax with placeholder values
|
121
|
+
#
|
122
|
+
# instance.attach()
|
123
|
+
# @param [Hash] options ({})
|
124
|
+
# @return [EmptyStructure]
|
125
|
+
def attach(options = {})
|
126
|
+
options = Aws::Util.deep_merge(options,
|
127
|
+
auto_scaling_group_name: @group_name,
|
128
|
+
instance_ids: [@id]
|
129
|
+
)
|
130
|
+
resp = @client.attach_instances(options)
|
131
|
+
resp.data
|
132
|
+
end
|
133
|
+
|
134
|
+
# @example Request syntax with placeholder values
|
135
|
+
#
|
136
|
+
# activity = instance.detach({
|
137
|
+
# should_decrement_desired_capacity: false, # required
|
138
|
+
# })
|
139
|
+
# @param [Hash] options ({})
|
140
|
+
# @option options [required, Boolean] :should_decrement_desired_capacity
|
141
|
+
# If `True`, the Auto Scaling group decrements the desired capacity
|
142
|
+
# value by the number of instances detached.
|
143
|
+
# @return [Activity::Collection]
|
144
|
+
def detach(options = {})
|
145
|
+
batch = []
|
146
|
+
options = Aws::Util.deep_merge(options,
|
147
|
+
auto_scaling_group_name: @group_name,
|
148
|
+
instance_ids: [@id]
|
149
|
+
)
|
150
|
+
resp = @client.detach_instances(options)
|
151
|
+
resp.data.activities.each do |a|
|
152
|
+
batch << Activity.new(
|
153
|
+
id: a.activity_id,
|
154
|
+
data: a,
|
155
|
+
client: @client
|
156
|
+
)
|
157
|
+
end
|
158
|
+
Activity::Collection.new([batch], size: batch.size)
|
159
|
+
end
|
160
|
+
|
161
|
+
# @example Request syntax with placeholder values
|
162
|
+
#
|
163
|
+
# activity = instance.enter_standby({
|
164
|
+
# should_decrement_desired_capacity: false, # required
|
165
|
+
# })
|
166
|
+
# @param [Hash] options ({})
|
167
|
+
# @option options [required, Boolean] :should_decrement_desired_capacity
|
168
|
+
# Specifies whether the instances moved to `Standby` mode count as part
|
169
|
+
# of the Auto Scaling group's desired capacity. If set, the desired
|
170
|
+
# capacity for the Auto Scaling group decrements by the number of
|
171
|
+
# instances moved to `Standby` mode.
|
172
|
+
# @return [Activity::Collection]
|
173
|
+
def enter_standby(options = {})
|
174
|
+
batch = []
|
175
|
+
options = Aws::Util.deep_merge(options,
|
176
|
+
auto_scaling_group_name: @group_name,
|
177
|
+
instance_ids: [@id]
|
178
|
+
)
|
179
|
+
resp = @client.enter_standby(options)
|
180
|
+
resp.data.activities.each do |a|
|
181
|
+
batch << Activity.new(
|
182
|
+
id: a.activity_id,
|
183
|
+
data: a,
|
184
|
+
client: @client
|
185
|
+
)
|
186
|
+
end
|
187
|
+
Activity::Collection.new([batch], size: batch.size)
|
188
|
+
end
|
189
|
+
|
190
|
+
# @example Request syntax with placeholder values
|
191
|
+
#
|
192
|
+
# activity = instance.exit_standby()
|
193
|
+
# @param [Hash] options ({})
|
194
|
+
# @return [Activity::Collection]
|
195
|
+
def exit_standby(options = {})
|
196
|
+
batch = []
|
197
|
+
options = Aws::Util.deep_merge(options,
|
198
|
+
auto_scaling_group_name: @group_name,
|
199
|
+
instance_ids: [@id]
|
200
|
+
)
|
201
|
+
resp = @client.exit_standby(options)
|
202
|
+
resp.data.activities.each do |a|
|
203
|
+
batch << Activity.new(
|
204
|
+
id: a.activity_id,
|
205
|
+
data: a,
|
206
|
+
client: @client
|
207
|
+
)
|
208
|
+
end
|
209
|
+
Activity::Collection.new([batch], size: batch.size)
|
210
|
+
end
|
211
|
+
|
212
|
+
# @example Request syntax with placeholder values
|
213
|
+
#
|
214
|
+
# instance.set_health({
|
215
|
+
# health_status: "XmlStringMaxLen32", # required
|
216
|
+
# should_respect_grace_period: false,
|
217
|
+
# })
|
218
|
+
# @param [Hash] options ({})
|
219
|
+
# @option options [required, String] :health_status
|
220
|
+
# The health status of the instance. Set to `Healthy` if you want the
|
221
|
+
# instance to remain in service. Set to `Unhealthy` if you want the
|
222
|
+
# instance to be out of service. Auto Scaling will terminate and replace
|
223
|
+
# the unhealthy instance.
|
224
|
+
# @option options [Boolean] :should_respect_grace_period
|
225
|
+
# If the Auto Scaling group of the specified instance has a
|
226
|
+
# `HealthCheckGracePeriod` specified for the group, by default, this
|
227
|
+
# call will respect the grace period. Set this to `False`, if you do not
|
228
|
+
# want the call to respect the grace period associated with the group.
|
229
|
+
#
|
230
|
+
# For more information, see the description of the health check grace
|
231
|
+
# period for CreateAutoScalingGroup.
|
232
|
+
# @return [EmptyStructure]
|
233
|
+
def set_health(options = {})
|
234
|
+
options = options.merge(instance_id: @id)
|
235
|
+
resp = @client.set_instance_health(options)
|
236
|
+
resp.data
|
237
|
+
end
|
238
|
+
|
239
|
+
# @example Request syntax with placeholder values
|
240
|
+
#
|
241
|
+
# activity = instance.terminate({
|
242
|
+
# should_decrement_desired_capacity: false, # required
|
243
|
+
# })
|
244
|
+
# @param [Hash] options ({})
|
245
|
+
# @option options [required, Boolean] :should_decrement_desired_capacity
|
246
|
+
# If `true`, terminating the instance also decrements the size of the
|
247
|
+
# Auto Scaling group.
|
248
|
+
# @return [Activity]
|
249
|
+
def terminate(options = {})
|
250
|
+
options = options.merge(instance_id: @id)
|
251
|
+
resp = @client.terminate_instance_in_auto_scaling_group(options)
|
252
|
+
Activity.new(
|
253
|
+
id: resp.data.activity.activity_id,
|
254
|
+
data: resp.data.activity,
|
255
|
+
client: @client
|
256
|
+
)
|
257
|
+
end
|
258
|
+
|
259
|
+
# @!group Associations
|
260
|
+
|
261
|
+
# @return [AutoScalingGroup]
|
262
|
+
def group
|
263
|
+
AutoScalingGroup.new(
|
264
|
+
name: @group_name,
|
265
|
+
client: @client
|
266
|
+
)
|
267
|
+
end
|
268
|
+
|
269
|
+
# @return [LaunchConfiguration, nil]
|
270
|
+
def launch_configuration
|
271
|
+
if data.launch_configuration_name
|
272
|
+
LaunchConfiguration.new(
|
273
|
+
name: data.launch_configuration_name,
|
274
|
+
client: @client
|
275
|
+
)
|
276
|
+
else
|
277
|
+
nil
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
# @deprecated
|
282
|
+
# @api private
|
283
|
+
def identifiers
|
284
|
+
{
|
285
|
+
group_name: @group_name,
|
286
|
+
id: @id
|
287
|
+
}
|
288
|
+
end
|
289
|
+
deprecated(:identifiers)
|
290
|
+
|
291
|
+
private
|
292
|
+
|
293
|
+
def extract_group_name(args, options)
|
294
|
+
value = args[0] || options.delete(:group_name)
|
295
|
+
case value
|
296
|
+
when String then value
|
297
|
+
when nil then raise ArgumentError, "missing required option :group_name"
|
298
|
+
else
|
299
|
+
msg = "expected :group_name to be a String, got #{value.class}"
|
300
|
+
raise ArgumentError, msg
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
def extract_id(args, options)
|
305
|
+
value = args[1] || options.delete(:id)
|
306
|
+
case value
|
307
|
+
when String then value
|
308
|
+
when nil then raise ArgumentError, "missing required option :id"
|
309
|
+
else
|
310
|
+
msg = "expected :id to be a String, got #{value.class}"
|
311
|
+
raise ArgumentError, msg
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
class Collection < Aws::Resources::Collection
|
316
|
+
|
317
|
+
# @!group Batch Actions
|
318
|
+
|
319
|
+
# @example Request syntax with placeholder values
|
320
|
+
#
|
321
|
+
# instance.batch_attach()
|
322
|
+
# @param options ({})
|
323
|
+
# @return [void]
|
324
|
+
def batch_attach(options = {})
|
325
|
+
batch_enum.each do |batch|
|
326
|
+
params = Aws::Util.copy_hash(options)
|
327
|
+
params[:auto_scaling_group_name] = batch[0].group_name
|
328
|
+
params[:instance_ids] ||= []
|
329
|
+
batch.each do |item|
|
330
|
+
params[:instance_ids] << {
|
331
|
+
id: item.id
|
332
|
+
}
|
333
|
+
end
|
334
|
+
batch[0].client.attach_instances(params)
|
335
|
+
end
|
336
|
+
nil
|
337
|
+
end
|
338
|
+
|
339
|
+
# @example Request syntax with placeholder values
|
340
|
+
#
|
341
|
+
# instance.batch_detach({
|
342
|
+
# should_decrement_desired_capacity: false, # required
|
343
|
+
# })
|
344
|
+
# @param options ({})
|
345
|
+
# @option options [required, Boolean] :should_decrement_desired_capacity
|
346
|
+
# If `True`, the Auto Scaling group decrements the desired capacity
|
347
|
+
# value by the number of instances detached.
|
348
|
+
# @return [void]
|
349
|
+
def batch_detach(options = {})
|
350
|
+
batch_enum.each do |batch|
|
351
|
+
params = Aws::Util.copy_hash(options)
|
352
|
+
params[:auto_scaling_group_name] = batch[0].group_name
|
353
|
+
params[:instance_ids] ||= []
|
354
|
+
batch.each do |item|
|
355
|
+
params[:instance_ids] << {
|
356
|
+
id: item.id
|
357
|
+
}
|
358
|
+
end
|
359
|
+
batch[0].client.detach_instances(params)
|
360
|
+
end
|
361
|
+
nil
|
362
|
+
end
|
363
|
+
|
364
|
+
# @example Request syntax with placeholder values
|
365
|
+
#
|
366
|
+
# instance.batch_enter_standby({
|
367
|
+
# should_decrement_desired_capacity: false, # required
|
368
|
+
# })
|
369
|
+
# @param options ({})
|
370
|
+
# @option options [required, Boolean] :should_decrement_desired_capacity
|
371
|
+
# Specifies whether the instances moved to `Standby` mode count as part
|
372
|
+
# of the Auto Scaling group's desired capacity. If set, the desired
|
373
|
+
# capacity for the Auto Scaling group decrements by the number of
|
374
|
+
# instances moved to `Standby` mode.
|
375
|
+
# @return [void]
|
376
|
+
def batch_enter_standby(options = {})
|
377
|
+
batch_enum.each do |batch|
|
378
|
+
params = Aws::Util.copy_hash(options)
|
379
|
+
params[:auto_scaling_group_name] = batch[0].group_name
|
380
|
+
params[:instance_ids] ||= []
|
381
|
+
batch.each do |item|
|
382
|
+
params[:instance_ids] << {
|
383
|
+
id: item.id
|
384
|
+
}
|
385
|
+
end
|
386
|
+
batch[0].client.enter_standby(params)
|
387
|
+
end
|
388
|
+
nil
|
389
|
+
end
|
390
|
+
|
391
|
+
# @example Request syntax with placeholder values
|
392
|
+
#
|
393
|
+
# instance.batch_exit_standby()
|
394
|
+
# @param options ({})
|
395
|
+
# @return [void]
|
396
|
+
def batch_exit_standby(options = {})
|
397
|
+
batch_enum.each do |batch|
|
398
|
+
params = Aws::Util.copy_hash(options)
|
399
|
+
params[:auto_scaling_group_name] = batch[0].group_name
|
400
|
+
params[:instance_ids] ||= []
|
401
|
+
batch.each do |item|
|
402
|
+
params[:instance_ids] << {
|
403
|
+
id: item.id
|
404
|
+
}
|
405
|
+
end
|
406
|
+
batch[0].client.exit_standby(params)
|
407
|
+
end
|
408
|
+
nil
|
409
|
+
end
|
410
|
+
|
411
|
+
# @!endgroup
|
412
|
+
|
413
|
+
end
|
414
|
+
end
|
415
|
+
end
|
416
|
+
end
|
@@ -0,0 +1,236 @@
|
|
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 LaunchConfiguration
|
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 :launch_configuration_name :name
|
34
|
+
|
35
|
+
# The Amazon Resource Name (ARN) of the launch configuration.
|
36
|
+
# @return [String]
|
37
|
+
def launch_configuration_arn
|
38
|
+
data.launch_configuration_arn
|
39
|
+
end
|
40
|
+
|
41
|
+
# The ID of the Amazon Machine Image (AMI).
|
42
|
+
# @return [String]
|
43
|
+
def image_id
|
44
|
+
data.image_id
|
45
|
+
end
|
46
|
+
|
47
|
+
# The name of the key pair.
|
48
|
+
# @return [String]
|
49
|
+
def key_name
|
50
|
+
data.key_name
|
51
|
+
end
|
52
|
+
|
53
|
+
# The security groups to associate with the instances.
|
54
|
+
# @return [Array<String>]
|
55
|
+
def security_groups
|
56
|
+
data.security_groups
|
57
|
+
end
|
58
|
+
|
59
|
+
# The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances
|
60
|
+
# to. This parameter can only be used if you are launching EC2-Classic
|
61
|
+
# instances. For more information, see [ClassicLink][1] in the *Amazon
|
62
|
+
# Elastic Compute Cloud User Guide*.
|
63
|
+
#
|
64
|
+
#
|
65
|
+
#
|
66
|
+
# [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html
|
67
|
+
# @return [String]
|
68
|
+
def classic_link_vpc_id
|
69
|
+
data.classic_link_vpc_id
|
70
|
+
end
|
71
|
+
|
72
|
+
# The IDs of one or more security groups for the VPC specified in
|
73
|
+
# `ClassicLinkVPCId`. This parameter is required if you specify a
|
74
|
+
# ClassicLink-enabled VPC, and cannot be used otherwise. For more
|
75
|
+
# information, see [ClassicLink][1] in the *Amazon Elastic Compute Cloud
|
76
|
+
# User Guide*.
|
77
|
+
#
|
78
|
+
#
|
79
|
+
#
|
80
|
+
# [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html
|
81
|
+
# @return [Array<String>]
|
82
|
+
def classic_link_vpc_security_groups
|
83
|
+
data.classic_link_vpc_security_groups
|
84
|
+
end
|
85
|
+
|
86
|
+
# The user data available to the instances.
|
87
|
+
# @return [String]
|
88
|
+
def user_data
|
89
|
+
data.user_data
|
90
|
+
end
|
91
|
+
|
92
|
+
# The instance type for the instances.
|
93
|
+
# @return [String]
|
94
|
+
def instance_type
|
95
|
+
data.instance_type
|
96
|
+
end
|
97
|
+
|
98
|
+
# The ID of the kernel associated with the AMI.
|
99
|
+
# @return [String]
|
100
|
+
def kernel_id
|
101
|
+
data.kernel_id
|
102
|
+
end
|
103
|
+
|
104
|
+
# The ID of the RAM disk associated with the AMI.
|
105
|
+
# @return [String]
|
106
|
+
def ramdisk_id
|
107
|
+
data.ramdisk_id
|
108
|
+
end
|
109
|
+
|
110
|
+
# A block device mapping, which specifies the block devices for the
|
111
|
+
# instance.
|
112
|
+
# @return [Array<Types::BlockDeviceMapping>]
|
113
|
+
def block_device_mappings
|
114
|
+
data.block_device_mappings
|
115
|
+
end
|
116
|
+
|
117
|
+
# Controls whether instances in this group are launched with detailed
|
118
|
+
# (`true`) or basic (`false`) monitoring.
|
119
|
+
# @return [Types::InstanceMonitoring]
|
120
|
+
def instance_monitoring
|
121
|
+
data.instance_monitoring
|
122
|
+
end
|
123
|
+
|
124
|
+
# The price to bid when launching Spot Instances.
|
125
|
+
# @return [String]
|
126
|
+
def spot_price
|
127
|
+
data.spot_price
|
128
|
+
end
|
129
|
+
|
130
|
+
# The name or Amazon Resource Name (ARN) of the instance profile
|
131
|
+
# associated with the IAM role for the instance.
|
132
|
+
# @return [String]
|
133
|
+
def iam_instance_profile
|
134
|
+
data.iam_instance_profile
|
135
|
+
end
|
136
|
+
|
137
|
+
# The creation date and time for the launch configuration.
|
138
|
+
# @return [Time]
|
139
|
+
def created_time
|
140
|
+
data.created_time
|
141
|
+
end
|
142
|
+
|
143
|
+
# Controls whether the instance is optimized for EBS I/O (`true`) or not
|
144
|
+
# (`false`).
|
145
|
+
# @return [Boolean]
|
146
|
+
def ebs_optimized
|
147
|
+
data.ebs_optimized
|
148
|
+
end
|
149
|
+
|
150
|
+
# \[EC2-VPC\] Indicates whether to assign a public IP address to each
|
151
|
+
# instance.
|
152
|
+
# @return [Boolean]
|
153
|
+
def associate_public_ip_address
|
154
|
+
data.associate_public_ip_address
|
155
|
+
end
|
156
|
+
|
157
|
+
# The tenancy of the instance, either `default` or `dedicated`. An
|
158
|
+
# instance with `dedicated` tenancy runs in an isolated, single-tenant
|
159
|
+
# hardware and can only be launched into a VPC.
|
160
|
+
# @return [String]
|
161
|
+
def placement_tenancy
|
162
|
+
data.placement_tenancy
|
163
|
+
end
|
164
|
+
|
165
|
+
# @!endgroup
|
166
|
+
|
167
|
+
# @return [Client]
|
168
|
+
def client
|
169
|
+
@client
|
170
|
+
end
|
171
|
+
|
172
|
+
# Loads, or reloads {#data} for the current {LaunchConfiguration}.
|
173
|
+
# Returns `self` making it possible to chain methods.
|
174
|
+
#
|
175
|
+
# launch_configuration.reload.data
|
176
|
+
#
|
177
|
+
# @return [self]
|
178
|
+
def load
|
179
|
+
resp = @client.describe_launch_configurations(launch_configuration_names: [@name])
|
180
|
+
@data = resp.launchconfigurations[0]
|
181
|
+
self
|
182
|
+
end
|
183
|
+
alias :reload :load
|
184
|
+
|
185
|
+
# @return [Types::LaunchConfiguration]
|
186
|
+
# Returns the data for this {LaunchConfiguration}. Calls
|
187
|
+
# {Client#describe_launch_configurations} if {#data_loaded?} is `false`.
|
188
|
+
def data
|
189
|
+
load unless @data
|
190
|
+
@data
|
191
|
+
end
|
192
|
+
|
193
|
+
# @return [Boolean]
|
194
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
195
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
196
|
+
def data_loaded?
|
197
|
+
!!@data
|
198
|
+
end
|
199
|
+
|
200
|
+
# @!group Actions
|
201
|
+
|
202
|
+
# @example Request syntax with placeholder values
|
203
|
+
#
|
204
|
+
# launch_configuration.delete()
|
205
|
+
# @param [Hash] options ({})
|
206
|
+
# @return [EmptyStructure]
|
207
|
+
def delete(options = {})
|
208
|
+
options = options.merge(launch_configuration_name: @name)
|
209
|
+
resp = @client.delete_launch_configuration(options)
|
210
|
+
resp.data
|
211
|
+
end
|
212
|
+
|
213
|
+
# @deprecated
|
214
|
+
# @api private
|
215
|
+
def identifiers
|
216
|
+
{ name: @name }
|
217
|
+
end
|
218
|
+
deprecated(:identifiers)
|
219
|
+
|
220
|
+
private
|
221
|
+
|
222
|
+
def extract_name(args, options)
|
223
|
+
value = args[0] || options.delete(:name)
|
224
|
+
case value
|
225
|
+
when String then value
|
226
|
+
when nil then raise ArgumentError, "missing required option :name"
|
227
|
+
else
|
228
|
+
msg = "expected :name to be a String, got #{value.class}"
|
229
|
+
raise ArgumentError, msg
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
class Collection < Aws::Resources::Collection; end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|