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.
- 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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 51fa29a246960d90fc1addf4f1aedd5aaee57379
|
4
|
+
data.tar.gz: a8950dc540ad4c7676ea2360137cff3a6b7d0e60
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4c4b06cf492a2b19f35cd2b27839e19832bf2efe6242d408e8889a1395f017a69a6bdfc367cbe4e5c8004fd7e67acf6c07acb1df3499463c59c169294d184c50
|
7
|
+
data.tar.gz: f0c3fcc8e9c9cabb74eb73fdd53287bccfb36494946ae2db55ff1f9bd468af049da64c9500688b31a6970c36438623bd34d6080b9881a69e518952b0fd868c5f
|
@@ -0,0 +1,58 @@
|
|
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
|
+
require 'aws-sdk-core'
|
9
|
+
require 'aws-sigv4'
|
10
|
+
|
11
|
+
require_relative 'aws-sdk-autoscaling/types'
|
12
|
+
require_relative 'aws-sdk-autoscaling/client_api'
|
13
|
+
require_relative 'aws-sdk-autoscaling/client'
|
14
|
+
require_relative 'aws-sdk-autoscaling/errors'
|
15
|
+
require_relative 'aws-sdk-autoscaling/waiters'
|
16
|
+
require_relative 'aws-sdk-autoscaling/resource'
|
17
|
+
require_relative 'aws-sdk-autoscaling/activity'
|
18
|
+
require_relative 'aws-sdk-autoscaling/auto_scaling_group'
|
19
|
+
require_relative 'aws-sdk-autoscaling/instance'
|
20
|
+
require_relative 'aws-sdk-autoscaling/launch_configuration'
|
21
|
+
require_relative 'aws-sdk-autoscaling/lifecycle_hook'
|
22
|
+
require_relative 'aws-sdk-autoscaling/load_balancer'
|
23
|
+
require_relative 'aws-sdk-autoscaling/notification_configuration'
|
24
|
+
require_relative 'aws-sdk-autoscaling/scaling_policy'
|
25
|
+
require_relative 'aws-sdk-autoscaling/scheduled_action'
|
26
|
+
require_relative 'aws-sdk-autoscaling/tag'
|
27
|
+
require_relative 'aws-sdk-autoscaling/customizations'
|
28
|
+
|
29
|
+
# This module provides support for Auto Scaling. This module is available in the
|
30
|
+
# `aws-sdk-autoscaling` gem.
|
31
|
+
#
|
32
|
+
# # Client
|
33
|
+
#
|
34
|
+
# The {Client} class provides one method for each API operation. Operation
|
35
|
+
# methods each accept a hash of request parameters and return a response
|
36
|
+
# structure.
|
37
|
+
#
|
38
|
+
# See {Client} for more information.
|
39
|
+
#
|
40
|
+
# # Errors
|
41
|
+
#
|
42
|
+
# Errors returned from Auto Scaling all
|
43
|
+
# extend {Errors::ServiceError}.
|
44
|
+
#
|
45
|
+
# begin
|
46
|
+
# # do stuff
|
47
|
+
# rescue Aws::AutoScaling::Errors::ServiceError
|
48
|
+
# # rescues all service API errors
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# See {Errors} for more information.
|
52
|
+
#
|
53
|
+
# @service
|
54
|
+
module Aws::AutoScaling
|
55
|
+
|
56
|
+
GEM_VERSION = '1.0.0.rc1'
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,161 @@
|
|
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 Activity
|
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
|
+
alias :activity_id :id
|
34
|
+
|
35
|
+
# The name of the Auto Scaling group.
|
36
|
+
# @return [String]
|
37
|
+
def auto_scaling_group_name
|
38
|
+
data.auto_scaling_group_name
|
39
|
+
end
|
40
|
+
|
41
|
+
# A friendly, more verbose description of the activity.
|
42
|
+
# @return [String]
|
43
|
+
def description
|
44
|
+
data.description
|
45
|
+
end
|
46
|
+
|
47
|
+
# The reason the activity began.
|
48
|
+
# @return [String]
|
49
|
+
def cause
|
50
|
+
data.cause
|
51
|
+
end
|
52
|
+
|
53
|
+
# The start time of the activity.
|
54
|
+
# @return [Time]
|
55
|
+
def start_time
|
56
|
+
data.start_time
|
57
|
+
end
|
58
|
+
|
59
|
+
# The end time of the activity.
|
60
|
+
# @return [Time]
|
61
|
+
def end_time
|
62
|
+
data.end_time
|
63
|
+
end
|
64
|
+
|
65
|
+
# The current status of the activity.
|
66
|
+
# @return [String]
|
67
|
+
def status_code
|
68
|
+
data.status_code
|
69
|
+
end
|
70
|
+
|
71
|
+
# A friendly, more verbose description of the activity status.
|
72
|
+
# @return [String]
|
73
|
+
def status_message
|
74
|
+
data.status_message
|
75
|
+
end
|
76
|
+
|
77
|
+
# A value between 0 and 100 that indicates the progress of the activity.
|
78
|
+
# @return [Integer]
|
79
|
+
def progress
|
80
|
+
data.progress
|
81
|
+
end
|
82
|
+
|
83
|
+
# The details about the activity.
|
84
|
+
# @return [String]
|
85
|
+
def details
|
86
|
+
data.details
|
87
|
+
end
|
88
|
+
|
89
|
+
# @!endgroup
|
90
|
+
|
91
|
+
# @return [Client]
|
92
|
+
def client
|
93
|
+
@client
|
94
|
+
end
|
95
|
+
|
96
|
+
# Loads, or reloads {#data} for the current {Activity}.
|
97
|
+
# Returns `self` making it possible to chain methods.
|
98
|
+
#
|
99
|
+
# activity.reload.data
|
100
|
+
#
|
101
|
+
# @return [self]
|
102
|
+
def load
|
103
|
+
resp = @client.describe_scaling_activities(activity_ids: [@id])
|
104
|
+
@data = resp.activities[0]
|
105
|
+
self
|
106
|
+
end
|
107
|
+
alias :reload :load
|
108
|
+
|
109
|
+
# @return [Types::Activity]
|
110
|
+
# Returns the data for this {Activity}. Calls
|
111
|
+
# {Client#describe_scaling_activities} if {#data_loaded?} is `false`.
|
112
|
+
def data
|
113
|
+
load unless @data
|
114
|
+
@data
|
115
|
+
end
|
116
|
+
|
117
|
+
# @return [Boolean]
|
118
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
119
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
120
|
+
def data_loaded?
|
121
|
+
!!@data
|
122
|
+
end
|
123
|
+
|
124
|
+
# @!group Associations
|
125
|
+
|
126
|
+
# @return [AutoScalingGroup, nil]
|
127
|
+
def group
|
128
|
+
if data.auto_scaling_group_name
|
129
|
+
AutoScalingGroup.new(
|
130
|
+
name: data.auto_scaling_group_name,
|
131
|
+
client: @client
|
132
|
+
)
|
133
|
+
else
|
134
|
+
nil
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
# @deprecated
|
139
|
+
# @api private
|
140
|
+
def identifiers
|
141
|
+
{ id: @id }
|
142
|
+
end
|
143
|
+
deprecated(:identifiers)
|
144
|
+
|
145
|
+
private
|
146
|
+
|
147
|
+
def extract_id(args, options)
|
148
|
+
value = args[0] || options.delete(:id)
|
149
|
+
case value
|
150
|
+
when String then value
|
151
|
+
when nil then raise ArgumentError, "missing required option :id"
|
152
|
+
else
|
153
|
+
msg = "expected :id to be a String, got #{value.class}"
|
154
|
+
raise ArgumentError, msg
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
class Collection < Aws::Resources::Collection; end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
@@ -0,0 +1,1045 @@
|
|
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 AutoScalingGroup
|
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 :auto_scaling_group_name :name
|
34
|
+
|
35
|
+
# The Amazon Resource Name (ARN) of the group.
|
36
|
+
# @return [String]
|
37
|
+
def auto_scaling_group_arn
|
38
|
+
data.auto_scaling_group_arn
|
39
|
+
end
|
40
|
+
|
41
|
+
# The name of the associated launch configuration.
|
42
|
+
# @return [String]
|
43
|
+
def launch_configuration_name
|
44
|
+
data.launch_configuration_name
|
45
|
+
end
|
46
|
+
|
47
|
+
# The minimum size of the group.
|
48
|
+
# @return [Integer]
|
49
|
+
def min_size
|
50
|
+
data.min_size
|
51
|
+
end
|
52
|
+
|
53
|
+
# The maximum size of the group.
|
54
|
+
# @return [Integer]
|
55
|
+
def max_size
|
56
|
+
data.max_size
|
57
|
+
end
|
58
|
+
|
59
|
+
# The desired size of the group.
|
60
|
+
# @return [Integer]
|
61
|
+
def desired_capacity
|
62
|
+
data.desired_capacity
|
63
|
+
end
|
64
|
+
|
65
|
+
# The amount of time, in seconds, after a scaling activity completes
|
66
|
+
# before another scaling activity can start.
|
67
|
+
# @return [Integer]
|
68
|
+
def default_cooldown
|
69
|
+
data.default_cooldown
|
70
|
+
end
|
71
|
+
|
72
|
+
# One or more Availability Zones for the group.
|
73
|
+
# @return [Array<String>]
|
74
|
+
def availability_zones
|
75
|
+
data.availability_zones
|
76
|
+
end
|
77
|
+
|
78
|
+
# One or more load balancers associated with the group.
|
79
|
+
# @return [Array<String>]
|
80
|
+
def load_balancer_names
|
81
|
+
data.load_balancer_names
|
82
|
+
end
|
83
|
+
|
84
|
+
# The Amazon Resource Names (ARN) of the target groups for your load
|
85
|
+
# balancer.
|
86
|
+
# @return [Array<String>]
|
87
|
+
def target_group_arns
|
88
|
+
data.target_group_arns
|
89
|
+
end
|
90
|
+
|
91
|
+
# The service to use for the health checks. The valid values are `EC2`
|
92
|
+
# and `ELB`.
|
93
|
+
# @return [String]
|
94
|
+
def health_check_type
|
95
|
+
data.health_check_type
|
96
|
+
end
|
97
|
+
|
98
|
+
# The amount of time, in seconds, that Auto Scaling waits before
|
99
|
+
# checking the health status of an EC2 instance that has come into
|
100
|
+
# service.
|
101
|
+
# @return [Integer]
|
102
|
+
def health_check_grace_period
|
103
|
+
data.health_check_grace_period
|
104
|
+
end
|
105
|
+
|
106
|
+
# The date and time the group was created.
|
107
|
+
# @return [Time]
|
108
|
+
def created_time
|
109
|
+
data.created_time
|
110
|
+
end
|
111
|
+
|
112
|
+
# The suspended processes associated with the group.
|
113
|
+
# @return [Array<Types::SuspendedProcess>]
|
114
|
+
def suspended_processes
|
115
|
+
data.suspended_processes
|
116
|
+
end
|
117
|
+
|
118
|
+
# The name of the placement group into which you'll launch your
|
119
|
+
# instances, if any. For more information, see [Placement Groups][1] in
|
120
|
+
# the *Amazon Elastic Compute Cloud User Guide*.
|
121
|
+
#
|
122
|
+
#
|
123
|
+
#
|
124
|
+
# [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html
|
125
|
+
# @return [String]
|
126
|
+
def placement_group
|
127
|
+
data.placement_group
|
128
|
+
end
|
129
|
+
|
130
|
+
# One or more subnet IDs, if applicable, separated by commas.
|
131
|
+
#
|
132
|
+
# If you specify `VPCZoneIdentifier` and `AvailabilityZones`, ensure
|
133
|
+
# that the Availability Zones of the subnets match the values for
|
134
|
+
# `AvailabilityZones`.
|
135
|
+
# @return [String]
|
136
|
+
def vpc_zone_identifier
|
137
|
+
data.vpc_zone_identifier
|
138
|
+
end
|
139
|
+
|
140
|
+
# The metrics enabled for the group.
|
141
|
+
# @return [Array<Types::EnabledMetric>]
|
142
|
+
def enabled_metrics
|
143
|
+
data.enabled_metrics
|
144
|
+
end
|
145
|
+
|
146
|
+
# The current state of the group when DeleteAutoScalingGroup is in
|
147
|
+
# progress.
|
148
|
+
# @return [String]
|
149
|
+
def status
|
150
|
+
data.status
|
151
|
+
end
|
152
|
+
|
153
|
+
# The termination policies for the group.
|
154
|
+
# @return [Array<String>]
|
155
|
+
def termination_policies
|
156
|
+
data.termination_policies
|
157
|
+
end
|
158
|
+
|
159
|
+
# Indicates whether newly launched instances are protected from
|
160
|
+
# termination by Auto Scaling when scaling in.
|
161
|
+
# @return [Boolean]
|
162
|
+
def new_instances_protected_from_scale_in
|
163
|
+
data.new_instances_protected_from_scale_in
|
164
|
+
end
|
165
|
+
|
166
|
+
# @!endgroup
|
167
|
+
|
168
|
+
# @return [Client]
|
169
|
+
def client
|
170
|
+
@client
|
171
|
+
end
|
172
|
+
|
173
|
+
# Loads, or reloads {#data} for the current {AutoScalingGroup}.
|
174
|
+
# Returns `self` making it possible to chain methods.
|
175
|
+
#
|
176
|
+
# auto_scaling_group.reload.data
|
177
|
+
#
|
178
|
+
# @return [self]
|
179
|
+
def load
|
180
|
+
resp = @client.describe_auto_scaling_groups(auto_scaling_group_names: [@name])
|
181
|
+
@data = resp.autoscalinggroups[0]
|
182
|
+
self
|
183
|
+
end
|
184
|
+
alias :reload :load
|
185
|
+
|
186
|
+
# @return [Types::AutoScalingGroup]
|
187
|
+
# Returns the data for this {AutoScalingGroup}. Calls
|
188
|
+
# {Client#describe_auto_scaling_groups} if {#data_loaded?} is `false`.
|
189
|
+
def data
|
190
|
+
load unless @data
|
191
|
+
@data
|
192
|
+
end
|
193
|
+
|
194
|
+
# @return [Boolean]
|
195
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
196
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
197
|
+
def data_loaded?
|
198
|
+
!!@data
|
199
|
+
end
|
200
|
+
|
201
|
+
# @param [Hash] options ({})
|
202
|
+
# @return [Boolean]
|
203
|
+
# Returns `true` if the AutoScalingGroup exists.
|
204
|
+
def exists?(options = {})
|
205
|
+
begin
|
206
|
+
wait_until_exists(options.merge(max_attempts: 1))
|
207
|
+
true
|
208
|
+
rescue Aws::Waiters::Errors::UnexpectedError => e
|
209
|
+
raise e.error
|
210
|
+
rescue Aws::Waiters::Errors::WaiterFailed
|
211
|
+
false
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
# @param [Hash] options ({})
|
216
|
+
# @option options [Integer] :max_attempts (10)
|
217
|
+
# @option options [Float] :delay (5)
|
218
|
+
# @option options [Proc] :before_attempt
|
219
|
+
# @option options [Proc] :before_wait
|
220
|
+
# @return [AutoScalingGroup]
|
221
|
+
def wait_until_exists(options = {})
|
222
|
+
options, params = separate_params_and_options(options)
|
223
|
+
waiter = Waiters::GroupExists.new(options)
|
224
|
+
yield_waiter_and_warn(waiter, &Proc.new) if block_given?
|
225
|
+
waiter.wait(params.merge(auto_scaling_group_names: [@name]))
|
226
|
+
AutoScalingGroup.new({
|
227
|
+
name: @name,
|
228
|
+
client: @client
|
229
|
+
})
|
230
|
+
end
|
231
|
+
|
232
|
+
# @param [Hash] options ({})
|
233
|
+
# @option options [Integer] :max_attempts (40)
|
234
|
+
# @option options [Float] :delay (15)
|
235
|
+
# @option options [Proc] :before_attempt
|
236
|
+
# @option options [Proc] :before_wait
|
237
|
+
# @return [AutoScalingGroup]
|
238
|
+
def wait_until_in_service(options = {})
|
239
|
+
options, params = separate_params_and_options(options)
|
240
|
+
waiter = Waiters::GroupInService.new(options)
|
241
|
+
yield_waiter_and_warn(waiter, &Proc.new) if block_given?
|
242
|
+
waiter.wait(params.merge(auto_scaling_group_names: [@name]))
|
243
|
+
AutoScalingGroup.new({
|
244
|
+
name: @name,
|
245
|
+
client: @client
|
246
|
+
})
|
247
|
+
end
|
248
|
+
|
249
|
+
# @param [Hash] options ({})
|
250
|
+
# @option options [Integer] :max_attempts (40)
|
251
|
+
# @option options [Float] :delay (15)
|
252
|
+
# @option options [Proc] :before_attempt
|
253
|
+
# @option options [Proc] :before_wait
|
254
|
+
# @return [AutoScalingGroup]
|
255
|
+
def wait_until_not_exists(options = {})
|
256
|
+
options, params = separate_params_and_options(options)
|
257
|
+
waiter = Waiters::GroupNotExists.new(options)
|
258
|
+
yield_waiter_and_warn(waiter, &Proc.new) if block_given?
|
259
|
+
waiter.wait(params.merge(auto_scaling_group_names: [@name]))
|
260
|
+
AutoScalingGroup.new({
|
261
|
+
name: @name,
|
262
|
+
client: @client
|
263
|
+
})
|
264
|
+
end
|
265
|
+
|
266
|
+
# @!group Actions
|
267
|
+
|
268
|
+
# @example Request syntax with placeholder values
|
269
|
+
#
|
270
|
+
# auto_scaling_group.attach_instances({
|
271
|
+
# instance_ids: ["XmlStringMaxLen19"],
|
272
|
+
# })
|
273
|
+
# @param [Hash] options ({})
|
274
|
+
# @option options [Array<String>] :instance_ids
|
275
|
+
# One or more instance IDs.
|
276
|
+
# @return [EmptyStructure]
|
277
|
+
def attach_instances(options = {})
|
278
|
+
options = options.merge(auto_scaling_group_name: @name)
|
279
|
+
resp = @client.attach_instances(options)
|
280
|
+
resp.data
|
281
|
+
end
|
282
|
+
|
283
|
+
# @example Request syntax with placeholder values
|
284
|
+
#
|
285
|
+
# auto_scaling_group.delete({
|
286
|
+
# force_delete: false,
|
287
|
+
# })
|
288
|
+
# @param [Hash] options ({})
|
289
|
+
# @option options [Boolean] :force_delete
|
290
|
+
# Specifies that the group will be deleted along with all instances
|
291
|
+
# associated with the group, without waiting for all instances to be
|
292
|
+
# terminated. This parameter also deletes any lifecycle actions
|
293
|
+
# associated with the group.
|
294
|
+
# @return [EmptyStructure]
|
295
|
+
def delete(options = {})
|
296
|
+
options = options.merge(auto_scaling_group_name: @name)
|
297
|
+
resp = @client.delete_auto_scaling_group(options)
|
298
|
+
resp.data
|
299
|
+
end
|
300
|
+
|
301
|
+
# @example Request syntax with placeholder values
|
302
|
+
#
|
303
|
+
# activity = auto_scaling_group.detach_instances({
|
304
|
+
# instance_ids: ["XmlStringMaxLen19"],
|
305
|
+
# should_decrement_desired_capacity: false, # required
|
306
|
+
# })
|
307
|
+
# @param [Hash] options ({})
|
308
|
+
# @option options [Array<String>] :instance_ids
|
309
|
+
# One or more instance IDs.
|
310
|
+
# @option options [required, Boolean] :should_decrement_desired_capacity
|
311
|
+
# If `True`, the Auto Scaling group decrements the desired capacity
|
312
|
+
# value by the number of instances detached.
|
313
|
+
# @return [Activity::Collection]
|
314
|
+
def detach_instances(options = {})
|
315
|
+
batch = []
|
316
|
+
options = options.merge(auto_scaling_group_name: @name)
|
317
|
+
resp = @client.detach_instances(options)
|
318
|
+
resp.data.activities.each do |a|
|
319
|
+
batch << Activity.new(
|
320
|
+
id: a.activity_id,
|
321
|
+
data: a,
|
322
|
+
client: @client
|
323
|
+
)
|
324
|
+
end
|
325
|
+
Activity::Collection.new([batch], size: batch.size)
|
326
|
+
end
|
327
|
+
|
328
|
+
# @example Request syntax with placeholder values
|
329
|
+
#
|
330
|
+
# auto_scaling_group.disable_metrics_collection({
|
331
|
+
# metrics: ["XmlStringMaxLen255"],
|
332
|
+
# })
|
333
|
+
# @param [Hash] options ({})
|
334
|
+
# @option options [Array<String>] :metrics
|
335
|
+
# One or more of the following metrics. If you omit this parameter, all
|
336
|
+
# metrics are disabled.
|
337
|
+
#
|
338
|
+
# * `GroupMinSize`
|
339
|
+
#
|
340
|
+
# * `GroupMaxSize`
|
341
|
+
#
|
342
|
+
# * `GroupDesiredCapacity`
|
343
|
+
#
|
344
|
+
# * `GroupInServiceInstances`
|
345
|
+
#
|
346
|
+
# * `GroupPendingInstances`
|
347
|
+
#
|
348
|
+
# * `GroupStandbyInstances`
|
349
|
+
#
|
350
|
+
# * `GroupTerminatingInstances`
|
351
|
+
#
|
352
|
+
# * `GroupTotalInstances`
|
353
|
+
# @return [EmptyStructure]
|
354
|
+
def disable_metrics_collection(options = {})
|
355
|
+
options = options.merge(auto_scaling_group_name: @name)
|
356
|
+
resp = @client.disable_metrics_collection(options)
|
357
|
+
resp.data
|
358
|
+
end
|
359
|
+
|
360
|
+
# @example Request syntax with placeholder values
|
361
|
+
#
|
362
|
+
# auto_scaling_group.enable_metrics_collection({
|
363
|
+
# metrics: ["XmlStringMaxLen255"],
|
364
|
+
# granularity: "XmlStringMaxLen255", # required
|
365
|
+
# })
|
366
|
+
# @param [Hash] options ({})
|
367
|
+
# @option options [Array<String>] :metrics
|
368
|
+
# One or more of the following metrics. If you omit this parameter, all
|
369
|
+
# metrics are enabled.
|
370
|
+
#
|
371
|
+
# * `GroupMinSize`
|
372
|
+
#
|
373
|
+
# * `GroupMaxSize`
|
374
|
+
#
|
375
|
+
# * `GroupDesiredCapacity`
|
376
|
+
#
|
377
|
+
# * `GroupInServiceInstances`
|
378
|
+
#
|
379
|
+
# * `GroupPendingInstances`
|
380
|
+
#
|
381
|
+
# * `GroupStandbyInstances`
|
382
|
+
#
|
383
|
+
# * `GroupTerminatingInstances`
|
384
|
+
#
|
385
|
+
# * `GroupTotalInstances`
|
386
|
+
# @option options [required, String] :granularity
|
387
|
+
# The granularity to associate with the metrics to collect. The only
|
388
|
+
# valid value is `1Minute`.
|
389
|
+
# @return [EmptyStructure]
|
390
|
+
def enable_metrics_collection(options = {})
|
391
|
+
options = options.merge(auto_scaling_group_name: @name)
|
392
|
+
resp = @client.enable_metrics_collection(options)
|
393
|
+
resp.data
|
394
|
+
end
|
395
|
+
|
396
|
+
# @example Request syntax with placeholder values
|
397
|
+
#
|
398
|
+
# scalingpolicy = auto_scaling_group.put_scaling_policy({
|
399
|
+
# policy_name: "XmlStringMaxLen255", # required
|
400
|
+
# policy_type: "XmlStringMaxLen64",
|
401
|
+
# adjustment_type: "XmlStringMaxLen255", # required
|
402
|
+
# min_adjustment_step: 1,
|
403
|
+
# min_adjustment_magnitude: 1,
|
404
|
+
# scaling_adjustment: 1,
|
405
|
+
# cooldown: 1,
|
406
|
+
# metric_aggregation_type: "XmlStringMaxLen32",
|
407
|
+
# step_adjustments: [
|
408
|
+
# {
|
409
|
+
# metric_interval_lower_bound: 1.0,
|
410
|
+
# metric_interval_upper_bound: 1.0,
|
411
|
+
# scaling_adjustment: 1, # required
|
412
|
+
# },
|
413
|
+
# ],
|
414
|
+
# estimated_instance_warmup: 1,
|
415
|
+
# })
|
416
|
+
# @param [Hash] options ({})
|
417
|
+
# @option options [required, String] :policy_name
|
418
|
+
# The name of the policy.
|
419
|
+
# @option options [String] :policy_type
|
420
|
+
# The policy type. Valid values are `SimpleScaling` and `StepScaling`.
|
421
|
+
# If the policy type is null, the value is treated as `SimpleScaling`.
|
422
|
+
# @option options [required, String] :adjustment_type
|
423
|
+
# The adjustment type. Valid values are `ChangeInCapacity`,
|
424
|
+
# `ExactCapacity`, and `PercentChangeInCapacity`.
|
425
|
+
#
|
426
|
+
# For more information, see [Dynamic Scaling][1] in the *Auto Scaling
|
427
|
+
# User Guide*.
|
428
|
+
#
|
429
|
+
#
|
430
|
+
#
|
431
|
+
# [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/as-scale-based-on-demand.html
|
432
|
+
# @option options [Integer] :min_adjustment_step
|
433
|
+
# Available for backward compatibility. Use `MinAdjustmentMagnitude`
|
434
|
+
# instead.
|
435
|
+
# @option options [Integer] :min_adjustment_magnitude
|
436
|
+
# The minimum number of instances to scale. If the value of
|
437
|
+
# `AdjustmentType` is `PercentChangeInCapacity`, the scaling policy
|
438
|
+
# changes the `DesiredCapacity` of the Auto Scaling group by at least
|
439
|
+
# this many instances. Otherwise, the error is `ValidationError`.
|
440
|
+
# @option options [Integer] :scaling_adjustment
|
441
|
+
# The amount by which to scale, based on the specified adjustment type.
|
442
|
+
# A positive value adds to the current capacity while a negative number
|
443
|
+
# removes from the current capacity.
|
444
|
+
#
|
445
|
+
# This parameter is required if the policy type is `SimpleScaling` and
|
446
|
+
# not supported otherwise.
|
447
|
+
# @option options [Integer] :cooldown
|
448
|
+
# The amount of time, in seconds, after a scaling activity completes and
|
449
|
+
# before the next scaling activity can start. If this parameter is not
|
450
|
+
# specified, the default cooldown period for the group applies.
|
451
|
+
#
|
452
|
+
# This parameter is not supported unless the policy type is
|
453
|
+
# `SimpleScaling`.
|
454
|
+
#
|
455
|
+
# For more information, see [Auto Scaling Cooldowns][1] in the *Auto
|
456
|
+
# Scaling User Guide*.
|
457
|
+
#
|
458
|
+
#
|
459
|
+
#
|
460
|
+
# [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/Cooldown.html
|
461
|
+
# @option options [String] :metric_aggregation_type
|
462
|
+
# The aggregation type for the CloudWatch metrics. Valid values are
|
463
|
+
# `Minimum`, `Maximum`, and `Average`. If the aggregation type is null,
|
464
|
+
# the value is treated as `Average`.
|
465
|
+
#
|
466
|
+
# This parameter is not supported if the policy type is `SimpleScaling`.
|
467
|
+
# @option options [Array<Types::StepAdjustment>] :step_adjustments
|
468
|
+
# A set of adjustments that enable you to scale based on the size of the
|
469
|
+
# alarm breach.
|
470
|
+
#
|
471
|
+
# This parameter is required if the policy type is `StepScaling` and not
|
472
|
+
# supported otherwise.
|
473
|
+
# @option options [Integer] :estimated_instance_warmup
|
474
|
+
# The estimated time, in seconds, until a newly launched instance can
|
475
|
+
# contribute to the CloudWatch metrics. The default is to use the value
|
476
|
+
# specified for the default cooldown period for the group.
|
477
|
+
#
|
478
|
+
# This parameter is not supported if the policy type is `SimpleScaling`.
|
479
|
+
# @return [ScalingPolicy]
|
480
|
+
def put_scaling_policy(options = {})
|
481
|
+
options = options.merge(auto_scaling_group_name: @name)
|
482
|
+
resp = @client.put_scaling_policy(options)
|
483
|
+
ScalingPolicy.new(
|
484
|
+
name: options[:policy_name],
|
485
|
+
client: @client
|
486
|
+
)
|
487
|
+
end
|
488
|
+
|
489
|
+
# @example Request syntax with placeholder values
|
490
|
+
#
|
491
|
+
# scheduledaction = auto_scaling_group.put_scheduled_update_group_action({
|
492
|
+
# scheduled_action_name: "XmlStringMaxLen255", # required
|
493
|
+
# time: Time.now,
|
494
|
+
# start_time: Time.now,
|
495
|
+
# end_time: Time.now,
|
496
|
+
# recurrence: "XmlStringMaxLen255",
|
497
|
+
# min_size: 1,
|
498
|
+
# max_size: 1,
|
499
|
+
# desired_capacity: 1,
|
500
|
+
# })
|
501
|
+
# @param [Hash] options ({})
|
502
|
+
# @option options [required, String] :scheduled_action_name
|
503
|
+
# The name of this scaling action.
|
504
|
+
# @option options [Time,DateTime,Date,Integer,String] :time
|
505
|
+
# This parameter is deprecated.
|
506
|
+
# @option options [Time,DateTime,Date,Integer,String] :start_time
|
507
|
+
# The time for this action to start, in "YYYY-MM-DDThh:mm:ssZ" format
|
508
|
+
# in UTC/GMT only (for example, `2014-06-01T00:00:00Z`).
|
509
|
+
#
|
510
|
+
# If you specify `Recurrence` and `StartTime`, Auto Scaling performs the
|
511
|
+
# action at this time, and then performs the action based on the
|
512
|
+
# specified recurrence.
|
513
|
+
#
|
514
|
+
# If you try to schedule your action in the past, Auto Scaling returns
|
515
|
+
# an error message.
|
516
|
+
# @option options [Time,DateTime,Date,Integer,String] :end_time
|
517
|
+
# The time for the recurring schedule to end. Auto Scaling does not
|
518
|
+
# perform the action after this time.
|
519
|
+
# @option options [String] :recurrence
|
520
|
+
# The recurring schedule for this action, in Unix cron syntax format.
|
521
|
+
# For more information, see [Cron][1] in Wikipedia.
|
522
|
+
#
|
523
|
+
#
|
524
|
+
#
|
525
|
+
# [1]: http://en.wikipedia.org/wiki/Cron
|
526
|
+
# @option options [Integer] :min_size
|
527
|
+
# The minimum size for the Auto Scaling group.
|
528
|
+
# @option options [Integer] :max_size
|
529
|
+
# The maximum size for the Auto Scaling group.
|
530
|
+
# @option options [Integer] :desired_capacity
|
531
|
+
# The number of EC2 instances that should be running in the group.
|
532
|
+
# @return [ScheduledAction]
|
533
|
+
def put_scheduled_update_group_action(options = {})
|
534
|
+
options = options.merge(auto_scaling_group_name: @name)
|
535
|
+
resp = @client.put_scheduled_update_group_action(options)
|
536
|
+
ScheduledAction.new(
|
537
|
+
name: options[:scheduled_action_name],
|
538
|
+
client: @client
|
539
|
+
)
|
540
|
+
end
|
541
|
+
|
542
|
+
# @example Request syntax with placeholder values
|
543
|
+
#
|
544
|
+
# auto_scaling_group.resume_processes({
|
545
|
+
# scaling_processes: ["XmlStringMaxLen255"],
|
546
|
+
# })
|
547
|
+
# @param [Hash] options ({})
|
548
|
+
# @option options [Array<String>] :scaling_processes
|
549
|
+
# One or more of the following processes. If you omit this parameter,
|
550
|
+
# all processes are specified.
|
551
|
+
#
|
552
|
+
# * `Launch`
|
553
|
+
#
|
554
|
+
# * `Terminate`
|
555
|
+
#
|
556
|
+
# * `HealthCheck`
|
557
|
+
#
|
558
|
+
# * `ReplaceUnhealthy`
|
559
|
+
#
|
560
|
+
# * `AZRebalance`
|
561
|
+
#
|
562
|
+
# * `AlarmNotification`
|
563
|
+
#
|
564
|
+
# * `ScheduledActions`
|
565
|
+
#
|
566
|
+
# * `AddToLoadBalancer`
|
567
|
+
# @return [EmptyStructure]
|
568
|
+
def resume_processes(options = {})
|
569
|
+
options = options.merge(auto_scaling_group_name: @name)
|
570
|
+
resp = @client.resume_processes(options)
|
571
|
+
resp.data
|
572
|
+
end
|
573
|
+
|
574
|
+
# @example Request syntax with placeholder values
|
575
|
+
#
|
576
|
+
# auto_scaling_group.set_desired_capacity({
|
577
|
+
# desired_capacity: 1, # required
|
578
|
+
# honor_cooldown: false,
|
579
|
+
# })
|
580
|
+
# @param [Hash] options ({})
|
581
|
+
# @option options [required, Integer] :desired_capacity
|
582
|
+
# The number of EC2 instances that should be running in the Auto Scaling
|
583
|
+
# group.
|
584
|
+
# @option options [Boolean] :honor_cooldown
|
585
|
+
# By default, `SetDesiredCapacity` overrides any cooldown period
|
586
|
+
# associated with the Auto Scaling group. Specify `True` to make Auto
|
587
|
+
# Scaling to wait for the cool-down period associated with the Auto
|
588
|
+
# Scaling group to complete before initiating a scaling activity to set
|
589
|
+
# your Auto Scaling group to its new capacity.
|
590
|
+
# @return [EmptyStructure]
|
591
|
+
def set_desired_capacity(options = {})
|
592
|
+
options = options.merge(auto_scaling_group_name: @name)
|
593
|
+
resp = @client.set_desired_capacity(options)
|
594
|
+
resp.data
|
595
|
+
end
|
596
|
+
|
597
|
+
# @example Request syntax with placeholder values
|
598
|
+
#
|
599
|
+
# auto_scaling_group.suspend_processes({
|
600
|
+
# scaling_processes: ["XmlStringMaxLen255"],
|
601
|
+
# })
|
602
|
+
# @param [Hash] options ({})
|
603
|
+
# @option options [Array<String>] :scaling_processes
|
604
|
+
# One or more of the following processes. If you omit this parameter,
|
605
|
+
# all processes are specified.
|
606
|
+
#
|
607
|
+
# * `Launch`
|
608
|
+
#
|
609
|
+
# * `Terminate`
|
610
|
+
#
|
611
|
+
# * `HealthCheck`
|
612
|
+
#
|
613
|
+
# * `ReplaceUnhealthy`
|
614
|
+
#
|
615
|
+
# * `AZRebalance`
|
616
|
+
#
|
617
|
+
# * `AlarmNotification`
|
618
|
+
#
|
619
|
+
# * `ScheduledActions`
|
620
|
+
#
|
621
|
+
# * `AddToLoadBalancer`
|
622
|
+
# @return [EmptyStructure]
|
623
|
+
def suspend_processes(options = {})
|
624
|
+
options = options.merge(auto_scaling_group_name: @name)
|
625
|
+
resp = @client.suspend_processes(options)
|
626
|
+
resp.data
|
627
|
+
end
|
628
|
+
|
629
|
+
# @example Request syntax with placeholder values
|
630
|
+
#
|
631
|
+
# autoscalinggroup = auto_scaling_group.update({
|
632
|
+
# launch_configuration_name: "ResourceName",
|
633
|
+
# min_size: 1,
|
634
|
+
# max_size: 1,
|
635
|
+
# desired_capacity: 1,
|
636
|
+
# default_cooldown: 1,
|
637
|
+
# availability_zones: ["XmlStringMaxLen255"],
|
638
|
+
# health_check_type: "XmlStringMaxLen32",
|
639
|
+
# health_check_grace_period: 1,
|
640
|
+
# placement_group: "XmlStringMaxLen255",
|
641
|
+
# vpc_zone_identifier: "XmlStringMaxLen2047",
|
642
|
+
# termination_policies: ["XmlStringMaxLen1600"],
|
643
|
+
# new_instances_protected_from_scale_in: false,
|
644
|
+
# })
|
645
|
+
# @param [Hash] options ({})
|
646
|
+
# @option options [String] :launch_configuration_name
|
647
|
+
# The name of the launch configuration.
|
648
|
+
# @option options [Integer] :min_size
|
649
|
+
# The minimum size of the Auto Scaling group.
|
650
|
+
# @option options [Integer] :max_size
|
651
|
+
# The maximum size of the Auto Scaling group.
|
652
|
+
# @option options [Integer] :desired_capacity
|
653
|
+
# The number of EC2 instances that should be running in the Auto Scaling
|
654
|
+
# group. This number must be greater than or equal to the minimum size
|
655
|
+
# of the group and less than or equal to the maximum size of the group.
|
656
|
+
# @option options [Integer] :default_cooldown
|
657
|
+
# The amount of time, in seconds, after a scaling activity completes
|
658
|
+
# before another scaling activity can start. The default is 300.
|
659
|
+
#
|
660
|
+
# For more information, see [Auto Scaling Cooldowns][1] in the *Auto
|
661
|
+
# Scaling User Guide*.
|
662
|
+
#
|
663
|
+
#
|
664
|
+
#
|
665
|
+
# [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/Cooldown.html
|
666
|
+
# @option options [Array<String>] :availability_zones
|
667
|
+
# One or more Availability Zones for the group.
|
668
|
+
# @option options [String] :health_check_type
|
669
|
+
# The service to use for the health checks. The valid values are `EC2`
|
670
|
+
# and `ELB`.
|
671
|
+
# @option options [Integer] :health_check_grace_period
|
672
|
+
# The amount of time, in seconds, that Auto Scaling waits before
|
673
|
+
# checking the health status of an EC2 instance that has come into
|
674
|
+
# service. The default is 0.
|
675
|
+
#
|
676
|
+
# For more information, see [Health Checks][1] in the *Auto Scaling User
|
677
|
+
# Guide*.
|
678
|
+
#
|
679
|
+
#
|
680
|
+
#
|
681
|
+
# [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/healthcheck.html
|
682
|
+
# @option options [String] :placement_group
|
683
|
+
# The name of the placement group into which you'll launch your
|
684
|
+
# instances, if any. For more information, see [Placement Groups][1] in
|
685
|
+
# the *Amazon Elastic Compute Cloud User Guide*.
|
686
|
+
#
|
687
|
+
#
|
688
|
+
#
|
689
|
+
# [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html
|
690
|
+
# @option options [String] :vpc_zone_identifier
|
691
|
+
# The ID of the subnet, if you are launching into a VPC. You can specify
|
692
|
+
# several subnets in a comma-separated list.
|
693
|
+
#
|
694
|
+
# When you specify `VPCZoneIdentifier` with `AvailabilityZones`, ensure
|
695
|
+
# that the subnets' Availability Zones match the values you specify for
|
696
|
+
# `AvailabilityZones`.
|
697
|
+
#
|
698
|
+
# For more information, see [Launching Auto Scaling Instances in a
|
699
|
+
# VPC][1] in the *Auto Scaling User Guide*.
|
700
|
+
#
|
701
|
+
#
|
702
|
+
#
|
703
|
+
# [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/asg-in-vpc.html
|
704
|
+
# @option options [Array<String>] :termination_policies
|
705
|
+
# A standalone termination policy or a list of termination policies used
|
706
|
+
# to select the instance to terminate. The policies are executed in the
|
707
|
+
# order that they are listed.
|
708
|
+
#
|
709
|
+
# For more information, see [Controlling Which Instances Auto Scaling
|
710
|
+
# Terminates During Scale In][1] in the *Auto Scaling User Guide*.
|
711
|
+
#
|
712
|
+
#
|
713
|
+
#
|
714
|
+
# [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/as-instance-termination.html
|
715
|
+
# @option options [Boolean] :new_instances_protected_from_scale_in
|
716
|
+
# Indicates whether newly launched instances are protected from
|
717
|
+
# termination by Auto Scaling when scaling in.
|
718
|
+
# @return [AutoScalingGroup]
|
719
|
+
def update(options = {})
|
720
|
+
options = options.merge(auto_scaling_group_name: @name)
|
721
|
+
resp = @client.update_auto_scaling_group(options)
|
722
|
+
AutoScalingGroup.new(
|
723
|
+
name: options[:auto_scaling_group_name],
|
724
|
+
client: @client
|
725
|
+
)
|
726
|
+
end
|
727
|
+
|
728
|
+
# @!group Associations
|
729
|
+
|
730
|
+
# @example Request syntax with placeholder values
|
731
|
+
#
|
732
|
+
# activities = auto_scaling_group.activities({
|
733
|
+
# activity_ids: ["XmlString"],
|
734
|
+
# })
|
735
|
+
# @param [Hash] options ({})
|
736
|
+
# @option options [Array<String>] :activity_ids
|
737
|
+
# The activity IDs of the desired scaling activities. If you omit this
|
738
|
+
# parameter, all activities for the past six weeks are described. If you
|
739
|
+
# specify an Auto Scaling group, the results are limited to that group.
|
740
|
+
# The list of requested activities cannot contain more than 50 items. If
|
741
|
+
# unknown activities are requested, they are ignored with no error.
|
742
|
+
# @return [Activity::Collection]
|
743
|
+
def activities(options = {})
|
744
|
+
batches = Enumerator.new do |y|
|
745
|
+
options = options.merge(auto_scaling_group_name: @name)
|
746
|
+
resp = @client.describe_scaling_activities(options)
|
747
|
+
resp.each_page do |page|
|
748
|
+
batch = []
|
749
|
+
page.data.activities.each do |a|
|
750
|
+
batch << Activity.new(
|
751
|
+
id: a.activity_id,
|
752
|
+
data: a,
|
753
|
+
client: @client
|
754
|
+
)
|
755
|
+
end
|
756
|
+
y.yield(batch)
|
757
|
+
end
|
758
|
+
end
|
759
|
+
Activity::Collection.new(batches)
|
760
|
+
end
|
761
|
+
|
762
|
+
# @return [Instance::Collection]
|
763
|
+
def instances
|
764
|
+
batch = []
|
765
|
+
data.instances.each do |i|
|
766
|
+
batch << Instance.new(
|
767
|
+
group_name: @name,
|
768
|
+
id: i.instance_id,
|
769
|
+
data: i,
|
770
|
+
client: @client
|
771
|
+
)
|
772
|
+
end
|
773
|
+
Instance::Collection.new([batch], size: batch.size)
|
774
|
+
end
|
775
|
+
|
776
|
+
# @return [LaunchConfiguration, nil]
|
777
|
+
def launch_configuration
|
778
|
+
if data.launch_configuration_name
|
779
|
+
LaunchConfiguration.new(
|
780
|
+
name: data.launch_configuration_name,
|
781
|
+
client: @client
|
782
|
+
)
|
783
|
+
else
|
784
|
+
nil
|
785
|
+
end
|
786
|
+
end
|
787
|
+
|
788
|
+
# @param [String] name
|
789
|
+
# @return [LifecycleHook]
|
790
|
+
def lifecycle_hook(name)
|
791
|
+
LifecycleHook.new(
|
792
|
+
group_name: @name,
|
793
|
+
name: name,
|
794
|
+
client: @client
|
795
|
+
)
|
796
|
+
end
|
797
|
+
|
798
|
+
# @example Request syntax with placeholder values
|
799
|
+
#
|
800
|
+
# lifecyclehooks = auto_scaling_group.lifecycle_hooks({
|
801
|
+
# lifecycle_hook_names: ["AsciiStringMaxLen255"],
|
802
|
+
# })
|
803
|
+
# @param [Hash] options ({})
|
804
|
+
# @option options [Array<String>] :lifecycle_hook_names
|
805
|
+
# The names of one or more lifecycle hooks. If you omit this parameter,
|
806
|
+
# all lifecycle hooks are described.
|
807
|
+
# @return [LifecycleHook::Collection]
|
808
|
+
def lifecycle_hooks(options = {})
|
809
|
+
batches = Enumerator.new do |y|
|
810
|
+
batch = []
|
811
|
+
options = options.merge(auto_scaling_group_name: @name)
|
812
|
+
resp = @client.describe_lifecycle_hooks(options)
|
813
|
+
resp.data.lifecycle_hooks.each do |l|
|
814
|
+
batch << LifecycleHook.new(
|
815
|
+
group_name: l.auto_scaling_group_name,
|
816
|
+
name: l.lifecycle_hook_name,
|
817
|
+
data: l,
|
818
|
+
client: @client
|
819
|
+
)
|
820
|
+
end
|
821
|
+
y.yield(batch)
|
822
|
+
end
|
823
|
+
LifecycleHook::Collection.new(batches)
|
824
|
+
end
|
825
|
+
|
826
|
+
# @param [String] name
|
827
|
+
# @return [LoadBalancer]
|
828
|
+
def load_balancer(name)
|
829
|
+
LoadBalancer.new(
|
830
|
+
group_name: @name,
|
831
|
+
name: name,
|
832
|
+
client: @client
|
833
|
+
)
|
834
|
+
end
|
835
|
+
|
836
|
+
# @example Request syntax with placeholder values
|
837
|
+
#
|
838
|
+
# loadbalancers = auto_scaling_group.load_balancers({
|
839
|
+
# next_token: "XmlString",
|
840
|
+
# max_records: 1,
|
841
|
+
# })
|
842
|
+
# @param [Hash] options ({})
|
843
|
+
# @option options [String] :next_token
|
844
|
+
# The token for the next set of items to return. (You received this
|
845
|
+
# token from a previous call.)
|
846
|
+
# @option options [Integer] :max_records
|
847
|
+
# The maximum number of items to return with this call.
|
848
|
+
# @return [LoadBalancer::Collection]
|
849
|
+
def load_balancers(options = {})
|
850
|
+
batches = Enumerator.new do |y|
|
851
|
+
batch = []
|
852
|
+
options = options.merge(auto_scaling_group_name: @name)
|
853
|
+
resp = @client.describe_load_balancers(options)
|
854
|
+
resp.data.load_balancers.each do |l|
|
855
|
+
batch << LoadBalancer.new(
|
856
|
+
group_name: @name,
|
857
|
+
name: l.load_balancer_name,
|
858
|
+
data: l,
|
859
|
+
client: @client
|
860
|
+
)
|
861
|
+
end
|
862
|
+
y.yield(batch)
|
863
|
+
end
|
864
|
+
LoadBalancer::Collection.new(batches)
|
865
|
+
end
|
866
|
+
|
867
|
+
# @example Request syntax with placeholder values
|
868
|
+
#
|
869
|
+
# notificationconfigurations = auto_scaling_group.notification_configurations()
|
870
|
+
# @param [Hash] options ({})
|
871
|
+
# @return [NotificationConfiguration::Collection]
|
872
|
+
def notification_configurations(options = {})
|
873
|
+
batches = Enumerator.new do |y|
|
874
|
+
options = Aws::Util.deep_merge(options, auto_scaling_group_names: [@name])
|
875
|
+
resp = @client.describe_notification_configurations(options)
|
876
|
+
resp.each_page do |page|
|
877
|
+
batch = []
|
878
|
+
page.data.notification_configurations.each do |n|
|
879
|
+
batch << NotificationConfiguration.new(
|
880
|
+
group_name: n.auto_scaling_group_name,
|
881
|
+
type: n.notification_type,
|
882
|
+
topic_arn: n.topic_arn,
|
883
|
+
data: n,
|
884
|
+
client: @client
|
885
|
+
)
|
886
|
+
end
|
887
|
+
y.yield(batch)
|
888
|
+
end
|
889
|
+
end
|
890
|
+
NotificationConfiguration::Collection.new(batches)
|
891
|
+
end
|
892
|
+
|
893
|
+
# @example Request syntax with placeholder values
|
894
|
+
#
|
895
|
+
# policies = auto_scaling_group.policies({
|
896
|
+
# policy_names: ["ResourceName"],
|
897
|
+
# policy_types: ["XmlStringMaxLen64"],
|
898
|
+
# })
|
899
|
+
# @param [Hash] options ({})
|
900
|
+
# @option options [Array<String>] :policy_names
|
901
|
+
# One or more policy names or policy ARNs to be described. If you omit
|
902
|
+
# this parameter, all policy names are described. If an group name is
|
903
|
+
# provided, the results are limited to that group. This list is limited
|
904
|
+
# to 50 items. If you specify an unknown policy name, it is ignored with
|
905
|
+
# no error.
|
906
|
+
# @option options [Array<String>] :policy_types
|
907
|
+
# One or more policy types. Valid values are `SimpleScaling` and
|
908
|
+
# `StepScaling`.
|
909
|
+
# @return [ScalingPolicy::Collection]
|
910
|
+
def policies(options = {})
|
911
|
+
batches = Enumerator.new do |y|
|
912
|
+
options = options.merge(auto_scaling_group_name: @name)
|
913
|
+
resp = @client.describe_policies(options)
|
914
|
+
resp.each_page do |page|
|
915
|
+
batch = []
|
916
|
+
page.data.scaling_policies.each do |s|
|
917
|
+
batch << ScalingPolicy.new(
|
918
|
+
name: s.policy_name,
|
919
|
+
data: s,
|
920
|
+
client: @client
|
921
|
+
)
|
922
|
+
end
|
923
|
+
y.yield(batch)
|
924
|
+
end
|
925
|
+
end
|
926
|
+
ScalingPolicy::Collection.new(batches)
|
927
|
+
end
|
928
|
+
|
929
|
+
# @example Request syntax with placeholder values
|
930
|
+
#
|
931
|
+
# scheduledactions = auto_scaling_group.scheduled_actions({
|
932
|
+
# scheduled_action_names: ["ResourceName"],
|
933
|
+
# start_time: Time.now,
|
934
|
+
# end_time: Time.now,
|
935
|
+
# })
|
936
|
+
# @param [Hash] options ({})
|
937
|
+
# @option options [Array<String>] :scheduled_action_names
|
938
|
+
# Describes one or more scheduled actions. If you omit this parameter,
|
939
|
+
# all scheduled actions are described. If you specify an unknown
|
940
|
+
# scheduled action, it is ignored with no error.
|
941
|
+
#
|
942
|
+
# You can describe up to a maximum of 50 instances with a single call.
|
943
|
+
# If there are more items to return, the call returns a token. To get
|
944
|
+
# the next set of items, repeat the call with the returned token.
|
945
|
+
# @option options [Time,DateTime,Date,Integer,String] :start_time
|
946
|
+
# The earliest scheduled start time to return. If scheduled action names
|
947
|
+
# are provided, this parameter is ignored.
|
948
|
+
# @option options [Time,DateTime,Date,Integer,String] :end_time
|
949
|
+
# The latest scheduled start time to return. If scheduled action names
|
950
|
+
# are provided, this parameter is ignored.
|
951
|
+
# @return [ScheduledAction::Collection]
|
952
|
+
def scheduled_actions(options = {})
|
953
|
+
batches = Enumerator.new do |y|
|
954
|
+
options = options.merge(auto_scaling_group_name: @name)
|
955
|
+
resp = @client.describe_scheduled_actions(options)
|
956
|
+
resp.each_page do |page|
|
957
|
+
batch = []
|
958
|
+
page.data.scheduled_update_group_actions.each do |s|
|
959
|
+
batch << ScheduledAction.new(
|
960
|
+
name: s.scheduled_action_name,
|
961
|
+
data: s,
|
962
|
+
client: @client
|
963
|
+
)
|
964
|
+
end
|
965
|
+
y.yield(batch)
|
966
|
+
end
|
967
|
+
end
|
968
|
+
ScheduledAction::Collection.new(batches)
|
969
|
+
end
|
970
|
+
|
971
|
+
# @param [String] key
|
972
|
+
# @return [Tag]
|
973
|
+
def tag(key)
|
974
|
+
Tag.new(
|
975
|
+
key: key,
|
976
|
+
resource_id: @name,
|
977
|
+
resource_type: "auto-scaling-group",
|
978
|
+
client: @client
|
979
|
+
)
|
980
|
+
end
|
981
|
+
|
982
|
+
# @return [Tag::Collection]
|
983
|
+
def tags
|
984
|
+
batch = []
|
985
|
+
data.tags.each do |t|
|
986
|
+
batch << Tag.new(
|
987
|
+
key: t.key,
|
988
|
+
resource_id: t.resource_id,
|
989
|
+
resource_type: t.resource_type,
|
990
|
+
data: t,
|
991
|
+
client: @client
|
992
|
+
)
|
993
|
+
end
|
994
|
+
Tag::Collection.new([batch], size: batch.size)
|
995
|
+
end
|
996
|
+
|
997
|
+
# @deprecated
|
998
|
+
# @api private
|
999
|
+
def identifiers
|
1000
|
+
{ name: @name }
|
1001
|
+
end
|
1002
|
+
deprecated(:identifiers)
|
1003
|
+
|
1004
|
+
private
|
1005
|
+
|
1006
|
+
def extract_name(args, options)
|
1007
|
+
value = args[0] || options.delete(:name)
|
1008
|
+
case value
|
1009
|
+
when String then value
|
1010
|
+
when nil then raise ArgumentError, "missing required option :name"
|
1011
|
+
else
|
1012
|
+
msg = "expected :name to be a String, got #{value.class}"
|
1013
|
+
raise ArgumentError, msg
|
1014
|
+
end
|
1015
|
+
end
|
1016
|
+
|
1017
|
+
def yield_waiter_and_warn(waiter, &block)
|
1018
|
+
if !@waiter_block_warned
|
1019
|
+
msg = "pass options to configure the waiter; "
|
1020
|
+
msg << "yielding the waiter is deprecated"
|
1021
|
+
warn(msg)
|
1022
|
+
@waiter_block_warned = true
|
1023
|
+
end
|
1024
|
+
yield(waiter.waiter)
|
1025
|
+
end
|
1026
|
+
|
1027
|
+
def separate_params_and_options(options)
|
1028
|
+
opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
|
1029
|
+
waiter_opts = {}
|
1030
|
+
waiter_params = {}
|
1031
|
+
options.each_pair do |key, value|
|
1032
|
+
if opts.include?(key)
|
1033
|
+
waiter_opts[key] = value
|
1034
|
+
else
|
1035
|
+
waiter_params[key] = value
|
1036
|
+
end
|
1037
|
+
end
|
1038
|
+
waiter_opts[:client] ||= @client
|
1039
|
+
[waiter_opts, waiter_params]
|
1040
|
+
end
|
1041
|
+
|
1042
|
+
class Collection < Aws::Resources::Collection; end
|
1043
|
+
end
|
1044
|
+
end
|
1045
|
+
end
|