aws-sdk-cloudwatch 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws-sdk-cloudwatch.rb +1 -1
- data/lib/aws-sdk-cloudwatch/alarm.rb +121 -26
- data/lib/aws-sdk-cloudwatch/client.rb +1 -1
- data/lib/aws-sdk-cloudwatch/metric.rb +96 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 908663d3ebfefebfab82ffd7ad6adf6d0428c3d6
|
4
|
+
data.tar.gz: fd8affb66effb122a2e0c07e8bd14d1c0dd91a5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dafde20f958c1af6019f1a1065d4d69aa88002a5adc0f4427498d5efbf857a883b2f25d88974c0f371f3175cba6f8c5a80161bc2f56c476ff81f5089df9c509
|
7
|
+
data.tar.gz: 4e00ad385dde879c99dd658bbb51b21e5eea00fb00455f1833302f2988b3868b79490c73aa546892b53e87b5116cc27426fecf55a3a8bbf727f7e682be042e92
|
data/lib/aws-sdk-cloudwatch.rb
CHANGED
@@ -34,26 +34,26 @@ module Aws::CloudWatch
|
|
34
34
|
# The Amazon Resource Name (ARN) of the alarm.
|
35
35
|
# @return [String]
|
36
36
|
def alarm_arn
|
37
|
-
data
|
37
|
+
data[:alarm_arn]
|
38
38
|
end
|
39
39
|
|
40
40
|
# The description of the alarm.
|
41
41
|
# @return [String]
|
42
42
|
def alarm_description
|
43
|
-
data
|
43
|
+
data[:alarm_description]
|
44
44
|
end
|
45
45
|
|
46
46
|
# The time stamp of the last update to the alarm configuration.
|
47
47
|
# @return [Time]
|
48
48
|
def alarm_configuration_updated_timestamp
|
49
|
-
data
|
49
|
+
data[:alarm_configuration_updated_timestamp]
|
50
50
|
end
|
51
51
|
|
52
52
|
# Indicates whether actions should be executed during any changes to the
|
53
53
|
# alarm state.
|
54
54
|
# @return [Boolean]
|
55
55
|
def actions_enabled
|
56
|
-
data
|
56
|
+
data[:actions_enabled]
|
57
57
|
end
|
58
58
|
|
59
59
|
# The actions to execute when this alarm transitions to the `OK` state
|
@@ -61,7 +61,7 @@ module Aws::CloudWatch
|
|
61
61
|
# Name (ARN).
|
62
62
|
# @return [Array<String>]
|
63
63
|
def ok_actions
|
64
|
-
data
|
64
|
+
data[:ok_actions]
|
65
65
|
end
|
66
66
|
|
67
67
|
# The actions to execute when this alarm transitions to the `ALARM`
|
@@ -69,7 +69,7 @@ module Aws::CloudWatch
|
|
69
69
|
# Resource Name (ARN).
|
70
70
|
# @return [Array<String>]
|
71
71
|
def alarm_actions
|
72
|
-
data
|
72
|
+
data[:alarm_actions]
|
73
73
|
end
|
74
74
|
|
75
75
|
# The actions to execute when this alarm transitions to the
|
@@ -77,88 +77,88 @@ module Aws::CloudWatch
|
|
77
77
|
# specified as an Amazon Resource Name (ARN).
|
78
78
|
# @return [Array<String>]
|
79
79
|
def insufficient_data_actions
|
80
|
-
data
|
80
|
+
data[:insufficient_data_actions]
|
81
81
|
end
|
82
82
|
|
83
83
|
# The state value for the alarm.
|
84
84
|
# @return [String]
|
85
85
|
def state_value
|
86
|
-
data
|
86
|
+
data[:state_value]
|
87
87
|
end
|
88
88
|
|
89
89
|
# An explanation for the alarm state, in text format.
|
90
90
|
# @return [String]
|
91
91
|
def state_reason
|
92
|
-
data
|
92
|
+
data[:state_reason]
|
93
93
|
end
|
94
94
|
|
95
95
|
# An explanation for the alarm state, in JSON format.
|
96
96
|
# @return [String]
|
97
97
|
def state_reason_data
|
98
|
-
data
|
98
|
+
data[:state_reason_data]
|
99
99
|
end
|
100
100
|
|
101
101
|
# The time stamp of the last update to the alarm state.
|
102
102
|
# @return [Time]
|
103
103
|
def state_updated_timestamp
|
104
|
-
data
|
104
|
+
data[:state_updated_timestamp]
|
105
105
|
end
|
106
106
|
|
107
107
|
# The name of the metric associated with the alarm.
|
108
108
|
# @return [String]
|
109
109
|
def metric_name
|
110
|
-
data
|
110
|
+
data[:metric_name]
|
111
111
|
end
|
112
112
|
|
113
113
|
# The namespace of the metric associated with the alarm.
|
114
114
|
# @return [String]
|
115
115
|
def namespace
|
116
|
-
data
|
116
|
+
data[:namespace]
|
117
117
|
end
|
118
118
|
|
119
119
|
# The statistic for the metric associated with the alarm, other than
|
120
120
|
# percentile. For percentile statistics, use `ExtendedStatistic`.
|
121
121
|
# @return [String]
|
122
122
|
def statistic
|
123
|
-
data
|
123
|
+
data[:statistic]
|
124
124
|
end
|
125
125
|
|
126
126
|
# The percentile statistic for the metric associated with the alarm.
|
127
127
|
# Specify a value between p0.0 and p100.
|
128
128
|
# @return [String]
|
129
129
|
def extended_statistic
|
130
|
-
data
|
130
|
+
data[:extended_statistic]
|
131
131
|
end
|
132
132
|
|
133
133
|
# The dimensions for the metric associated with the alarm.
|
134
134
|
# @return [Array<Types::Dimension>]
|
135
135
|
def dimensions
|
136
|
-
data
|
136
|
+
data[:dimensions]
|
137
137
|
end
|
138
138
|
|
139
139
|
# The period, in seconds, over which the statistic is applied.
|
140
140
|
# @return [Integer]
|
141
141
|
def period
|
142
|
-
data
|
142
|
+
data[:period]
|
143
143
|
end
|
144
144
|
|
145
145
|
# The unit of the metric associated with the alarm.
|
146
146
|
# @return [String]
|
147
147
|
def unit
|
148
|
-
data
|
148
|
+
data[:unit]
|
149
149
|
end
|
150
150
|
|
151
151
|
# The number of periods over which data is compared to the specified
|
152
152
|
# threshold.
|
153
153
|
# @return [Integer]
|
154
154
|
def evaluation_periods
|
155
|
-
data
|
155
|
+
data[:evaluation_periods]
|
156
156
|
end
|
157
157
|
|
158
158
|
# The value to compare with the specified statistic.
|
159
159
|
# @return [Float]
|
160
160
|
def threshold
|
161
|
-
data
|
161
|
+
data[:threshold]
|
162
162
|
end
|
163
163
|
|
164
164
|
# The arithmetic operation to use when comparing the specified statistic
|
@@ -166,14 +166,14 @@ module Aws::CloudWatch
|
|
166
166
|
# operand.
|
167
167
|
# @return [String]
|
168
168
|
def comparison_operator
|
169
|
-
data
|
169
|
+
data[:comparison_operator]
|
170
170
|
end
|
171
171
|
|
172
172
|
# Sets how this alarm is to handle missing data points. If this
|
173
173
|
# parameter is omitted, the default behavior of `missing` is used.
|
174
174
|
# @return [String]
|
175
175
|
def treat_missing_data
|
176
|
-
data
|
176
|
+
data[:treat_missing_data]
|
177
177
|
end
|
178
178
|
|
179
179
|
# Used only for alarms based on percentiles. If `ignore`, the alarm
|
@@ -183,7 +183,7 @@ module Aws::CloudWatch
|
|
183
183
|
# matter how many data points are available.
|
184
184
|
# @return [String]
|
185
185
|
def evaluate_low_sample_count_percentile
|
186
|
-
data
|
186
|
+
data[:evaluate_low_sample_count_percentile]
|
187
187
|
end
|
188
188
|
|
189
189
|
# @!endgroup
|
@@ -252,6 +252,101 @@ module Aws::CloudWatch
|
|
252
252
|
})
|
253
253
|
end
|
254
254
|
|
255
|
+
# @deprecated Use [Aws::CloudWatch::Client] #wait_until instead
|
256
|
+
#
|
257
|
+
# Waiter polls an API operation until a resource enters a desired
|
258
|
+
# state.
|
259
|
+
#
|
260
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
261
|
+
#
|
262
|
+
# ## Basic Usage
|
263
|
+
#
|
264
|
+
# Waiter will polls until it is successful, it fails by
|
265
|
+
# entering a terminal state, or until a maximum number of attempts
|
266
|
+
# are made.
|
267
|
+
#
|
268
|
+
# # polls in a loop until condition is true
|
269
|
+
# resource.wait_until(options) {|resource| condition}
|
270
|
+
#
|
271
|
+
# ## Example
|
272
|
+
#
|
273
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
274
|
+
#
|
275
|
+
# ## Configuration
|
276
|
+
#
|
277
|
+
# You can configure the maximum number of polling attempts, and the
|
278
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
279
|
+
# by passing a block to {#wait_until}:
|
280
|
+
#
|
281
|
+
# # poll for ~25 seconds
|
282
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
283
|
+
#
|
284
|
+
# ## Callbacks
|
285
|
+
#
|
286
|
+
# You can be notified before each polling attempt and before each
|
287
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
288
|
+
# it will terminate the waiter.
|
289
|
+
#
|
290
|
+
# started_at = Time.now
|
291
|
+
# # poll for 1 hour, instead of a number of attempts
|
292
|
+
# proc = Proc.new do |attempts, response|
|
293
|
+
# throw :failure if Time.now - started_at > 3600
|
294
|
+
# end
|
295
|
+
#
|
296
|
+
# # disable max attempts
|
297
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
298
|
+
#
|
299
|
+
# ## Handling Errors
|
300
|
+
#
|
301
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
302
|
+
# fails, it raises an error.
|
303
|
+
#
|
304
|
+
# begin
|
305
|
+
# resource.wait_until(...)
|
306
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
307
|
+
# # resource did not enter the desired state in time
|
308
|
+
# end
|
309
|
+
#
|
310
|
+
#
|
311
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
312
|
+
#
|
313
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
314
|
+
# because the waiter has entered a state that it will not transition
|
315
|
+
# out of, preventing success.
|
316
|
+
#
|
317
|
+
# yet successful.
|
318
|
+
#
|
319
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
320
|
+
# while polling for a resource that is not expected.
|
321
|
+
#
|
322
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
323
|
+
#
|
324
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
325
|
+
# attempts
|
326
|
+
# @option options [Integer] :delay (10) Delay between each
|
327
|
+
# attempt in seconds
|
328
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
329
|
+
# invoked before each attempt
|
330
|
+
# @option options [Proc] :before_wait (nil) Callback
|
331
|
+
# invoked before each wait
|
332
|
+
# @return [Resource] if the waiter was successful
|
333
|
+
def wait_until(options = {}, &block)
|
334
|
+
self_copy = self.dup
|
335
|
+
attempts = 0
|
336
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
337
|
+
options[:delay] ||= 10
|
338
|
+
options[:poller] = Proc.new do
|
339
|
+
attempts += 1
|
340
|
+
if block.call(self_copy)
|
341
|
+
[:success, self_copy]
|
342
|
+
else
|
343
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
344
|
+
:retry
|
345
|
+
end
|
346
|
+
end
|
347
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
348
|
+
end
|
349
|
+
|
255
350
|
# @!group Actions
|
256
351
|
|
257
352
|
# @example Request syntax with placeholder values
|
@@ -342,10 +437,10 @@ module Aws::CloudWatch
|
|
342
437
|
|
343
438
|
# @return [Metric, nil]
|
344
439
|
def metric
|
345
|
-
if data
|
440
|
+
if data[:namespace] && data[:metric_name]
|
346
441
|
Metric.new(
|
347
|
-
namespace: data
|
348
|
-
name: data
|
442
|
+
namespace: data[:namespace],
|
443
|
+
name: data[:metric_name],
|
349
444
|
client: @client
|
350
445
|
)
|
351
446
|
else
|
@@ -1261,7 +1261,7 @@ module Aws::CloudWatch
|
|
1261
1261
|
params: params,
|
1262
1262
|
config: config)
|
1263
1263
|
context[:gem_name] = 'aws-sdk-cloudwatch'
|
1264
|
-
context[:gem_version] = '1.
|
1264
|
+
context[:gem_version] = '1.2.0'
|
1265
1265
|
Seahorse::Client::Request.new(handlers, context)
|
1266
1266
|
end
|
1267
1267
|
|
@@ -42,7 +42,7 @@ module Aws::CloudWatch
|
|
42
42
|
# The dimensions for the metric.
|
43
43
|
# @return [Array<Types::Dimension>]
|
44
44
|
def dimensions
|
45
|
-
data
|
45
|
+
data[:dimensions]
|
46
46
|
end
|
47
47
|
|
48
48
|
# @!endgroup
|
@@ -83,6 +83,101 @@ module Aws::CloudWatch
|
|
83
83
|
!!@data
|
84
84
|
end
|
85
85
|
|
86
|
+
# @deprecated Use [Aws::CloudWatch::Client] #wait_until instead
|
87
|
+
#
|
88
|
+
# Waiter polls an API operation until a resource enters a desired
|
89
|
+
# state.
|
90
|
+
#
|
91
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
92
|
+
#
|
93
|
+
# ## Basic Usage
|
94
|
+
#
|
95
|
+
# Waiter will polls until it is successful, it fails by
|
96
|
+
# entering a terminal state, or until a maximum number of attempts
|
97
|
+
# are made.
|
98
|
+
#
|
99
|
+
# # polls in a loop until condition is true
|
100
|
+
# resource.wait_until(options) {|resource| condition}
|
101
|
+
#
|
102
|
+
# ## Example
|
103
|
+
#
|
104
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
105
|
+
#
|
106
|
+
# ## Configuration
|
107
|
+
#
|
108
|
+
# You can configure the maximum number of polling attempts, and the
|
109
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
110
|
+
# by passing a block to {#wait_until}:
|
111
|
+
#
|
112
|
+
# # poll for ~25 seconds
|
113
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
114
|
+
#
|
115
|
+
# ## Callbacks
|
116
|
+
#
|
117
|
+
# You can be notified before each polling attempt and before each
|
118
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
119
|
+
# it will terminate the waiter.
|
120
|
+
#
|
121
|
+
# started_at = Time.now
|
122
|
+
# # poll for 1 hour, instead of a number of attempts
|
123
|
+
# proc = Proc.new do |attempts, response|
|
124
|
+
# throw :failure if Time.now - started_at > 3600
|
125
|
+
# end
|
126
|
+
#
|
127
|
+
# # disable max attempts
|
128
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
129
|
+
#
|
130
|
+
# ## Handling Errors
|
131
|
+
#
|
132
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
133
|
+
# fails, it raises an error.
|
134
|
+
#
|
135
|
+
# begin
|
136
|
+
# resource.wait_until(...)
|
137
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
138
|
+
# # resource did not enter the desired state in time
|
139
|
+
# end
|
140
|
+
#
|
141
|
+
#
|
142
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
143
|
+
#
|
144
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
145
|
+
# because the waiter has entered a state that it will not transition
|
146
|
+
# out of, preventing success.
|
147
|
+
#
|
148
|
+
# yet successful.
|
149
|
+
#
|
150
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
151
|
+
# while polling for a resource that is not expected.
|
152
|
+
#
|
153
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
154
|
+
#
|
155
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
156
|
+
# attempts
|
157
|
+
# @option options [Integer] :delay (10) Delay between each
|
158
|
+
# attempt in seconds
|
159
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
160
|
+
# invoked before each attempt
|
161
|
+
# @option options [Proc] :before_wait (nil) Callback
|
162
|
+
# invoked before each wait
|
163
|
+
# @return [Resource] if the waiter was successful
|
164
|
+
def wait_until(options = {}, &block)
|
165
|
+
self_copy = self.dup
|
166
|
+
attempts = 0
|
167
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
168
|
+
options[:delay] ||= 10
|
169
|
+
options[:poller] = Proc.new do
|
170
|
+
attempts += 1
|
171
|
+
if block.call(self_copy)
|
172
|
+
[:success, self_copy]
|
173
|
+
else
|
174
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
175
|
+
:retry
|
176
|
+
end
|
177
|
+
end
|
178
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
179
|
+
end
|
180
|
+
|
86
181
|
# @!group Actions
|
87
182
|
|
88
183
|
# @example Request syntax with placeholder values
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-cloudwatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|