aws-sdk-autoscaling 1.0.0.rc1 → 1.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,258 +1,256 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
3
+ # This file is generated. See the contributing guide for more information:
4
4
  # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
5
  #
6
6
  # WARNING ABOUT GENERATED CODE
7
7
 
8
- module Aws
9
- module AutoScaling
10
- class ScalingPolicy
8
+ module Aws::AutoScaling
9
+ class ScalingPolicy
11
10
 
12
- extend Aws::Deprecations
11
+ extend Aws::Deprecations
13
12
 
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
13
+ # @overload def initialize(name, options = {})
14
+ # @param [String] name
15
+ # @option options [Client] :client
16
+ # @overload def initialize(options = {})
17
+ # @option options [required, String] :name
18
+ # @option options [Client] :client
19
+ def initialize(*args)
20
+ options = Hash === args.last ? args.pop.dup : {}
21
+ @name = extract_name(args, options)
22
+ @data = options.delete(:data)
23
+ @client = options.delete(:client) || Client.new(options)
24
+ end
26
25
 
27
- # @!group Read-Only Attributes
26
+ # @!group Read-Only Attributes
28
27
 
29
- # @return [String]
30
- def name
31
- @name
32
- end
33
- alias :policy_name :name
28
+ # @return [String]
29
+ def name
30
+ @name
31
+ end
32
+ alias :policy_name :name
34
33
 
35
- # The name of the Auto Scaling group associated with this scaling
36
- # policy.
37
- # @return [String]
38
- def auto_scaling_group_name
39
- data.auto_scaling_group_name
40
- end
34
+ # The name of the Auto Scaling group associated with this scaling
35
+ # policy.
36
+ # @return [String]
37
+ def auto_scaling_group_name
38
+ data.auto_scaling_group_name
39
+ end
41
40
 
42
- # The Amazon Resource Name (ARN) of the policy.
43
- # @return [String]
44
- def policy_arn
45
- data.policy_arn
46
- end
41
+ # The Amazon Resource Name (ARN) of the policy.
42
+ # @return [String]
43
+ def policy_arn
44
+ data.policy_arn
45
+ end
47
46
 
48
- # The policy type. Valid values are `SimpleScaling` and `StepScaling`.
49
- # @return [String]
50
- def policy_type
51
- data.policy_type
52
- end
47
+ # The policy type. Valid values are `SimpleScaling` and `StepScaling`.
48
+ # @return [String]
49
+ def policy_type
50
+ data.policy_type
51
+ end
53
52
 
54
- # The adjustment type, which specifies how `ScalingAdjustment` is
55
- # interpreted. Valid values are `ChangeInCapacity`, `ExactCapacity`, and
56
- # `PercentChangeInCapacity`.
57
- # @return [String]
58
- def adjustment_type
59
- data.adjustment_type
60
- end
53
+ # The adjustment type, which specifies how `ScalingAdjustment` is
54
+ # interpreted. Valid values are `ChangeInCapacity`, `ExactCapacity`, and
55
+ # `PercentChangeInCapacity`.
56
+ # @return [String]
57
+ def adjustment_type
58
+ data.adjustment_type
59
+ end
61
60
 
62
- # Available for backward compatibility. Use `MinAdjustmentMagnitude`
63
- # instead.
64
- # @return [Integer]
65
- def min_adjustment_step
66
- data.min_adjustment_step
67
- end
61
+ # Available for backward compatibility. Use `MinAdjustmentMagnitude`
62
+ # instead.
63
+ # @return [Integer]
64
+ def min_adjustment_step
65
+ data.min_adjustment_step
66
+ end
68
67
 
69
- # The minimum number of instances to scale. If the value of
70
- # `AdjustmentType` is `PercentChangeInCapacity`, the scaling policy
71
- # changes the `DesiredCapacity` of the Auto Scaling group by at least
72
- # this many instances. Otherwise, the error is `ValidationError`.
73
- # @return [Integer]
74
- def min_adjustment_magnitude
75
- data.min_adjustment_magnitude
76
- end
68
+ # The minimum number of instances to scale. If the value of
69
+ # `AdjustmentType` is `PercentChangeInCapacity`, the scaling policy
70
+ # changes the `DesiredCapacity` of the Auto Scaling group by at least
71
+ # this many instances. Otherwise, the error is `ValidationError`.
72
+ # @return [Integer]
73
+ def min_adjustment_magnitude
74
+ data.min_adjustment_magnitude
75
+ end
77
76
 
78
- # The amount by which to scale, based on the specified adjustment type.
79
- # A positive value adds to the current capacity while a negative number
80
- # removes from the current capacity.
81
- # @return [Integer]
82
- def scaling_adjustment
83
- data.scaling_adjustment
84
- end
77
+ # The amount by which to scale, based on the specified adjustment type.
78
+ # A positive value adds to the current capacity while a negative number
79
+ # removes from the current capacity.
80
+ # @return [Integer]
81
+ def scaling_adjustment
82
+ data.scaling_adjustment
83
+ end
85
84
 
86
- # The amount of time, in seconds, after a scaling activity completes
87
- # before any further trigger-related scaling activities can start.
88
- # @return [Integer]
89
- def cooldown
90
- data.cooldown
91
- end
85
+ # The amount of time, in seconds, after a scaling activity completes
86
+ # before any further trigger-related scaling activities can start.
87
+ # @return [Integer]
88
+ def cooldown
89
+ data.cooldown
90
+ end
92
91
 
93
- # A set of adjustments that enable you to scale based on the size of the
94
- # alarm breach.
95
- # @return [Array<Types::StepAdjustment>]
96
- def step_adjustments
97
- data.step_adjustments
98
- end
92
+ # A set of adjustments that enable you to scale based on the size of the
93
+ # alarm breach.
94
+ # @return [Array<Types::StepAdjustment>]
95
+ def step_adjustments
96
+ data.step_adjustments
97
+ end
99
98
 
100
- # The aggregation type for the CloudWatch metrics. Valid values are
101
- # `Minimum`, `Maximum`, and `Average`.
102
- # @return [String]
103
- def metric_aggregation_type
104
- data.metric_aggregation_type
105
- end
99
+ # The aggregation type for the CloudWatch metrics. Valid values are
100
+ # `Minimum`, `Maximum`, and `Average`.
101
+ # @return [String]
102
+ def metric_aggregation_type
103
+ data.metric_aggregation_type
104
+ end
106
105
 
107
- # The estimated time, in seconds, until a newly launched instance can
108
- # contribute to the CloudWatch metrics.
109
- # @return [Integer]
110
- def estimated_instance_warmup
111
- data.estimated_instance_warmup
112
- end
106
+ # The estimated time, in seconds, until a newly launched instance can
107
+ # contribute to the CloudWatch metrics.
108
+ # @return [Integer]
109
+ def estimated_instance_warmup
110
+ data.estimated_instance_warmup
111
+ end
113
112
 
114
- # The CloudWatch alarms related to the policy.
115
- # @return [Array<Types::Alarm>]
116
- def alarms
117
- data.alarms
118
- end
113
+ # The CloudWatch alarms related to the policy.
114
+ # @return [Array<Types::Alarm>]
115
+ def alarms
116
+ data.alarms
117
+ end
119
118
 
120
- # @!endgroup
119
+ # @!endgroup
121
120
 
122
- # @return [Client]
123
- def client
124
- @client
125
- end
121
+ # @return [Client]
122
+ def client
123
+ @client
124
+ end
126
125
 
127
- # Loads, or reloads {#data} for the current {ScalingPolicy}.
128
- # Returns `self` making it possible to chain methods.
129
- #
130
- # scaling_policy.reload.data
131
- #
132
- # @return [self]
133
- def load
134
- resp = @client.describe_policies(policy_names: [@name])
135
- @data = resp.scalingpolicies[0]
136
- self
137
- end
138
- alias :reload :load
126
+ # Loads, or reloads {#data} for the current {ScalingPolicy}.
127
+ # Returns `self` making it possible to chain methods.
128
+ #
129
+ # scaling_policy.reload.data
130
+ #
131
+ # @return [self]
132
+ def load
133
+ resp = @client.describe_policies(policy_names: [@name])
134
+ @data = resp.scalingpolicies[0]
135
+ self
136
+ end
137
+ alias :reload :load
139
138
 
140
- # @return [Types::ScalingPolicy]
141
- # Returns the data for this {ScalingPolicy}. Calls
142
- # {Client#describe_policies} if {#data_loaded?} is `false`.
143
- def data
144
- load unless @data
145
- @data
146
- end
139
+ # @return [Types::ScalingPolicy]
140
+ # Returns the data for this {ScalingPolicy}. Calls
141
+ # {Client#describe_policies} if {#data_loaded?} is `false`.
142
+ def data
143
+ load unless @data
144
+ @data
145
+ end
147
146
 
148
- # @return [Boolean]
149
- # Returns `true` if this resource is loaded. Accessing attributes or
150
- # {#data} on an unloaded resource will trigger a call to {#load}.
151
- def data_loaded?
152
- !!@data
153
- end
147
+ # @return [Boolean]
148
+ # Returns `true` if this resource is loaded. Accessing attributes or
149
+ # {#data} on an unloaded resource will trigger a call to {#load}.
150
+ def data_loaded?
151
+ !!@data
152
+ end
154
153
 
155
- # @!group Actions
154
+ # @!group Actions
156
155
 
157
- # @example Request syntax with placeholder values
158
- #
159
- # scaling_policy.delete({
160
- # auto_scaling_group_name: "ResourceName",
161
- # })
162
- # @param [Hash] options ({})
163
- # @option options [String] :auto_scaling_group_name
164
- # The name of the Auto Scaling group.
165
- # @return [EmptyStructure]
166
- def delete(options = {})
167
- options = options.merge(policy_name: @name)
168
- resp = @client.delete_policy(options)
169
- resp.data
170
- end
156
+ # @example Request syntax with placeholder values
157
+ #
158
+ # scaling_policy.delete({
159
+ # auto_scaling_group_name: "ResourceName",
160
+ # })
161
+ # @param [Hash] options ({})
162
+ # @option options [String] :auto_scaling_group_name
163
+ # The name of the Auto Scaling group.
164
+ # @return [EmptyStructure]
165
+ def delete(options = {})
166
+ options = options.merge(policy_name: @name)
167
+ resp = @client.delete_policy(options)
168
+ resp.data
169
+ end
171
170
 
172
- # @example Request syntax with placeholder values
173
- #
174
- # scaling_policy.execute({
175
- # auto_scaling_group_name: "ResourceName",
176
- # honor_cooldown: false,
177
- # metric_value: 1.0,
178
- # breach_threshold: 1.0,
179
- # })
180
- # @param [Hash] options ({})
181
- # @option options [String] :auto_scaling_group_name
182
- # The name or Amazon Resource Name (ARN) of the Auto Scaling group.
183
- # @option options [Boolean] :honor_cooldown
184
- # If this parameter is true, Auto Scaling waits for the cooldown period
185
- # to complete before executing the policy. Otherwise, Auto Scaling
186
- # executes the policy without waiting for the cooldown period to
187
- # complete.
188
- #
189
- # This parameter is not supported if the policy type is `StepScaling`.
190
- #
191
- # For more information, see [Auto Scaling Cooldowns][1] in the *Auto
192
- # Scaling User Guide*.
193
- #
194
- #
195
- #
196
- # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/Cooldown.html
197
- # @option options [Float] :metric_value
198
- # The metric value to compare to `BreachThreshold`. This enables you to
199
- # execute a policy of type `StepScaling` and determine which step
200
- # adjustment to use. For example, if the breach threshold is 50 and you
201
- # want to use a step adjustment with a lower bound of 0 and an upper
202
- # bound of 10, you can set the metric value to 59.
203
- #
204
- # If you specify a metric value that doesn't correspond to a step
205
- # adjustment for the policy, the call returns an error.
206
- #
207
- # This parameter is required if the policy type is `StepScaling` and not
208
- # supported otherwise.
209
- # @option options [Float] :breach_threshold
210
- # The breach threshold for the alarm.
211
- #
212
- # This parameter is required if the policy type is `StepScaling` and not
213
- # supported otherwise.
214
- # @return [EmptyStructure]
215
- def execute(options = {})
216
- options = options.merge(policy_name: @name)
217
- resp = @client.execute_policy(options)
218
- resp.data
219
- end
171
+ # @example Request syntax with placeholder values
172
+ #
173
+ # scaling_policy.execute({
174
+ # auto_scaling_group_name: "ResourceName",
175
+ # honor_cooldown: false,
176
+ # metric_value: 1.0,
177
+ # breach_threshold: 1.0,
178
+ # })
179
+ # @param [Hash] options ({})
180
+ # @option options [String] :auto_scaling_group_name
181
+ # The name or Amazon Resource Name (ARN) of the Auto Scaling group.
182
+ # @option options [Boolean] :honor_cooldown
183
+ # If this parameter is true, Auto Scaling waits for the cooldown period
184
+ # to complete before executing the policy. Otherwise, Auto Scaling
185
+ # executes the policy without waiting for the cooldown period to
186
+ # complete.
187
+ #
188
+ # This parameter is not supported if the policy type is `StepScaling`.
189
+ #
190
+ # For more information, see [Auto Scaling Cooldowns][1] in the *Auto
191
+ # Scaling User Guide*.
192
+ #
193
+ #
194
+ #
195
+ # [1]: http://docs.aws.amazon.com/autoscaling/latest/userguide/Cooldown.html
196
+ # @option options [Float] :metric_value
197
+ # The metric value to compare to `BreachThreshold`. This enables you to
198
+ # execute a policy of type `StepScaling` and determine which step
199
+ # adjustment to use. For example, if the breach threshold is 50 and you
200
+ # want to use a step adjustment with a lower bound of 0 and an upper
201
+ # bound of 10, you can set the metric value to 59.
202
+ #
203
+ # If you specify a metric value that doesn't correspond to a step
204
+ # adjustment for the policy, the call returns an error.
205
+ #
206
+ # This parameter is required if the policy type is `StepScaling` and not
207
+ # supported otherwise.
208
+ # @option options [Float] :breach_threshold
209
+ # The breach threshold for the alarm.
210
+ #
211
+ # This parameter is required if the policy type is `StepScaling` and not
212
+ # supported otherwise.
213
+ # @return [EmptyStructure]
214
+ def execute(options = {})
215
+ options = options.merge(policy_name: @name)
216
+ resp = @client.execute_policy(options)
217
+ resp.data
218
+ end
220
219
 
221
- # @!group Associations
220
+ # @!group Associations
222
221
 
223
- # @return [AutoScalingGroup, nil]
224
- def group
225
- if data.auto_scaling_group_name
226
- AutoScalingGroup.new(
227
- name: data.auto_scaling_group_name,
228
- client: @client
229
- )
230
- else
231
- nil
232
- end
222
+ # @return [AutoScalingGroup, nil]
223
+ def group
224
+ if data.auto_scaling_group_name
225
+ AutoScalingGroup.new(
226
+ name: data.auto_scaling_group_name,
227
+ client: @client
228
+ )
229
+ else
230
+ nil
233
231
  end
232
+ end
234
233
 
235
- # @deprecated
236
- # @api private
237
- def identifiers
238
- { name: @name }
239
- end
240
- deprecated(:identifiers)
234
+ # @deprecated
235
+ # @api private
236
+ def identifiers
237
+ { name: @name }
238
+ end
239
+ deprecated(:identifiers)
241
240
 
242
- private
241
+ private
243
242
 
244
- def extract_name(args, options)
245
- value = args[0] || options.delete(:name)
246
- case value
247
- when String then value
248
- when nil then raise ArgumentError, "missing required option :name"
249
- else
250
- msg = "expected :name to be a String, got #{value.class}"
251
- raise ArgumentError, msg
252
- end
243
+ def extract_name(args, options)
244
+ value = args[0] || options.delete(:name)
245
+ case value
246
+ when String then value
247
+ when nil then raise ArgumentError, "missing required option :name"
248
+ else
249
+ msg = "expected :name to be a String, got #{value.class}"
250
+ raise ArgumentError, msg
253
251
  end
254
-
255
- class Collection < Aws::Resources::Collection; end
256
252
  end
253
+
254
+ class Collection < Aws::Resources::Collection; end
257
255
  end
258
256
  end