aws-sdk-cloudwatch 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,6 +1,6 @@
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
@@ -18,969 +18,1164 @@ require 'aws-sdk-core/plugins/regional_endpoint.rb'
18
18
  require 'aws-sdk-core/plugins/response_paging.rb'
19
19
  require 'aws-sdk-core/plugins/stub_responses.rb'
20
20
  require 'aws-sdk-core/plugins/idempotency_token.rb'
21
+ require 'aws-sdk-core/plugins/jsonvalue_converter.rb'
21
22
  require 'aws-sdk-core/plugins/signature_v4.rb'
22
23
  require 'aws-sdk-core/plugins/protocols/query.rb'
23
24
 
24
25
  Aws::Plugins::GlobalConfiguration.add_identifier(:cloudwatch)
25
26
 
26
- module Aws
27
- module CloudWatch
28
- class Client < Seahorse::Client::Base
27
+ module Aws::CloudWatch
28
+ class Client < Seahorse::Client::Base
29
29
 
30
- include Aws::ClientStubs
30
+ include Aws::ClientStubs
31
31
 
32
- @identifier = :cloudwatch
32
+ @identifier = :cloudwatch
33
33
 
34
- set_api(ClientApi::API)
34
+ set_api(ClientApi::API)
35
35
 
36
- add_plugin(Seahorse::Client::Plugins::ContentLength)
37
- add_plugin(Aws::Plugins::CredentialsConfiguration)
38
- add_plugin(Aws::Plugins::Logging)
39
- add_plugin(Aws::Plugins::ParamConverter)
40
- add_plugin(Aws::Plugins::ParamValidator)
41
- add_plugin(Aws::Plugins::UserAgent)
42
- add_plugin(Aws::Plugins::HelpfulSocketErrors)
43
- add_plugin(Aws::Plugins::RetryErrors)
44
- add_plugin(Aws::Plugins::GlobalConfiguration)
45
- add_plugin(Aws::Plugins::RegionalEndpoint)
46
- add_plugin(Aws::Plugins::ResponsePaging)
47
- add_plugin(Aws::Plugins::StubResponses)
48
- add_plugin(Aws::Plugins::IdempotencyToken)
49
- add_plugin(Aws::Plugins::SignatureV4)
50
- add_plugin(Aws::Plugins::Protocols::Query)
36
+ add_plugin(Seahorse::Client::Plugins::ContentLength)
37
+ add_plugin(Aws::Plugins::CredentialsConfiguration)
38
+ add_plugin(Aws::Plugins::Logging)
39
+ add_plugin(Aws::Plugins::ParamConverter)
40
+ add_plugin(Aws::Plugins::ParamValidator)
41
+ add_plugin(Aws::Plugins::UserAgent)
42
+ add_plugin(Aws::Plugins::HelpfulSocketErrors)
43
+ add_plugin(Aws::Plugins::RetryErrors)
44
+ add_plugin(Aws::Plugins::GlobalConfiguration)
45
+ add_plugin(Aws::Plugins::RegionalEndpoint)
46
+ add_plugin(Aws::Plugins::ResponsePaging)
47
+ add_plugin(Aws::Plugins::StubResponses)
48
+ add_plugin(Aws::Plugins::IdempotencyToken)
49
+ add_plugin(Aws::Plugins::JsonvalueConverter)
50
+ add_plugin(Aws::Plugins::SignatureV4)
51
+ add_plugin(Aws::Plugins::Protocols::Query)
51
52
 
52
- # @option options [required, Aws::CredentialProvider] :credentials
53
- # Your AWS credentials. This can be an instance of any one of the
54
- # following classes:
55
- #
56
- # * `Aws::Credentials` - Used for configuring static, non-refreshing
57
- # credentials.
58
- #
59
- # * `Aws::InstanceProfileCredentials` - Used for loading credentials
60
- # from an EC2 IMDS on an EC2 instance.
61
- #
62
- # * `Aws::SharedCredentials` - Used for loading credentials from a
63
- # shared file, such as `~/.aws/config`.
64
- #
65
- # * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
66
- #
67
- # When `:credentials` are not configured directly, the following
68
- # locations will be searched for credentials:
69
- #
70
- # * `Aws.config[:credentials]`
71
- # * The `:access_key_id`, `:secret_access_key`, and `:session_token` options.
72
- # * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
73
- # * `~/.aws/credentials`
74
- # * `~/.aws/config`
75
- # * EC2 IMDS instance profile - When used by default, the timeouts are
76
- # very aggressive. Construct and pass an instance of
77
- # `Aws::InstanceProfileCredentails` to enable retries and extended
78
- # timeouts.
79
- # @option options [required, String] :region
80
- # The AWS region to connect to. The configured `:region` is
81
- # used to determine the service `:endpoint`. When not passed,
82
- # a default `:region` is search for in the following locations:
83
- #
84
- # * `Aws.config[:region]`
85
- # * `ENV['AWS_REGION']`
86
- # * `ENV['AMAZON_REGION']`
87
- # * `ENV['AWS_DEFAULT_REGION']`
88
- # * `~/.aws/credentials`
89
- # * `~/.aws/config`
90
- # @option options [String] :access_key_id
91
- # @option options [Boolean] :convert_params (true)
92
- # When `true`, an attempt is made to coerce request parameters into
93
- # the required types.
94
- # @option options [String] :endpoint
95
- # The client endpoint is normally constructed from the `:region`
96
- # option. You should only configure an `:endpoint` when connecting
97
- # to test endpoints. This should be avalid HTTP(S) URI.
98
- # @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default)
99
- # The log formatter.
100
- # @option options [Symbol] :log_level (:info)
101
- # The log level to send messages to the `:logger` at.
102
- # @option options [Logger] :logger
103
- # The Logger instance to send log messages to. If this option
104
- # is not set, logging will be disabled.
105
- # @option options [String] :profile ("default")
106
- # Used when loading credentials from the shared credentials file
107
- # at HOME/.aws/credentials. When not specified, 'default' is used.
108
- # @option options [Integer] :retry_limit (3)
109
- # The maximum number of times to retry failed requests. Only
110
- # ~ 500 level server errors and certain ~ 400 level client errors
111
- # are retried. Generally, these are throttling errors, data
112
- # checksum errors, networking errors, timeout errors and auth
113
- # errors from expired credentials.
114
- # @option options [String] :secret_access_key
115
- # @option options [String] :session_token
116
- # @option options [Boolean] :stub_responses (false)
117
- # Causes the client to return stubbed responses. By default
118
- # fake responses are generated and returned. You can specify
119
- # the response data to return or errors to raise by calling
120
- # {ClientStubs#stub_responses}. See {ClientStubs} for more information.
121
- #
122
- # ** Please note ** When response stubbing is enabled, no HTTP
123
- # requests are made, and retries are disabled.
124
- # @option options [Boolean] :validate_params (true)
125
- # When `true`, request parameters are validated before
126
- # sending the request.
127
- def initialize(*args)
128
- super
129
- end
53
+ # @option options [required, Aws::CredentialProvider] :credentials
54
+ # Your AWS credentials. This can be an instance of any one of the
55
+ # following classes:
56
+ #
57
+ # * `Aws::Credentials` - Used for configuring static, non-refreshing
58
+ # credentials.
59
+ #
60
+ # * `Aws::InstanceProfileCredentials` - Used for loading credentials
61
+ # from an EC2 IMDS on an EC2 instance.
62
+ #
63
+ # * `Aws::SharedCredentials` - Used for loading credentials from a
64
+ # shared file, such as `~/.aws/config`.
65
+ #
66
+ # * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
67
+ #
68
+ # When `:credentials` are not configured directly, the following
69
+ # locations will be searched for credentials:
70
+ #
71
+ # * `Aws.config[:credentials]`
72
+ # * The `:access_key_id`, `:secret_access_key`, and `:session_token` options.
73
+ # * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
74
+ # * `~/.aws/credentials`
75
+ # * `~/.aws/config`
76
+ # * EC2 IMDS instance profile - When used by default, the timeouts are
77
+ # very aggressive. Construct and pass an instance of
78
+ # `Aws::InstanceProfileCredentails` to enable retries and extended
79
+ # timeouts.
80
+ #
81
+ # @option options [required, String] :region
82
+ # The AWS region to connect to. The configured `:region` is
83
+ # used to determine the service `:endpoint`. When not passed,
84
+ # a default `:region` is search for in the following locations:
85
+ #
86
+ # * `Aws.config[:region]`
87
+ # * `ENV['AWS_REGION']`
88
+ # * `ENV['AMAZON_REGION']`
89
+ # * `ENV['AWS_DEFAULT_REGION']`
90
+ # * `~/.aws/credentials`
91
+ # * `~/.aws/config`
92
+ #
93
+ # @option options [String] :access_key_id
94
+ #
95
+ # @option options [Boolean] :convert_params (true)
96
+ # When `true`, an attempt is made to coerce request parameters into
97
+ # the required types.
98
+ #
99
+ # @option options [String] :endpoint
100
+ # The client endpoint is normally constructed from the `:region`
101
+ # option. You should only configure an `:endpoint` when connecting
102
+ # to test endpoints. This should be avalid HTTP(S) URI.
103
+ #
104
+ # @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default)
105
+ # The log formatter.
106
+ #
107
+ # @option options [Symbol] :log_level (:info)
108
+ # The log level to send messages to the `:logger` at.
109
+ #
110
+ # @option options [Logger] :logger
111
+ # The Logger instance to send log messages to. If this option
112
+ # is not set, logging will be disabled.
113
+ #
114
+ # @option options [String] :profile ("default")
115
+ # Used when loading credentials from the shared credentials file
116
+ # at HOME/.aws/credentials. When not specified, 'default' is used.
117
+ #
118
+ # @option options [Integer] :retry_limit (3)
119
+ # The maximum number of times to retry failed requests. Only
120
+ # ~ 500 level server errors and certain ~ 400 level client errors
121
+ # are retried. Generally, these are throttling errors, data
122
+ # checksum errors, networking errors, timeout errors and auth
123
+ # errors from expired credentials.
124
+ #
125
+ # @option options [String] :secret_access_key
126
+ #
127
+ # @option options [String] :session_token
128
+ #
129
+ # @option options [Boolean] :stub_responses (false)
130
+ # Causes the client to return stubbed responses. By default
131
+ # fake responses are generated and returned. You can specify
132
+ # the response data to return or errors to raise by calling
133
+ # {ClientStubs#stub_responses}. See {ClientStubs} for more information.
134
+ #
135
+ # ** Please note ** When response stubbing is enabled, no HTTP
136
+ # requests are made, and retries are disabled.
137
+ #
138
+ # @option options [Boolean] :validate_params (true)
139
+ # When `true`, request parameters are validated before
140
+ # sending the request.
141
+ #
142
+ def initialize(*args)
143
+ super
144
+ end
130
145
 
131
- # @!group API Operations
146
+ # @!group API Operations
132
147
 
133
- # Deletes the specified alarms. In the event of an error, no alarms are
134
- # deleted.
135
- # @option params [required, Array<String>] :alarm_names
136
- # The alarms to be deleted.
137
- # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
138
- #
139
- # @example Request syntax with placeholder values
140
- # resp = client.delete_alarms({
141
- # alarm_names: ["AlarmName"], # required
142
- # })
143
- # @overload delete_alarms(params = {})
144
- # @param [Hash] params ({})
145
- def delete_alarms(params = {}, options = {})
146
- req = build_request(:delete_alarms, params)
147
- req.send_request(options)
148
- end
149
-
150
- # Retrieves the history for the specified alarm. You can filter the
151
- # results by date range or item type. If an alarm name is not specified,
152
- # the histories for all alarms are returned.
153
- #
154
- # Note that Amazon CloudWatch retains the history of an alarm even if
155
- # you delete the alarm.
156
- # @option params [String] :alarm_name
157
- # The name of the alarm.
158
- # @option params [String] :history_item_type
159
- # The type of alarm histories to retrieve.
160
- # @option params [Time,DateTime,Date,Integer,String] :start_date
161
- # The starting date to retrieve alarm history.
162
- # @option params [Time,DateTime,Date,Integer,String] :end_date
163
- # The ending date to retrieve alarm history.
164
- # @option params [Integer] :max_records
165
- # The maximum number of alarm history records to retrieve.
166
- # @option params [String] :next_token
167
- # The token returned by a previous call to indicate that there is more
168
- # data available.
169
- # @return [Types::DescribeAlarmHistoryOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
170
- #
171
- # * {Types::DescribeAlarmHistoryOutput#alarm_history_items #AlarmHistoryItems} => Array&lt;Types::AlarmHistoryItem&gt;
172
- # * {Types::DescribeAlarmHistoryOutput#next_token #NextToken} => String
173
- #
174
- # @example Request syntax with placeholder values
175
- # resp = client.describe_alarm_history({
176
- # alarm_name: "AlarmName",
177
- # history_item_type: "ConfigurationUpdate", # accepts ConfigurationUpdate, StateUpdate, Action
178
- # start_date: Time.now,
179
- # end_date: Time.now,
180
- # max_records: 1,
181
- # next_token: "NextToken",
182
- # })
183
- #
184
- # @example Response structure
185
- # resp.alarm_history_items #=> Array
186
- # resp.alarm_history_items[0].alarm_name #=> String
187
- # resp.alarm_history_items[0].timestamp #=> Time
188
- # resp.alarm_history_items[0].history_item_type #=> String, one of "ConfigurationUpdate", "StateUpdate", "Action"
189
- # resp.alarm_history_items[0].history_summary #=> String
190
- # resp.alarm_history_items[0].history_data #=> String
191
- # resp.next_token #=> String
192
- # @overload describe_alarm_history(params = {})
193
- # @param [Hash] params ({})
194
- def describe_alarm_history(params = {}, options = {})
195
- req = build_request(:describe_alarm_history, params)
196
- req.send_request(options)
197
- end
148
+ # Deletes the specified alarms. In the event of an error, no alarms are
149
+ # deleted.
150
+ #
151
+ # @option params [required, Array<String>] :alarm_names
152
+ # The alarms to be deleted.
153
+ #
154
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
155
+ #
156
+ # @example Request syntax with placeholder values
157
+ #
158
+ # resp = client.delete_alarms({
159
+ # alarm_names: ["AlarmName"], # required
160
+ # })
161
+ #
162
+ # @see http://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteAlarms AWS API Documentation
163
+ #
164
+ # @overload delete_alarms(params = {})
165
+ # @param [Hash] params ({})
166
+ def delete_alarms(params = {}, options = {})
167
+ req = build_request(:delete_alarms, params)
168
+ req.send_request(options)
169
+ end
198
170
 
199
- # Retrieves the specified alarms. If no alarms are specified, all alarms
200
- # are returned. Alarms can be retrieved by using only a prefix for the
201
- # alarm name, the alarm state, or a prefix for any action.
202
- # @option params [Array<String>] :alarm_names
203
- # The names of the alarms.
204
- # @option params [String] :alarm_name_prefix
205
- # The alarm name prefix. You cannot specify `AlarmNames` if this
206
- # parameter is specified.
207
- # @option params [String] :state_value
208
- # The state value to be used in matching alarms.
209
- # @option params [String] :action_prefix
210
- # The action name prefix.
211
- # @option params [Integer] :max_records
212
- # The maximum number of alarm descriptions to retrieve.
213
- # @option params [String] :next_token
214
- # The token returned by a previous call to indicate that there is more
215
- # data available.
216
- # @return [Types::DescribeAlarmsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
217
- #
218
- # * {Types::DescribeAlarmsOutput#metric_alarms #MetricAlarms} => Array&lt;Types::MetricAlarm&gt;
219
- # * {Types::DescribeAlarmsOutput#next_token #NextToken} => String
220
- #
221
- # @example Request syntax with placeholder values
222
- # resp = client.describe_alarms({
223
- # alarm_names: ["AlarmName"],
224
- # alarm_name_prefix: "AlarmNamePrefix",
225
- # state_value: "OK", # accepts OK, ALARM, INSUFFICIENT_DATA
226
- # action_prefix: "ActionPrefix",
227
- # max_records: 1,
228
- # next_token: "NextToken",
229
- # })
230
- #
231
- # @example Response structure
232
- # resp.metric_alarms #=> Array
233
- # resp.metric_alarms[0].alarm_name #=> String
234
- # resp.metric_alarms[0].alarm_arn #=> String
235
- # resp.metric_alarms[0].alarm_description #=> String
236
- # resp.metric_alarms[0].alarm_configuration_updated_timestamp #=> Time
237
- # resp.metric_alarms[0].actions_enabled #=> Boolean
238
- # resp.metric_alarms[0].ok_actions #=> Array
239
- # resp.metric_alarms[0].ok_actions[0] #=> String
240
- # resp.metric_alarms[0].alarm_actions #=> Array
241
- # resp.metric_alarms[0].alarm_actions[0] #=> String
242
- # resp.metric_alarms[0].insufficient_data_actions #=> Array
243
- # resp.metric_alarms[0].insufficient_data_actions[0] #=> String
244
- # resp.metric_alarms[0].state_value #=> String, one of "OK", "ALARM", "INSUFFICIENT_DATA"
245
- # resp.metric_alarms[0].state_reason #=> String
246
- # resp.metric_alarms[0].state_reason_data #=> String
247
- # resp.metric_alarms[0].state_updated_timestamp #=> Time
248
- # resp.metric_alarms[0].metric_name #=> String
249
- # resp.metric_alarms[0].namespace #=> String
250
- # resp.metric_alarms[0].statistic #=> String, one of "SampleCount", "Average", "Sum", "Minimum", "Maximum"
251
- # resp.metric_alarms[0].extended_statistic #=> String
252
- # resp.metric_alarms[0].dimensions #=> Array
253
- # resp.metric_alarms[0].dimensions[0].name #=> String
254
- # resp.metric_alarms[0].dimensions[0].value #=> String
255
- # resp.metric_alarms[0].period #=> Integer
256
- # resp.metric_alarms[0].unit #=> String, one of "Seconds", "Microseconds", "Milliseconds", "Bytes", "Kilobytes", "Megabytes", "Gigabytes", "Terabytes", "Bits", "Kilobits", "Megabits", "Gigabits", "Terabits", "Percent", "Count", "Bytes/Second", "Kilobytes/Second", "Megabytes/Second", "Gigabytes/Second", "Terabytes/Second", "Bits/Second", "Kilobits/Second", "Megabits/Second", "Gigabits/Second", "Terabits/Second", "Count/Second", "None"
257
- # resp.metric_alarms[0].evaluation_periods #=> Integer
258
- # resp.metric_alarms[0].threshold #=> Float
259
- # resp.metric_alarms[0].comparison_operator #=> String, one of "GreaterThanOrEqualToThreshold", "GreaterThanThreshold", "LessThanThreshold", "LessThanOrEqualToThreshold"
260
- # resp.next_token #=> String
261
- # @overload describe_alarms(params = {})
262
- # @param [Hash] params ({})
263
- def describe_alarms(params = {}, options = {})
264
- req = build_request(:describe_alarms, params)
265
- req.send_request(options)
266
- end
171
+ # Retrieves the history for the specified alarm. You can filter the
172
+ # results by date range or item type. If an alarm name is not specified,
173
+ # the histories for all alarms are returned.
174
+ #
175
+ # Note that Amazon CloudWatch retains the history of an alarm even if
176
+ # you delete the alarm.
177
+ #
178
+ # @option params [String] :alarm_name
179
+ # The name of the alarm.
180
+ #
181
+ # @option params [String] :history_item_type
182
+ # The type of alarm histories to retrieve.
183
+ #
184
+ # @option params [Time,DateTime,Date,Integer,String] :start_date
185
+ # The starting date to retrieve alarm history.
186
+ #
187
+ # @option params [Time,DateTime,Date,Integer,String] :end_date
188
+ # The ending date to retrieve alarm history.
189
+ #
190
+ # @option params [Integer] :max_records
191
+ # The maximum number of alarm history records to retrieve.
192
+ #
193
+ # @option params [String] :next_token
194
+ # The token returned by a previous call to indicate that there is more
195
+ # data available.
196
+ #
197
+ # @return [Types::DescribeAlarmHistoryOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
198
+ #
199
+ # * {Types::DescribeAlarmHistoryOutput#alarm_history_items #alarm_history_items} => Array&lt;Types::AlarmHistoryItem&gt;
200
+ # * {Types::DescribeAlarmHistoryOutput#next_token #next_token} => String
201
+ #
202
+ # @example Request syntax with placeholder values
203
+ #
204
+ # resp = client.describe_alarm_history({
205
+ # alarm_name: "AlarmName",
206
+ # history_item_type: "ConfigurationUpdate", # accepts ConfigurationUpdate, StateUpdate, Action
207
+ # start_date: Time.now,
208
+ # end_date: Time.now,
209
+ # max_records: 1,
210
+ # next_token: "NextToken",
211
+ # })
212
+ #
213
+ # @example Response structure
214
+ #
215
+ # resp.alarm_history_items #=> Array
216
+ # resp.alarm_history_items[0].alarm_name #=> String
217
+ # resp.alarm_history_items[0].timestamp #=> Time
218
+ # resp.alarm_history_items[0].history_item_type #=> String, one of "ConfigurationUpdate", "StateUpdate", "Action"
219
+ # resp.alarm_history_items[0].history_summary #=> String
220
+ # resp.alarm_history_items[0].history_data #=> String
221
+ # resp.next_token #=> String
222
+ #
223
+ # @see http://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmHistory AWS API Documentation
224
+ #
225
+ # @overload describe_alarm_history(params = {})
226
+ # @param [Hash] params ({})
227
+ def describe_alarm_history(params = {}, options = {})
228
+ req = build_request(:describe_alarm_history, params)
229
+ req.send_request(options)
230
+ end
267
231
 
268
- # Retrieves the alarms for the specified metric. Specify a statistic,
269
- # period, or unit to filter the results.
270
- # @option params [required, String] :metric_name
271
- # The name of the metric.
272
- # @option params [required, String] :namespace
273
- # The namespace of the metric.
274
- # @option params [String] :statistic
275
- # The statistic for the metric, other than percentiles. For percentile
276
- # statistics, use `ExtendedStatistics`.
277
- # @option params [String] :extended_statistic
278
- # The percentile statistic for the metric. Specify a value between p0.0
279
- # and p100.
280
- # @option params [Array<Types::Dimension>] :dimensions
281
- # The dimensions associated with the metric. If the metric has any
282
- # associated dimensions, you must specify them in order for the call to
283
- # succeed.
284
- # @option params [Integer] :period
285
- # The period, in seconds, over which the statistic is applied.
286
- # @option params [String] :unit
287
- # The unit for the metric.
288
- # @return [Types::DescribeAlarmsForMetricOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
289
- #
290
- # * {Types::DescribeAlarmsForMetricOutput#metric_alarms #MetricAlarms} => Array&lt;Types::MetricAlarm&gt;
291
- #
292
- # @example Request syntax with placeholder values
293
- # resp = client.describe_alarms_for_metric({
294
- # metric_name: "MetricName", # required
295
- # namespace: "Namespace", # required
296
- # statistic: "SampleCount", # accepts SampleCount, Average, Sum, Minimum, Maximum
297
- # extended_statistic: "ExtendedStatistic",
298
- # dimensions: [
299
- # {
300
- # name: "DimensionName", # required
301
- # value: "DimensionValue", # required
302
- # },
303
- # ],
304
- # period: 1,
305
- # unit: "Seconds", # accepts Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None
306
- # })
307
- #
308
- # @example Response structure
309
- # resp.metric_alarms #=> Array
310
- # resp.metric_alarms[0].alarm_name #=> String
311
- # resp.metric_alarms[0].alarm_arn #=> String
312
- # resp.metric_alarms[0].alarm_description #=> String
313
- # resp.metric_alarms[0].alarm_configuration_updated_timestamp #=> Time
314
- # resp.metric_alarms[0].actions_enabled #=> Boolean
315
- # resp.metric_alarms[0].ok_actions #=> Array
316
- # resp.metric_alarms[0].ok_actions[0] #=> String
317
- # resp.metric_alarms[0].alarm_actions #=> Array
318
- # resp.metric_alarms[0].alarm_actions[0] #=> String
319
- # resp.metric_alarms[0].insufficient_data_actions #=> Array
320
- # resp.metric_alarms[0].insufficient_data_actions[0] #=> String
321
- # resp.metric_alarms[0].state_value #=> String, one of "OK", "ALARM", "INSUFFICIENT_DATA"
322
- # resp.metric_alarms[0].state_reason #=> String
323
- # resp.metric_alarms[0].state_reason_data #=> String
324
- # resp.metric_alarms[0].state_updated_timestamp #=> Time
325
- # resp.metric_alarms[0].metric_name #=> String
326
- # resp.metric_alarms[0].namespace #=> String
327
- # resp.metric_alarms[0].statistic #=> String, one of "SampleCount", "Average", "Sum", "Minimum", "Maximum"
328
- # resp.metric_alarms[0].extended_statistic #=> String
329
- # resp.metric_alarms[0].dimensions #=> Array
330
- # resp.metric_alarms[0].dimensions[0].name #=> String
331
- # resp.metric_alarms[0].dimensions[0].value #=> String
332
- # resp.metric_alarms[0].period #=> Integer
333
- # resp.metric_alarms[0].unit #=> String, one of "Seconds", "Microseconds", "Milliseconds", "Bytes", "Kilobytes", "Megabytes", "Gigabytes", "Terabytes", "Bits", "Kilobits", "Megabits", "Gigabits", "Terabits", "Percent", "Count", "Bytes/Second", "Kilobytes/Second", "Megabytes/Second", "Gigabytes/Second", "Terabytes/Second", "Bits/Second", "Kilobits/Second", "Megabits/Second", "Gigabits/Second", "Terabits/Second", "Count/Second", "None"
334
- # resp.metric_alarms[0].evaluation_periods #=> Integer
335
- # resp.metric_alarms[0].threshold #=> Float
336
- # resp.metric_alarms[0].comparison_operator #=> String, one of "GreaterThanOrEqualToThreshold", "GreaterThanThreshold", "LessThanThreshold", "LessThanOrEqualToThreshold"
337
- # @overload describe_alarms_for_metric(params = {})
338
- # @param [Hash] params ({})
339
- def describe_alarms_for_metric(params = {}, options = {})
340
- req = build_request(:describe_alarms_for_metric, params)
341
- req.send_request(options)
342
- end
232
+ # Retrieves the specified alarms. If no alarms are specified, all alarms
233
+ # are returned. Alarms can be retrieved by using only a prefix for the
234
+ # alarm name, the alarm state, or a prefix for any action.
235
+ #
236
+ # @option params [Array<String>] :alarm_names
237
+ # The names of the alarms.
238
+ #
239
+ # @option params [String] :alarm_name_prefix
240
+ # The alarm name prefix. You cannot specify `AlarmNames` if this
241
+ # parameter is specified.
242
+ #
243
+ # @option params [String] :state_value
244
+ # The state value to be used in matching alarms.
245
+ #
246
+ # @option params [String] :action_prefix
247
+ # The action name prefix.
248
+ #
249
+ # @option params [Integer] :max_records
250
+ # The maximum number of alarm descriptions to retrieve.
251
+ #
252
+ # @option params [String] :next_token
253
+ # The token returned by a previous call to indicate that there is more
254
+ # data available.
255
+ #
256
+ # @return [Types::DescribeAlarmsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
257
+ #
258
+ # * {Types::DescribeAlarmsOutput#metric_alarms #metric_alarms} => Array&lt;Types::MetricAlarm&gt;
259
+ # * {Types::DescribeAlarmsOutput#next_token #next_token} => String
260
+ #
261
+ # @example Request syntax with placeholder values
262
+ #
263
+ # resp = client.describe_alarms({
264
+ # alarm_names: ["AlarmName"],
265
+ # alarm_name_prefix: "AlarmNamePrefix",
266
+ # state_value: "OK", # accepts OK, ALARM, INSUFFICIENT_DATA
267
+ # action_prefix: "ActionPrefix",
268
+ # max_records: 1,
269
+ # next_token: "NextToken",
270
+ # })
271
+ #
272
+ # @example Response structure
273
+ #
274
+ # resp.metric_alarms #=> Array
275
+ # resp.metric_alarms[0].alarm_name #=> String
276
+ # resp.metric_alarms[0].alarm_arn #=> String
277
+ # resp.metric_alarms[0].alarm_description #=> String
278
+ # resp.metric_alarms[0].alarm_configuration_updated_timestamp #=> Time
279
+ # resp.metric_alarms[0].actions_enabled #=> Boolean
280
+ # resp.metric_alarms[0].ok_actions #=> Array
281
+ # resp.metric_alarms[0].ok_actions[0] #=> String
282
+ # resp.metric_alarms[0].alarm_actions #=> Array
283
+ # resp.metric_alarms[0].alarm_actions[0] #=> String
284
+ # resp.metric_alarms[0].insufficient_data_actions #=> Array
285
+ # resp.metric_alarms[0].insufficient_data_actions[0] #=> String
286
+ # resp.metric_alarms[0].state_value #=> String, one of "OK", "ALARM", "INSUFFICIENT_DATA"
287
+ # resp.metric_alarms[0].state_reason #=> String
288
+ # resp.metric_alarms[0].state_reason_data #=> String
289
+ # resp.metric_alarms[0].state_updated_timestamp #=> Time
290
+ # resp.metric_alarms[0].metric_name #=> String
291
+ # resp.metric_alarms[0].namespace #=> String
292
+ # resp.metric_alarms[0].statistic #=> String, one of "SampleCount", "Average", "Sum", "Minimum", "Maximum"
293
+ # resp.metric_alarms[0].extended_statistic #=> String
294
+ # resp.metric_alarms[0].dimensions #=> Array
295
+ # resp.metric_alarms[0].dimensions[0].name #=> String
296
+ # resp.metric_alarms[0].dimensions[0].value #=> String
297
+ # resp.metric_alarms[0].period #=> Integer
298
+ # resp.metric_alarms[0].unit #=> String, one of "Seconds", "Microseconds", "Milliseconds", "Bytes", "Kilobytes", "Megabytes", "Gigabytes", "Terabytes", "Bits", "Kilobits", "Megabits", "Gigabits", "Terabits", "Percent", "Count", "Bytes/Second", "Kilobytes/Second", "Megabytes/Second", "Gigabytes/Second", "Terabytes/Second", "Bits/Second", "Kilobits/Second", "Megabits/Second", "Gigabits/Second", "Terabits/Second", "Count/Second", "None"
299
+ # resp.metric_alarms[0].evaluation_periods #=> Integer
300
+ # resp.metric_alarms[0].threshold #=> Float
301
+ # resp.metric_alarms[0].comparison_operator #=> String, one of "GreaterThanOrEqualToThreshold", "GreaterThanThreshold", "LessThanThreshold", "LessThanOrEqualToThreshold"
302
+ # resp.metric_alarms[0].treat_missing_data #=> String
303
+ # resp.metric_alarms[0].evaluate_low_sample_count_percentile #=> String
304
+ # resp.next_token #=> String
305
+ #
306
+ # @see http://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarms AWS API Documentation
307
+ #
308
+ # @overload describe_alarms(params = {})
309
+ # @param [Hash] params ({})
310
+ def describe_alarms(params = {}, options = {})
311
+ req = build_request(:describe_alarms, params)
312
+ req.send_request(options)
313
+ end
343
314
 
344
- # Disables the actions for the specified alarms. When an alarm's
345
- # actions are disabled, the alarm actions do not execute when the alarm
346
- # state changes.
347
- # @option params [required, Array<String>] :alarm_names
348
- # The names of the alarms.
349
- # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
350
- #
351
- # @example Request syntax with placeholder values
352
- # resp = client.disable_alarm_actions({
353
- # alarm_names: ["AlarmName"], # required
354
- # })
355
- # @overload disable_alarm_actions(params = {})
356
- # @param [Hash] params ({})
357
- def disable_alarm_actions(params = {}, options = {})
358
- req = build_request(:disable_alarm_actions, params)
359
- req.send_request(options)
360
- end
315
+ # Retrieves the alarms for the specified metric. Specify a statistic,
316
+ # period, or unit to filter the results.
317
+ #
318
+ # @option params [required, String] :metric_name
319
+ # The name of the metric.
320
+ #
321
+ # @option params [required, String] :namespace
322
+ # The namespace of the metric.
323
+ #
324
+ # @option params [String] :statistic
325
+ # The statistic for the metric, other than percentiles. For percentile
326
+ # statistics, use `ExtendedStatistics`.
327
+ #
328
+ # @option params [String] :extended_statistic
329
+ # The percentile statistic for the metric. Specify a value between p0.0
330
+ # and p100.
331
+ #
332
+ # @option params [Array<Types::Dimension>] :dimensions
333
+ # The dimensions associated with the metric. If the metric has any
334
+ # associated dimensions, you must specify them in order for the call to
335
+ # succeed.
336
+ #
337
+ # @option params [Integer] :period
338
+ # The period, in seconds, over which the statistic is applied.
339
+ #
340
+ # @option params [String] :unit
341
+ # The unit for the metric.
342
+ #
343
+ # @return [Types::DescribeAlarmsForMetricOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
344
+ #
345
+ # * {Types::DescribeAlarmsForMetricOutput#metric_alarms #metric_alarms} => Array&lt;Types::MetricAlarm&gt;
346
+ #
347
+ # @example Request syntax with placeholder values
348
+ #
349
+ # resp = client.describe_alarms_for_metric({
350
+ # metric_name: "MetricName", # required
351
+ # namespace: "Namespace", # required
352
+ # statistic: "SampleCount", # accepts SampleCount, Average, Sum, Minimum, Maximum
353
+ # extended_statistic: "ExtendedStatistic",
354
+ # dimensions: [
355
+ # {
356
+ # name: "DimensionName", # required
357
+ # value: "DimensionValue", # required
358
+ # },
359
+ # ],
360
+ # period: 1,
361
+ # unit: "Seconds", # accepts Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None
362
+ # })
363
+ #
364
+ # @example Response structure
365
+ #
366
+ # resp.metric_alarms #=> Array
367
+ # resp.metric_alarms[0].alarm_name #=> String
368
+ # resp.metric_alarms[0].alarm_arn #=> String
369
+ # resp.metric_alarms[0].alarm_description #=> String
370
+ # resp.metric_alarms[0].alarm_configuration_updated_timestamp #=> Time
371
+ # resp.metric_alarms[0].actions_enabled #=> Boolean
372
+ # resp.metric_alarms[0].ok_actions #=> Array
373
+ # resp.metric_alarms[0].ok_actions[0] #=> String
374
+ # resp.metric_alarms[0].alarm_actions #=> Array
375
+ # resp.metric_alarms[0].alarm_actions[0] #=> String
376
+ # resp.metric_alarms[0].insufficient_data_actions #=> Array
377
+ # resp.metric_alarms[0].insufficient_data_actions[0] #=> String
378
+ # resp.metric_alarms[0].state_value #=> String, one of "OK", "ALARM", "INSUFFICIENT_DATA"
379
+ # resp.metric_alarms[0].state_reason #=> String
380
+ # resp.metric_alarms[0].state_reason_data #=> String
381
+ # resp.metric_alarms[0].state_updated_timestamp #=> Time
382
+ # resp.metric_alarms[0].metric_name #=> String
383
+ # resp.metric_alarms[0].namespace #=> String
384
+ # resp.metric_alarms[0].statistic #=> String, one of "SampleCount", "Average", "Sum", "Minimum", "Maximum"
385
+ # resp.metric_alarms[0].extended_statistic #=> String
386
+ # resp.metric_alarms[0].dimensions #=> Array
387
+ # resp.metric_alarms[0].dimensions[0].name #=> String
388
+ # resp.metric_alarms[0].dimensions[0].value #=> String
389
+ # resp.metric_alarms[0].period #=> Integer
390
+ # resp.metric_alarms[0].unit #=> String, one of "Seconds", "Microseconds", "Milliseconds", "Bytes", "Kilobytes", "Megabytes", "Gigabytes", "Terabytes", "Bits", "Kilobits", "Megabits", "Gigabits", "Terabits", "Percent", "Count", "Bytes/Second", "Kilobytes/Second", "Megabytes/Second", "Gigabytes/Second", "Terabytes/Second", "Bits/Second", "Kilobits/Second", "Megabits/Second", "Gigabits/Second", "Terabits/Second", "Count/Second", "None"
391
+ # resp.metric_alarms[0].evaluation_periods #=> Integer
392
+ # resp.metric_alarms[0].threshold #=> Float
393
+ # resp.metric_alarms[0].comparison_operator #=> String, one of "GreaterThanOrEqualToThreshold", "GreaterThanThreshold", "LessThanThreshold", "LessThanOrEqualToThreshold"
394
+ # resp.metric_alarms[0].treat_missing_data #=> String
395
+ # resp.metric_alarms[0].evaluate_low_sample_count_percentile #=> String
396
+ #
397
+ # @see http://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmsForMetric AWS API Documentation
398
+ #
399
+ # @overload describe_alarms_for_metric(params = {})
400
+ # @param [Hash] params ({})
401
+ def describe_alarms_for_metric(params = {}, options = {})
402
+ req = build_request(:describe_alarms_for_metric, params)
403
+ req.send_request(options)
404
+ end
361
405
 
362
- # Enables the actions for the specified alarms.
363
- # @option params [required, Array<String>] :alarm_names
364
- # The names of the alarms.
365
- # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
366
- #
367
- # @example Request syntax with placeholder values
368
- # resp = client.enable_alarm_actions({
369
- # alarm_names: ["AlarmName"], # required
370
- # })
371
- # @overload enable_alarm_actions(params = {})
372
- # @param [Hash] params ({})
373
- def enable_alarm_actions(params = {}, options = {})
374
- req = build_request(:enable_alarm_actions, params)
375
- req.send_request(options)
376
- end
406
+ # Disables the actions for the specified alarms. When an alarm's
407
+ # actions are disabled, the alarm actions do not execute when the alarm
408
+ # state changes.
409
+ #
410
+ # @option params [required, Array<String>] :alarm_names
411
+ # The names of the alarms.
412
+ #
413
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
414
+ #
415
+ # @example Request syntax with placeholder values
416
+ #
417
+ # resp = client.disable_alarm_actions({
418
+ # alarm_names: ["AlarmName"], # required
419
+ # })
420
+ #
421
+ # @see http://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DisableAlarmActions AWS API Documentation
422
+ #
423
+ # @overload disable_alarm_actions(params = {})
424
+ # @param [Hash] params ({})
425
+ def disable_alarm_actions(params = {}, options = {})
426
+ req = build_request(:disable_alarm_actions, params)
427
+ req.send_request(options)
428
+ end
377
429
 
378
- # Gets statistics for the specified metric.
379
- #
380
- # Amazon CloudWatch retains metric data as follows:
381
- #
382
- # * Data points with a period of 60 seconds (1 minute) are available for
383
- # 15 days
384
- #
385
- # * Data points with a period of 300 seconds (5 minute) are available
386
- # for 63 days
387
- #
388
- # * Data points with a period of 3600 seconds (1 hour) are available for
389
- # 455 days (15 months)
390
- #
391
- # Note that CloudWatch started retaining 5-minute and 1-hour metric data
392
- # as of 9 July 2016.
393
- #
394
- # The maximum number of data points returned from a single call is
395
- # 1,440. If you request more than 1,440 data points, Amazon CloudWatch
396
- # returns an error. To reduce the number of data points, you can narrow
397
- # the specified time range and make multiple requests across adjacent
398
- # time ranges, or you can increase the specified period. A period can be
399
- # as short as one minute (60 seconds). Note that data points are not
400
- # returned in chronological order.
401
- #
402
- # Amazon CloudWatch aggregates data points based on the length of the
403
- # period that you specify. For example, if you request statistics with a
404
- # one-hour period, Amazon CloudWatch aggregates all data points with
405
- # time stamps that fall within each one-hour period. Therefore, the
406
- # number of values aggregated by CloudWatch is larger than the number of
407
- # data points returned.
408
- #
409
- # For a list of metrics and dimensions supported by AWS services, see
410
- # the [Amazon CloudWatch Metrics and Dimensions Reference][1] in the
411
- # *Amazon CloudWatch User Guide*.
412
- #
413
- #
414
- #
415
- # [1]: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CW_Support_For_AWS.html
416
- # @option params [required, String] :namespace
417
- # The namespace of the metric, with or without spaces.
418
- # @option params [required, String] :metric_name
419
- # The name of the metric, with or without spaces.
420
- # @option params [Array<Types::Dimension>] :dimensions
421
- # The dimensions. CloudWatch treats each unique combination of
422
- # dimensions as a separate metric. You can't retrieve statistics using
423
- # combinations of dimensions that were not specially published. You must
424
- # specify the same dimensions that were used when the metrics were
425
- # created. For an example, see [Dimension Combinations][1] in the
426
- # *Amazon CloudWatch User Guide*.
427
- #
428
- #
429
- #
430
- # [1]: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#dimension-combinations
431
- # @option params [required, Time,DateTime,Date,Integer,String] :start_time
432
- # The time stamp that determines the first data point to return. Note
433
- # that start times are evaluated relative to the time that CloudWatch
434
- # receives the request.
435
- #
436
- # The value specified is inclusive; results include data points with the
437
- # specified time stamp. The time stamp must be in ISO 8601 UTC format
438
- # (for example, 2016-10-03T23:00:00Z).
439
- #
440
- # CloudWatch rounds the specified time stamp as follows:
441
- #
442
- # * Start time less than 15 days ago - Round down to the nearest whole
443
- # minute. For example, 12:32:34 is rounded down to 12:32:00.
444
- #
445
- # * Start time between 15 and 63 days ago - Round down to the nearest
446
- # 5-minute clock interval. For example, 12:32:34 is rounded down to
447
- # 12:30:00.
448
- #
449
- # * Start time greater than 63 days ago - Round down to the nearest
450
- # 1-hour clock interval. For example, 12:32:34 is rounded down to
451
- # 12:00:00.
452
- # @option params [required, Time,DateTime,Date,Integer,String] :end_time
453
- # The time stamp that determines the last data point to return.
454
- #
455
- # The value specified is exclusive; results will include data points up
456
- # to the specified time stamp. The time stamp must be in ISO 8601 UTC
457
- # format (for example, 2016-10-10T23:00:00Z).
458
- # @option params [required, Integer] :period
459
- # The granularity, in seconds, of the returned data points. A period can
460
- # be as short as one minute (60 seconds) and must be a multiple of 60.
461
- # The default value is 60.
462
- #
463
- # If the `StartTime` parameter specifies a time stamp that is greater
464
- # than 15 days ago, you must specify the period as follows or no data
465
- # points in that time range is returned:
466
- #
467
- # * Start time between 15 and 63 days ago - Use a multiple of 300
468
- # seconds (5 minutes).
469
- #
470
- # * Start time greater than 63 days ago - Use a multiple of 3600 seconds
471
- # (1 hour).
472
- # @option params [Array<String>] :statistics
473
- # The metric statistics, other than percentile. For percentile
474
- # statistics, use `ExtendedStatistic`.
475
- # @option params [Array<String>] :extended_statistics
476
- # The percentile statistics. Specify values between p0.0 and p100.
477
- # @option params [String] :unit
478
- # The unit for a given metric. Metrics may be reported in multiple
479
- # units. Not supplying a unit results in all units being returned. If
480
- # the metric only ever reports one unit, specifying a unit has no
481
- # effect.
482
- # @return [Types::GetMetricStatisticsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
483
- #
484
- # * {Types::GetMetricStatisticsOutput#label #Label} => String
485
- # * {Types::GetMetricStatisticsOutput#datapoints #Datapoints} => Array&lt;Types::Datapoint&gt;
486
- #
487
- # @example Request syntax with placeholder values
488
- # resp = client.get_metric_statistics({
489
- # namespace: "Namespace", # required
490
- # metric_name: "MetricName", # required
491
- # dimensions: [
492
- # {
493
- # name: "DimensionName", # required
494
- # value: "DimensionValue", # required
495
- # },
496
- # ],
497
- # start_time: Time.now, # required
498
- # end_time: Time.now, # required
499
- # period: 1, # required
500
- # statistics: ["SampleCount"], # accepts SampleCount, Average, Sum, Minimum, Maximum
501
- # extended_statistics: ["ExtendedStatistic"],
502
- # unit: "Seconds", # accepts Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None
503
- # })
504
- #
505
- # @example Response structure
506
- # resp.label #=> String
507
- # resp.datapoints #=> Array
508
- # resp.datapoints[0].timestamp #=> Time
509
- # resp.datapoints[0].sample_count #=> Float
510
- # resp.datapoints[0].average #=> Float
511
- # resp.datapoints[0].sum #=> Float
512
- # resp.datapoints[0].minimum #=> Float
513
- # resp.datapoints[0].maximum #=> Float
514
- # resp.datapoints[0].unit #=> String, one of "Seconds", "Microseconds", "Milliseconds", "Bytes", "Kilobytes", "Megabytes", "Gigabytes", "Terabytes", "Bits", "Kilobits", "Megabits", "Gigabits", "Terabits", "Percent", "Count", "Bytes/Second", "Kilobytes/Second", "Megabytes/Second", "Gigabytes/Second", "Terabytes/Second", "Bits/Second", "Kilobits/Second", "Megabits/Second", "Gigabits/Second", "Terabits/Second", "Count/Second", "None"
515
- # resp.datapoints[0].extended_statistics #=> Hash
516
- # resp.datapoints[0].extended_statistics["ExtendedStatistic"] #=> Float
517
- # @overload get_metric_statistics(params = {})
518
- # @param [Hash] params ({})
519
- def get_metric_statistics(params = {}, options = {})
520
- req = build_request(:get_metric_statistics, params)
521
- req.send_request(options)
522
- end
430
+ # Enables the actions for the specified alarms.
431
+ #
432
+ # @option params [required, Array<String>] :alarm_names
433
+ # The names of the alarms.
434
+ #
435
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
436
+ #
437
+ # @example Request syntax with placeholder values
438
+ #
439
+ # resp = client.enable_alarm_actions({
440
+ # alarm_names: ["AlarmName"], # required
441
+ # })
442
+ #
443
+ # @see http://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/EnableAlarmActions AWS API Documentation
444
+ #
445
+ # @overload enable_alarm_actions(params = {})
446
+ # @param [Hash] params ({})
447
+ def enable_alarm_actions(params = {}, options = {})
448
+ req = build_request(:enable_alarm_actions, params)
449
+ req.send_request(options)
450
+ end
523
451
 
524
- # List the specified metrics. You can use the returned metrics with
525
- # GetMetricStatistics to obtain statistical data.
526
- #
527
- # Up to 500 results are returned for any one call. To retrieve
528
- # additional results, use the returned token with subsequent calls.
529
- #
530
- # After you create a metric, allow up to fifteen minutes before the
531
- # metric appears. Statistics about the metric, however, are available
532
- # sooner using GetMetricStatistics.
533
- # @option params [String] :namespace
534
- # The namespace to filter against.
535
- # @option params [String] :metric_name
536
- # The name of the metric to filter against.
537
- # @option params [Array<Types::DimensionFilter>] :dimensions
538
- # The dimensions to filter against.
539
- # @option params [String] :next_token
540
- # The token returned by a previous call to indicate that there is more
541
- # data available.
542
- # @return [Types::ListMetricsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
543
- #
544
- # * {Types::ListMetricsOutput#metrics #Metrics} => Array&lt;Types::Metric&gt;
545
- # * {Types::ListMetricsOutput#next_token #NextToken} => String
546
- #
547
- # @example Request syntax with placeholder values
548
- # resp = client.list_metrics({
549
- # namespace: "Namespace",
550
- # metric_name: "MetricName",
551
- # dimensions: [
552
- # {
553
- # name: "DimensionName", # required
554
- # value: "DimensionValue",
555
- # },
556
- # ],
557
- # next_token: "NextToken",
558
- # })
559
- #
560
- # @example Response structure
561
- # resp.metrics #=> Array
562
- # resp.metrics[0].namespace #=> String
563
- # resp.metrics[0].metric_name #=> String
564
- # resp.metrics[0].dimensions #=> Array
565
- # resp.metrics[0].dimensions[0].name #=> String
566
- # resp.metrics[0].dimensions[0].value #=> String
567
- # resp.next_token #=> String
568
- # @overload list_metrics(params = {})
569
- # @param [Hash] params ({})
570
- def list_metrics(params = {}, options = {})
571
- req = build_request(:list_metrics, params)
572
- req.send_request(options)
573
- end
452
+ # Gets statistics for the specified metric.
453
+ #
454
+ # Amazon CloudWatch retains metric data as follows:
455
+ #
456
+ # * Data points with a period of 60 seconds (1 minute) are available for
457
+ # 15 days
458
+ #
459
+ # * Data points with a period of 300 seconds (5 minute) are available
460
+ # for 63 days
461
+ #
462
+ # * Data points with a period of 3600 seconds (1 hour) are available for
463
+ # 455 days (15 months)
464
+ #
465
+ # Note that CloudWatch started retaining 5-minute and 1-hour metric data
466
+ # as of 9 July 2016.
467
+ #
468
+ # The maximum number of data points returned from a single call is
469
+ # 1,440. If you request more than 1,440 data points, Amazon CloudWatch
470
+ # returns an error. To reduce the number of data points, you can narrow
471
+ # the specified time range and make multiple requests across adjacent
472
+ # time ranges, or you can increase the specified period. A period can be
473
+ # as short as one minute (60 seconds). Note that data points are not
474
+ # returned in chronological order.
475
+ #
476
+ # Amazon CloudWatch aggregates data points based on the length of the
477
+ # period that you specify. For example, if you request statistics with a
478
+ # one-hour period, Amazon CloudWatch aggregates all data points with
479
+ # time stamps that fall within each one-hour period. Therefore, the
480
+ # number of values aggregated by CloudWatch is larger than the number of
481
+ # data points returned.
482
+ #
483
+ # CloudWatch needs raw data points to calculate percentile statistics.
484
+ # If you publish data using a statistic set instead, you cannot retrieve
485
+ # percentile statistics for this data unless one of the following
486
+ # conditions is true:
487
+ #
488
+ # * The SampleCount of the statistic set is 1
489
+ #
490
+ # * The Min and the Max of the statistic set are equal
491
+ #
492
+ # For a list of metrics and dimensions supported by AWS services, see
493
+ # the [Amazon CloudWatch Metrics and Dimensions Reference][1] in the
494
+ # *Amazon CloudWatch User Guide*.
495
+ #
496
+ #
497
+ #
498
+ # [1]: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CW_Support_For_AWS.html
499
+ #
500
+ # @option params [required, String] :namespace
501
+ # The namespace of the metric, with or without spaces.
502
+ #
503
+ # @option params [required, String] :metric_name
504
+ # The name of the metric, with or without spaces.
505
+ #
506
+ # @option params [Array<Types::Dimension>] :dimensions
507
+ # The dimensions. If the metric contains multiple dimensions, you must
508
+ # include a value for each dimension. CloudWatch treats each unique
509
+ # combination of dimensions as a separate metric. You can't retrieve
510
+ # statistics using combinations of dimensions that were not specially
511
+ # published. You must specify the same dimensions that were used when
512
+ # the metrics were created. For an example, see [Dimension
513
+ # Combinations][1] in the *Amazon CloudWatch User Guide*. For more
514
+ # information on specifying dimensions, see [Publishing Metrics][2] in
515
+ # the *Amazon CloudWatch User Guide*.
516
+ #
517
+ #
518
+ #
519
+ # [1]: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#dimension-combinations
520
+ # [2]: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html
521
+ #
522
+ # @option params [required, Time,DateTime,Date,Integer,String] :start_time
523
+ # The time stamp that determines the first data point to return. Note
524
+ # that start times are evaluated relative to the time that CloudWatch
525
+ # receives the request.
526
+ #
527
+ # The value specified is inclusive; results include data points with the
528
+ # specified time stamp. The time stamp must be in ISO 8601 UTC format
529
+ # (for example, 2016-10-03T23:00:00Z).
530
+ #
531
+ # CloudWatch rounds the specified time stamp as follows:
532
+ #
533
+ # * Start time less than 15 days ago - Round down to the nearest whole
534
+ # minute. For example, 12:32:34 is rounded down to 12:32:00.
535
+ #
536
+ # * Start time between 15 and 63 days ago - Round down to the nearest
537
+ # 5-minute clock interval. For example, 12:32:34 is rounded down to
538
+ # 12:30:00.
539
+ #
540
+ # * Start time greater than 63 days ago - Round down to the nearest
541
+ # 1-hour clock interval. For example, 12:32:34 is rounded down to
542
+ # 12:00:00.
543
+ #
544
+ # @option params [required, Time,DateTime,Date,Integer,String] :end_time
545
+ # The time stamp that determines the last data point to return.
546
+ #
547
+ # The value specified is exclusive; results will include data points up
548
+ # to the specified time stamp. The time stamp must be in ISO 8601 UTC
549
+ # format (for example, 2016-10-10T23:00:00Z).
550
+ #
551
+ # @option params [required, Integer] :period
552
+ # The granularity, in seconds, of the returned data points. A period can
553
+ # be as short as one minute (60 seconds) and must be a multiple of 60.
554
+ # The default value is 60.
555
+ #
556
+ # If the `StartTime` parameter specifies a time stamp that is greater
557
+ # than 15 days ago, you must specify the period as follows or no data
558
+ # points in that time range is returned:
559
+ #
560
+ # * Start time between 15 and 63 days ago - Use a multiple of 300
561
+ # seconds (5 minutes).
562
+ #
563
+ # * Start time greater than 63 days ago - Use a multiple of 3600 seconds
564
+ # (1 hour).
565
+ #
566
+ # @option params [Array<String>] :statistics
567
+ # The metric statistics, other than percentile. For percentile
568
+ # statistics, use `ExtendedStatistic`.
569
+ #
570
+ # @option params [Array<String>] :extended_statistics
571
+ # The percentile statistics. Specify values between p0.0 and p100.
572
+ #
573
+ # @option params [String] :unit
574
+ # The unit for a given metric. Metrics may be reported in multiple
575
+ # units. Not supplying a unit results in all units being returned. If
576
+ # the metric only ever reports one unit, specifying a unit has no
577
+ # effect.
578
+ #
579
+ # @return [Types::GetMetricStatisticsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
580
+ #
581
+ # * {Types::GetMetricStatisticsOutput#label #label} => String
582
+ # * {Types::GetMetricStatisticsOutput#datapoints #datapoints} => Array&lt;Types::Datapoint&gt;
583
+ #
584
+ # @example Request syntax with placeholder values
585
+ #
586
+ # resp = client.get_metric_statistics({
587
+ # namespace: "Namespace", # required
588
+ # metric_name: "MetricName", # required
589
+ # dimensions: [
590
+ # {
591
+ # name: "DimensionName", # required
592
+ # value: "DimensionValue", # required
593
+ # },
594
+ # ],
595
+ # start_time: Time.now, # required
596
+ # end_time: Time.now, # required
597
+ # period: 1, # required
598
+ # statistics: ["SampleCount"], # accepts SampleCount, Average, Sum, Minimum, Maximum
599
+ # extended_statistics: ["ExtendedStatistic"],
600
+ # unit: "Seconds", # accepts Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None
601
+ # })
602
+ #
603
+ # @example Response structure
604
+ #
605
+ # resp.label #=> String
606
+ # resp.datapoints #=> Array
607
+ # resp.datapoints[0].timestamp #=> Time
608
+ # resp.datapoints[0].sample_count #=> Float
609
+ # resp.datapoints[0].average #=> Float
610
+ # resp.datapoints[0].sum #=> Float
611
+ # resp.datapoints[0].minimum #=> Float
612
+ # resp.datapoints[0].maximum #=> Float
613
+ # resp.datapoints[0].unit #=> String, one of "Seconds", "Microseconds", "Milliseconds", "Bytes", "Kilobytes", "Megabytes", "Gigabytes", "Terabytes", "Bits", "Kilobits", "Megabits", "Gigabits", "Terabits", "Percent", "Count", "Bytes/Second", "Kilobytes/Second", "Megabytes/Second", "Gigabytes/Second", "Terabytes/Second", "Bits/Second", "Kilobits/Second", "Megabits/Second", "Gigabits/Second", "Terabits/Second", "Count/Second", "None"
614
+ # resp.datapoints[0].extended_statistics #=> Hash
615
+ # resp.datapoints[0].extended_statistics["ExtendedStatistic"] #=> Float
616
+ #
617
+ # @see http://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricStatistics AWS API Documentation
618
+ #
619
+ # @overload get_metric_statistics(params = {})
620
+ # @param [Hash] params ({})
621
+ def get_metric_statistics(params = {}, options = {})
622
+ req = build_request(:get_metric_statistics, params)
623
+ req.send_request(options)
624
+ end
574
625
 
575
- # Creates or updates an alarm and associates it with the specified
576
- # metric. Optionally, this operation can associate one or more Amazon
577
- # SNS resources with the alarm.
578
- #
579
- # When this operation creates an alarm, the alarm state is immediately
580
- # set to `INSUFFICIENT_DATA`. The alarm is evaluated and its state is
581
- # set appropriately. Any actions associated with the state are then
582
- # executed.
583
- #
584
- # When you update an existing alarm, its state is left unchanged, but
585
- # the update completely overwrites the previous configuration of the
586
- # alarm.
587
- #
588
- # If you are an AWS Identity and Access Management (IAM) user, you must
589
- # have Amazon EC2 permissions for some operations:
590
- #
591
- # * `ec2:DescribeInstanceStatus` and `ec2:DescribeInstances` for all
592
- # alarms on EC2 instance status metrics
593
- #
594
- # * `ec2:StopInstances` for alarms with stop actions
595
- #
596
- # * `ec2:TerminateInstances` for alarms with terminate actions
597
- #
598
- # * `ec2:DescribeInstanceRecoveryAttribute` and `ec2:RecoverInstances`
599
- # for alarms with recover actions
600
- #
601
- # If you have read/write permissions for Amazon CloudWatch but not for
602
- # Amazon EC2, you can still create an alarm, but the stop or terminate
603
- # actions won't be performed. However, if you are later granted the
604
- # required permissions, the alarm actions that you created earlier will
605
- # be performed.
606
- #
607
- # If you are using an IAM role (for example, an Amazon EC2 instance
608
- # profile), you cannot stop or terminate the instance using alarm
609
- # actions. However, you can still see the alarm state and perform any
610
- # other actions such as Amazon SNS notifications or Auto Scaling
611
- # policies.
612
- #
613
- # If you are using temporary security credentials granted using the AWS
614
- # Security Token Service (AWS STS), you cannot stop or terminate an
615
- # Amazon EC2 instance using alarm actions.
616
- #
617
- # Note that you must create at least one stop, terminate, or reboot
618
- # alarm using the Amazon EC2 or CloudWatch console to create the
619
- # **EC2ActionsAccess** IAM role. After this IAM role is created, you can
620
- # create stop, terminate, or reboot alarms using a command-line
621
- # interface or an API.
622
- # @option params [required, String] :alarm_name
623
- # The name for the alarm. This name must be unique within the AWS
624
- # account.
625
- # @option params [String] :alarm_description
626
- # The description for the alarm.
627
- # @option params [Boolean] :actions_enabled
628
- # Indicates whether actions should be executed during any changes to the
629
- # alarm state.
630
- # @option params [Array<String>] :ok_actions
631
- # The actions to execute when this alarm transitions to an `OK` state
632
- # from any other state. Each action is specified as an Amazon Resource
633
- # Name (ARN).
634
- #
635
- # Valid Values: arn:aws:automate:*region*\:ec2:stop \|
636
- # arn:aws:automate:*region*\:ec2:terminate \|
637
- # arn:aws:automate:*region*\:ec2:recover
638
- #
639
- # Valid Values (for use with IAM roles):
640
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Stop/1.0
641
- # \|
642
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Terminate/1.0
643
- # \|
644
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Reboot/1.0
645
- # @option params [Array<String>] :alarm_actions
646
- # The actions to execute when this alarm transitions to the `ALARM`
647
- # state from any other state. Each action is specified as an Amazon
648
- # Resource Name (ARN).
649
- #
650
- # Valid Values: arn:aws:automate:*region*\:ec2:stop \|
651
- # arn:aws:automate:*region*\:ec2:terminate \|
652
- # arn:aws:automate:*region*\:ec2:recover
653
- #
654
- # Valid Values (for use with IAM roles):
655
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Stop/1.0
656
- # \|
657
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Terminate/1.0
658
- # \|
659
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Reboot/1.0
660
- # @option params [Array<String>] :insufficient_data_actions
661
- # The actions to execute when this alarm transitions to the
662
- # `INSUFFICIENT_DATA` state from any other state. Each action is
663
- # specified as an Amazon Resource Name (ARN).
664
- #
665
- # Valid Values: arn:aws:automate:*region*\:ec2:stop \|
666
- # arn:aws:automate:*region*\:ec2:terminate \|
667
- # arn:aws:automate:*region*\:ec2:recover
668
- #
669
- # Valid Values (for use with IAM roles):
670
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Stop/1.0
671
- # \|
672
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Terminate/1.0
673
- # \|
674
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Reboot/1.0
675
- # @option params [required, String] :metric_name
676
- # The name for the metric associated with the alarm.
677
- # @option params [required, String] :namespace
678
- # The namespace for the metric associated with the alarm.
679
- # @option params [String] :statistic
680
- # The statistic for the metric associated with the alarm, other than
681
- # percentile. For percentile statistics, use `ExtendedStatistic`.
682
- # @option params [String] :extended_statistic
683
- # The percentile statistic for the metric associated with the alarm.
684
- # Specify a value between p0.0 and p100.
685
- # @option params [Array<Types::Dimension>] :dimensions
686
- # The dimensions for the metric associated with the alarm.
687
- # @option params [required, Integer] :period
688
- # The period, in seconds, over which the specified statistic is applied.
689
- # @option params [String] :unit
690
- # The unit of measure for the statistic. For example, the units for the
691
- # Amazon EC2 NetworkIn metric are Bytes because NetworkIn tracks the
692
- # number of bytes that an instance receives on all network interfaces.
693
- # You can also specify a unit when you create a custom metric. Units
694
- # help provide conceptual meaning to your data. Metric data points that
695
- # specify a unit of measure, such as Percent, are aggregated separately.
696
- #
697
- # If you specify a unit, you must use a unit that is appropriate for the
698
- # metric. Otherwise, the Amazon CloudWatch alarm can get stuck in the
699
- # `INSUFFICIENT DATA` state.
700
- # @option params [required, Integer] :evaluation_periods
701
- # The number of periods over which data is compared to the specified
702
- # threshold.
703
- # @option params [required, Float] :threshold
704
- # The value against which the specified statistic is compared.
705
- # @option params [required, String] :comparison_operator
706
- # The arithmetic operation to use when comparing the specified statistic
707
- # and threshold. The specified statistic value is used as the first
708
- # operand.
709
- # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
710
- #
711
- # @example Request syntax with placeholder values
712
- # resp = client.put_metric_alarm({
713
- # alarm_name: "AlarmName", # required
714
- # alarm_description: "AlarmDescription",
715
- # actions_enabled: false,
716
- # ok_actions: ["ResourceName"],
717
- # alarm_actions: ["ResourceName"],
718
- # insufficient_data_actions: ["ResourceName"],
719
- # metric_name: "MetricName", # required
720
- # namespace: "Namespace", # required
721
- # statistic: "SampleCount", # accepts SampleCount, Average, Sum, Minimum, Maximum
722
- # extended_statistic: "ExtendedStatistic",
723
- # dimensions: [
724
- # {
725
- # name: "DimensionName", # required
726
- # value: "DimensionValue", # required
727
- # },
728
- # ],
729
- # period: 1, # required
730
- # unit: "Seconds", # accepts Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None
731
- # evaluation_periods: 1, # required
732
- # threshold: 1.0, # required
733
- # comparison_operator: "GreaterThanOrEqualToThreshold", # required, accepts GreaterThanOrEqualToThreshold, GreaterThanThreshold, LessThanThreshold, LessThanOrEqualToThreshold
734
- # })
735
- # @overload put_metric_alarm(params = {})
736
- # @param [Hash] params ({})
737
- def put_metric_alarm(params = {}, options = {})
738
- req = build_request(:put_metric_alarm, params)
739
- req.send_request(options)
740
- end
626
+ # List the specified metrics. You can use the returned metrics with
627
+ # GetMetricStatistics to obtain statistical data.
628
+ #
629
+ # Up to 500 results are returned for any one call. To retrieve
630
+ # additional results, use the returned token with subsequent calls.
631
+ #
632
+ # After you create a metric, allow up to fifteen minutes before the
633
+ # metric appears. Statistics about the metric, however, are available
634
+ # sooner using GetMetricStatistics.
635
+ #
636
+ # @option params [String] :namespace
637
+ # The namespace to filter against.
638
+ #
639
+ # @option params [String] :metric_name
640
+ # The name of the metric to filter against.
641
+ #
642
+ # @option params [Array<Types::DimensionFilter>] :dimensions
643
+ # The dimensions to filter against.
644
+ #
645
+ # @option params [String] :next_token
646
+ # The token returned by a previous call to indicate that there is more
647
+ # data available.
648
+ #
649
+ # @return [Types::ListMetricsOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
650
+ #
651
+ # * {Types::ListMetricsOutput#metrics #metrics} => Array&lt;Types::Metric&gt;
652
+ # * {Types::ListMetricsOutput#next_token #next_token} => String
653
+ #
654
+ # @example Request syntax with placeholder values
655
+ #
656
+ # resp = client.list_metrics({
657
+ # namespace: "Namespace",
658
+ # metric_name: "MetricName",
659
+ # dimensions: [
660
+ # {
661
+ # name: "DimensionName", # required
662
+ # value: "DimensionValue",
663
+ # },
664
+ # ],
665
+ # next_token: "NextToken",
666
+ # })
667
+ #
668
+ # @example Response structure
669
+ #
670
+ # resp.metrics #=> Array
671
+ # resp.metrics[0].namespace #=> String
672
+ # resp.metrics[0].metric_name #=> String
673
+ # resp.metrics[0].dimensions #=> Array
674
+ # resp.metrics[0].dimensions[0].name #=> String
675
+ # resp.metrics[0].dimensions[0].value #=> String
676
+ # resp.next_token #=> String
677
+ #
678
+ # @see http://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetrics AWS API Documentation
679
+ #
680
+ # @overload list_metrics(params = {})
681
+ # @param [Hash] params ({})
682
+ def list_metrics(params = {}, options = {})
683
+ req = build_request(:list_metrics, params)
684
+ req.send_request(options)
685
+ end
741
686
 
742
- # Publishes metric data points to Amazon CloudWatch. Amazon CloudWatch
743
- # associates the data points with the specified metric. If the specified
744
- # metric does not exist, Amazon CloudWatch creates the metric. When
745
- # Amazon CloudWatch creates a metric, it can take up to fifteen minutes
746
- # for the metric to appear in calls to ListMetrics.
747
- #
748
- # Each `PutMetricData` request is limited to 8 KB in size for HTTP GET
749
- # requests and is limited to 40 KB in size for HTTP POST requests.
750
- #
751
- # Although the `Value` parameter accepts numbers of type `Double`,
752
- # Amazon CloudWatch rejects values that are either too small or too
753
- # large. Values must be in the range of 8.515920e-109 to 1.174271e+108
754
- # (Base 10) or 2e-360 to 2e360 (Base 2). In addition, special values
755
- # (e.g., NaN, +Infinity, -Infinity) are not supported.
756
- #
757
- # Data points with time stamps from 24 hours ago or longer can take at
758
- # least 48 hours to become available for GetMetricStatistics from the
759
- # time they are submitted.
760
- # @option params [required, String] :namespace
761
- # The namespace for the metric data.
762
- #
763
- # You cannot specify a namespace that begins with "AWS/". Namespaces
764
- # that begin with "AWS/" are reserved for use by Amazon Web Services
765
- # products.
766
- # @option params [required, Array<Types::MetricDatum>] :metric_data
767
- # The data for the metric.
768
- # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
769
- #
770
- # @example Request syntax with placeholder values
771
- # resp = client.put_metric_data({
772
- # namespace: "Namespace", # required
773
- # metric_data: [ # required
774
- # {
775
- # metric_name: "MetricName", # required
776
- # dimensions: [
777
- # {
778
- # name: "DimensionName", # required
779
- # value: "DimensionValue", # required
780
- # },
781
- # ],
782
- # timestamp: Time.now,
783
- # value: 1.0,
784
- # statistic_values: {
785
- # sample_count: 1.0, # required
786
- # sum: 1.0, # required
787
- # minimum: 1.0, # required
788
- # maximum: 1.0, # required
789
- # },
790
- # unit: "Seconds", # accepts Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None
791
- # },
792
- # ],
793
- # })
794
- # @overload put_metric_data(params = {})
795
- # @param [Hash] params ({})
796
- def put_metric_data(params = {}, options = {})
797
- req = build_request(:put_metric_data, params)
798
- req.send_request(options)
799
- end
687
+ # Creates or updates an alarm and associates it with the specified
688
+ # metric. Optionally, this operation can associate one or more Amazon
689
+ # SNS resources with the alarm.
690
+ #
691
+ # When this operation creates an alarm, the alarm state is immediately
692
+ # set to `INSUFFICIENT_DATA`. The alarm is evaluated and its state is
693
+ # set appropriately. Any actions associated with the state are then
694
+ # executed.
695
+ #
696
+ # When you update an existing alarm, its state is left unchanged, but
697
+ # the update completely overwrites the previous configuration of the
698
+ # alarm.
699
+ #
700
+ # If you are an AWS Identity and Access Management (IAM) user, you must
701
+ # have Amazon EC2 permissions for some operations:
702
+ #
703
+ # * `ec2:DescribeInstanceStatus` and `ec2:DescribeInstances` for all
704
+ # alarms on EC2 instance status metrics
705
+ #
706
+ # * `ec2:StopInstances` for alarms with stop actions
707
+ #
708
+ # * `ec2:TerminateInstances` for alarms with terminate actions
709
+ #
710
+ # * `ec2:DescribeInstanceRecoveryAttribute` and `ec2:RecoverInstances`
711
+ # for alarms with recover actions
712
+ #
713
+ # If you have read/write permissions for Amazon CloudWatch but not for
714
+ # Amazon EC2, you can still create an alarm, but the stop or terminate
715
+ # actions won't be performed. However, if you are later granted the
716
+ # required permissions, the alarm actions that you created earlier will
717
+ # be performed.
718
+ #
719
+ # If you are using an IAM role (for example, an Amazon EC2 instance
720
+ # profile), you cannot stop or terminate the instance using alarm
721
+ # actions. However, you can still see the alarm state and perform any
722
+ # other actions such as Amazon SNS notifications or Auto Scaling
723
+ # policies.
724
+ #
725
+ # If you are using temporary security credentials granted using the AWS
726
+ # Security Token Service (AWS STS), you cannot stop or terminate an
727
+ # Amazon EC2 instance using alarm actions.
728
+ #
729
+ # Note that you must create at least one stop, terminate, or reboot
730
+ # alarm using the Amazon EC2 or CloudWatch console to create the
731
+ # **EC2ActionsAccess** IAM role. After this IAM role is created, you can
732
+ # create stop, terminate, or reboot alarms using a command-line
733
+ # interface or an API.
734
+ #
735
+ # @option params [required, String] :alarm_name
736
+ # The name for the alarm. This name must be unique within the AWS
737
+ # account.
738
+ #
739
+ # @option params [String] :alarm_description
740
+ # The description for the alarm.
741
+ #
742
+ # @option params [Boolean] :actions_enabled
743
+ # Indicates whether actions should be executed during any changes to the
744
+ # alarm state.
745
+ #
746
+ # @option params [Array<String>] :ok_actions
747
+ # The actions to execute when this alarm transitions to an `OK` state
748
+ # from any other state. Each action is specified as an Amazon Resource
749
+ # Name (ARN).
750
+ #
751
+ # Valid Values: arn:aws:automate:*region*\:ec2:stop \|
752
+ # arn:aws:automate:*region*\:ec2:terminate \|
753
+ # arn:aws:automate:*region*\:ec2:recover
754
+ #
755
+ # Valid Values (for use with IAM roles):
756
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Stop/1.0
757
+ # \|
758
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Terminate/1.0
759
+ # \|
760
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Reboot/1.0
761
+ #
762
+ # @option params [Array<String>] :alarm_actions
763
+ # The actions to execute when this alarm transitions to the `ALARM`
764
+ # state from any other state. Each action is specified as an Amazon
765
+ # Resource Name (ARN).
766
+ #
767
+ # Valid Values: arn:aws:automate:*region*\:ec2:stop \|
768
+ # arn:aws:automate:*region*\:ec2:terminate \|
769
+ # arn:aws:automate:*region*\:ec2:recover
770
+ #
771
+ # Valid Values (for use with IAM roles):
772
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Stop/1.0
773
+ # \|
774
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Terminate/1.0
775
+ # \|
776
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Reboot/1.0
777
+ #
778
+ # @option params [Array<String>] :insufficient_data_actions
779
+ # The actions to execute when this alarm transitions to the
780
+ # `INSUFFICIENT_DATA` state from any other state. Each action is
781
+ # specified as an Amazon Resource Name (ARN).
782
+ #
783
+ # Valid Values: arn:aws:automate:*region*\:ec2:stop \|
784
+ # arn:aws:automate:*region*\:ec2:terminate \|
785
+ # arn:aws:automate:*region*\:ec2:recover
786
+ #
787
+ # Valid Values (for use with IAM roles):
788
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Stop/1.0
789
+ # \|
790
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Terminate/1.0
791
+ # \|
792
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Reboot/1.0
793
+ #
794
+ # @option params [required, String] :metric_name
795
+ # The name for the metric associated with the alarm.
796
+ #
797
+ # @option params [required, String] :namespace
798
+ # The namespace for the metric associated with the alarm.
799
+ #
800
+ # @option params [String] :statistic
801
+ # The statistic for the metric associated with the alarm, other than
802
+ # percentile. For percentile statistics, use `ExtendedStatistic`.
803
+ #
804
+ # @option params [String] :extended_statistic
805
+ # The percentile statistic for the metric associated with the alarm.
806
+ # Specify a value between p0.0 and p100.
807
+ #
808
+ # @option params [Array<Types::Dimension>] :dimensions
809
+ # The dimensions for the metric associated with the alarm.
810
+ #
811
+ # @option params [required, Integer] :period
812
+ # The period, in seconds, over which the specified statistic is applied.
813
+ #
814
+ # @option params [String] :unit
815
+ # The unit of measure for the statistic. For example, the units for the
816
+ # Amazon EC2 NetworkIn metric are Bytes because NetworkIn tracks the
817
+ # number of bytes that an instance receives on all network interfaces.
818
+ # You can also specify a unit when you create a custom metric. Units
819
+ # help provide conceptual meaning to your data. Metric data points that
820
+ # specify a unit of measure, such as Percent, are aggregated separately.
821
+ #
822
+ # If you specify a unit, you must use a unit that is appropriate for the
823
+ # metric. Otherwise, the Amazon CloudWatch alarm can get stuck in the
824
+ # `INSUFFICIENT DATA` state.
825
+ #
826
+ # @option params [required, Integer] :evaluation_periods
827
+ # The number of periods over which data is compared to the specified
828
+ # threshold.
829
+ #
830
+ # @option params [required, Float] :threshold
831
+ # The value against which the specified statistic is compared.
832
+ #
833
+ # @option params [required, String] :comparison_operator
834
+ # The arithmetic operation to use when comparing the specified statistic
835
+ # and threshold. The specified statistic value is used as the first
836
+ # operand.
837
+ #
838
+ # @option params [String] :treat_missing_data
839
+ # Sets how this alarm is to handle missing data points. If
840
+ # `TreatMissingData` is omitted, the default behavior of `missing` is
841
+ # used. For more information, see [Configuring How CloudWatch Alarms
842
+ # Treats Missing Data][1].
843
+ #
844
+ # Valid Values: `breaching | notBreaching | ignore | missing`
845
+ #
846
+ #
847
+ #
848
+ # [1]: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data
849
+ #
850
+ # @option params [String] :evaluate_low_sample_count_percentile
851
+ # Used only for alarms based on percentiles. If you specify `ignore`,
852
+ # the alarm state will not change during periods with too few data
853
+ # points to be statistically significant. If you specify `evaluate` or
854
+ # omit this parameter, the alarm will always be evaluated and possibly
855
+ # change state no matter how many data points are available. For more
856
+ # information, see [Percentile-Based CloudWatch Alarms and Low Data
857
+ # Samples][1].
858
+ #
859
+ # Valid Values: `evaluate | ignore`
860
+ #
861
+ #
862
+ #
863
+ # [1]: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#percentiles-with-low-samples
864
+ #
865
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
866
+ #
867
+ # @example Request syntax with placeholder values
868
+ #
869
+ # resp = client.put_metric_alarm({
870
+ # alarm_name: "AlarmName", # required
871
+ # alarm_description: "AlarmDescription",
872
+ # actions_enabled: false,
873
+ # ok_actions: ["ResourceName"],
874
+ # alarm_actions: ["ResourceName"],
875
+ # insufficient_data_actions: ["ResourceName"],
876
+ # metric_name: "MetricName", # required
877
+ # namespace: "Namespace", # required
878
+ # statistic: "SampleCount", # accepts SampleCount, Average, Sum, Minimum, Maximum
879
+ # extended_statistic: "ExtendedStatistic",
880
+ # dimensions: [
881
+ # {
882
+ # name: "DimensionName", # required
883
+ # value: "DimensionValue", # required
884
+ # },
885
+ # ],
886
+ # period: 1, # required
887
+ # unit: "Seconds", # accepts Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None
888
+ # evaluation_periods: 1, # required
889
+ # threshold: 1.0, # required
890
+ # comparison_operator: "GreaterThanOrEqualToThreshold", # required, accepts GreaterThanOrEqualToThreshold, GreaterThanThreshold, LessThanThreshold, LessThanOrEqualToThreshold
891
+ # treat_missing_data: "TreatMissingData",
892
+ # evaluate_low_sample_count_percentile: "EvaluateLowSampleCountPercentile",
893
+ # })
894
+ #
895
+ # @see http://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricAlarm AWS API Documentation
896
+ #
897
+ # @overload put_metric_alarm(params = {})
898
+ # @param [Hash] params ({})
899
+ def put_metric_alarm(params = {}, options = {})
900
+ req = build_request(:put_metric_alarm, params)
901
+ req.send_request(options)
902
+ end
800
903
 
801
- # Temporarily sets the state of an alarm for testing purposes. When the
802
- # updated state differs from the previous value, the action configured
803
- # for the appropriate state is invoked. For example, if your alarm is
804
- # configured to send an Amazon SNS message when an alarm is triggered,
805
- # temporarily changing the alarm state to `ALARM` sends an Amazon SNS
806
- # message. The alarm returns to its actual state (often within seconds).
807
- # Because the alarm state change happens very quickly, it is typically
808
- # only visible in the alarm's **History** tab in the Amazon CloudWatch
809
- # console or through DescribeAlarmHistory.
810
- # @option params [required, String] :alarm_name
811
- # The name for the alarm. This name must be unique within the AWS
812
- # account. The maximum length is 255 characters.
813
- # @option params [required, String] :state_value
814
- # The value of the state.
815
- # @option params [required, String] :state_reason
816
- # The reason that this alarm is set to this specific state, in text
817
- # format.
818
- # @option params [String] :state_reason_data
819
- # The reason that this alarm is set to this specific state, in JSON
820
- # format.
821
- # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
822
- #
823
- # @example Request syntax with placeholder values
824
- # resp = client.set_alarm_state({
825
- # alarm_name: "AlarmName", # required
826
- # state_value: "OK", # required, accepts OK, ALARM, INSUFFICIENT_DATA
827
- # state_reason: "StateReason", # required
828
- # state_reason_data: "StateReasonData",
829
- # })
830
- # @overload set_alarm_state(params = {})
831
- # @param [Hash] params ({})
832
- def set_alarm_state(params = {}, options = {})
833
- req = build_request(:set_alarm_state, params)
834
- req.send_request(options)
835
- end
904
+ # Publishes metric data points to Amazon CloudWatch. Amazon CloudWatch
905
+ # associates the data points with the specified metric. If the specified
906
+ # metric does not exist, Amazon CloudWatch creates the metric. When
907
+ # Amazon CloudWatch creates a metric, it can take up to fifteen minutes
908
+ # for the metric to appear in calls to ListMetrics.
909
+ #
910
+ # Each `PutMetricData` request is limited to 40 KB in size for HTTP POST
911
+ # requests.
912
+ #
913
+ # Although the `Value` parameter accepts numbers of type `Double`,
914
+ # Amazon CloudWatch rejects values that are either too small or too
915
+ # large. Values must be in the range of 8.515920e-109 to 1.174271e+108
916
+ # (Base 10) or 2e-360 to 2e360 (Base 2). In addition, special values
917
+ # (e.g., NaN, +Infinity, -Infinity) are not supported.
918
+ #
919
+ # You can use up to 10 dimensions per metric to further clarify what
920
+ # data the metric collects. For more information on specifying
921
+ # dimensions, see [Publishing Metrics][1] in the *Amazon CloudWatch User
922
+ # Guide*.
923
+ #
924
+ # Data points with time stamps from 24 hours ago or longer can take at
925
+ # least 48 hours to become available for GetMetricStatistics from the
926
+ # time they are submitted.
927
+ #
928
+ # CloudWatch needs raw data points to calculate percentile statistics.
929
+ # If you publish data using a statistic set instead, you cannot retrieve
930
+ # percentile statistics for this data unless one of the following
931
+ # conditions is true:
932
+ #
933
+ # * The SampleCount of the statistic set is 1
934
+ #
935
+ # * The Min and the Max of the statistic set are equal
936
+ #
937
+ #
938
+ #
939
+ # [1]: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html
940
+ #
941
+ # @option params [required, String] :namespace
942
+ # The namespace for the metric data.
943
+ #
944
+ # You cannot specify a namespace that begins with "AWS/". Namespaces
945
+ # that begin with "AWS/" are reserved for use by Amazon Web Services
946
+ # products.
947
+ #
948
+ # @option params [required, Array<Types::MetricDatum>] :metric_data
949
+ # The data for the metric.
950
+ #
951
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
952
+ #
953
+ # @example Request syntax with placeholder values
954
+ #
955
+ # resp = client.put_metric_data({
956
+ # namespace: "Namespace", # required
957
+ # metric_data: [ # required
958
+ # {
959
+ # metric_name: "MetricName", # required
960
+ # dimensions: [
961
+ # {
962
+ # name: "DimensionName", # required
963
+ # value: "DimensionValue", # required
964
+ # },
965
+ # ],
966
+ # timestamp: Time.now,
967
+ # value: 1.0,
968
+ # statistic_values: {
969
+ # sample_count: 1.0, # required
970
+ # sum: 1.0, # required
971
+ # minimum: 1.0, # required
972
+ # maximum: 1.0, # required
973
+ # },
974
+ # unit: "Seconds", # accepts Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None
975
+ # },
976
+ # ],
977
+ # })
978
+ #
979
+ # @see http://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricData AWS API Documentation
980
+ #
981
+ # @overload put_metric_data(params = {})
982
+ # @param [Hash] params ({})
983
+ def put_metric_data(params = {}, options = {})
984
+ req = build_request(:put_metric_data, params)
985
+ req.send_request(options)
986
+ end
836
987
 
837
- # @!endgroup
988
+ # Temporarily sets the state of an alarm for testing purposes. When the
989
+ # updated state differs from the previous value, the action configured
990
+ # for the appropriate state is invoked. For example, if your alarm is
991
+ # configured to send an Amazon SNS message when an alarm is triggered,
992
+ # temporarily changing the alarm state to `ALARM` sends an Amazon SNS
993
+ # message. The alarm returns to its actual state (often within seconds).
994
+ # Because the alarm state change happens very quickly, it is typically
995
+ # only visible in the alarm's **History** tab in the Amazon CloudWatch
996
+ # console or through DescribeAlarmHistory.
997
+ #
998
+ # @option params [required, String] :alarm_name
999
+ # The name for the alarm. This name must be unique within the AWS
1000
+ # account. The maximum length is 255 characters.
1001
+ #
1002
+ # @option params [required, String] :state_value
1003
+ # The value of the state.
1004
+ #
1005
+ # @option params [required, String] :state_reason
1006
+ # The reason that this alarm is set to this specific state, in text
1007
+ # format.
1008
+ #
1009
+ # @option params [String] :state_reason_data
1010
+ # The reason that this alarm is set to this specific state, in JSON
1011
+ # format.
1012
+ #
1013
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
1014
+ #
1015
+ # @example Request syntax with placeholder values
1016
+ #
1017
+ # resp = client.set_alarm_state({
1018
+ # alarm_name: "AlarmName", # required
1019
+ # state_value: "OK", # required, accepts OK, ALARM, INSUFFICIENT_DATA
1020
+ # state_reason: "StateReason", # required
1021
+ # state_reason_data: "StateReasonData",
1022
+ # })
1023
+ #
1024
+ # @see http://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/SetAlarmState AWS API Documentation
1025
+ #
1026
+ # @overload set_alarm_state(params = {})
1027
+ # @param [Hash] params ({})
1028
+ def set_alarm_state(params = {}, options = {})
1029
+ req = build_request(:set_alarm_state, params)
1030
+ req.send_request(options)
1031
+ end
838
1032
 
839
- # @param params ({})
840
- # @api private
841
- def build_request(operation_name, params = {})
842
- handlers = @handlers.for(operation_name)
843
- context = Seahorse::Client::RequestContext.new(
844
- operation_name: operation_name,
845
- operation: config.api.operation(operation_name),
846
- client: self,
847
- params: params,
848
- config: config)
849
- context[:gem_name] = 'aws-sdk-cloudwatch'
850
- context[:gem_version] = '1.0.0.rc1'
851
- Seahorse::Client::Request.new(handlers, context)
852
- end
1033
+ # @!endgroup
853
1034
 
854
- # Polls an API operation until a resource enters a desired state.
855
- #
856
- # ## Basic Usage
857
- #
858
- # A waiter will call an API operation until:
859
- #
860
- # * It is successful
861
- # * It enters a terminal state
862
- # * It makes the maximum number of attempts
863
- #
864
- # In between attempts, the waiter will sleep.
865
- #
866
- # # polls in a loop, sleeping between attempts
867
- # client.waiter_until(waiter_name, params)
868
- #
869
- # ## Configuration
870
- #
871
- # You can configure the maximum number of polling attempts, and the
872
- # delay (in seconds) between each polling attempt. You can pass
873
- # configuration as the final arguments hash.
874
- #
875
- # # poll for ~25 seconds
876
- # client.wait_until(waiter_name, params, {
877
- # max_attempts: 5,
878
- # delay: 5,
879
- # })
880
- #
881
- # ## Callbacks
882
- #
883
- # You can be notified before each polling attempt and before each
884
- # delay. If you throw `:success` or `:failure` from these callbacks,
885
- # it will terminate the waiter.
886
- #
887
- # started_at = Time.now
888
- # client.wait_until(waiter_name, params, {
889
- #
890
- # # disable max attempts
891
- # max_attempts: nil,
892
- #
893
- # # poll for 1 hour, instead of a number of attempts
894
- # before_wait: -> (attempts, response) do
895
- # throw :failure if Time.now - started_at > 3600
896
- # end
897
- # })
898
- #
899
- # ## Handling Errors
900
- #
901
- # When a waiter is unsuccessful, it will raise an error.
902
- # All of the failure errors extend from
903
- # {Aws::Waiters::Errors::WaiterFailed}.
904
- #
905
- # begin
906
- # client.wait_until(...)
907
- # rescue Aws::Waiters::Errors::WaiterFailed
908
- # # resource did not enter the desired state in time
909
- # end
910
- #
911
- # ## Valid Waiters
912
- #
913
- # The following table lists the valid waiter names, the operations they call,
914
- # and the default `:delay` and `:max_attempts` values.
915
- #
916
- # | waiter_name | params | :delay | :max_attempts |
917
- # | ------------ | ------------------ | -------- | ------------- |
918
- # | alarm_exists | {#describe_alarms} | 5 | 40 |
919
- #
920
- # @raise [Errors::FailureStateError] Raised when the waiter terminates
921
- # because the waiter has entered a state that it will not transition
922
- # out of, preventing success.
923
- #
924
- # @raise [Errors::TooManyAttemptsError] Raised when the configured
925
- # maximum number of attempts have been made, and the waiter is not
926
- # yet successful.
927
- #
928
- # @raise [Errors::UnexpectedError] Raised when an error is encounted
929
- # while polling for a resource that is not expected.
930
- #
931
- # @raise [Errors::NoSuchWaiterError] Raised when you request to wait
932
- # for an unknown state.
933
- #
934
- # @return [Boolean] Returns `true` if the waiter was successful.
935
- # @param [Symbol] waiter_name
936
- # @param [Hash] params ({})
937
- # @param [Hash] options ({})
938
- # @option options [Integer] :max_attempts
939
- # @option options [Integer] :delay
940
- # @option options [Proc] :before_attempt
941
- # @option options [Proc] :before_wait
942
- def wait_until(waiter_name, params = {}, options = {})
943
- w = waiter(waiter_name, options)
944
- yield(w.waiter) if block_given? # deprecated
945
- w.wait(params)
946
- end
1035
+ # @param params ({})
1036
+ # @api private
1037
+ def build_request(operation_name, params = {})
1038
+ handlers = @handlers.for(operation_name)
1039
+ context = Seahorse::Client::RequestContext.new(
1040
+ operation_name: operation_name,
1041
+ operation: config.api.operation(operation_name),
1042
+ client: self,
1043
+ params: params,
1044
+ config: config)
1045
+ context[:gem_name] = 'aws-sdk-cloudwatch'
1046
+ context[:gem_version] = '1.0.0.rc2'
1047
+ Seahorse::Client::Request.new(handlers, context)
1048
+ end
947
1049
 
948
- # @api private
949
- # @deprecated
950
- def waiter_names
951
- waiters.keys
952
- end
1050
+ # Polls an API operation until a resource enters a desired state.
1051
+ #
1052
+ # ## Basic Usage
1053
+ #
1054
+ # A waiter will call an API operation until:
1055
+ #
1056
+ # * It is successful
1057
+ # * It enters a terminal state
1058
+ # * It makes the maximum number of attempts
1059
+ #
1060
+ # In between attempts, the waiter will sleep.
1061
+ #
1062
+ # # polls in a loop, sleeping between attempts
1063
+ # client.waiter_until(waiter_name, params)
1064
+ #
1065
+ # ## Configuration
1066
+ #
1067
+ # You can configure the maximum number of polling attempts, and the
1068
+ # delay (in seconds) between each polling attempt. You can pass
1069
+ # configuration as the final arguments hash.
1070
+ #
1071
+ # # poll for ~25 seconds
1072
+ # client.wait_until(waiter_name, params, {
1073
+ # max_attempts: 5,
1074
+ # delay: 5,
1075
+ # })
1076
+ #
1077
+ # ## Callbacks
1078
+ #
1079
+ # You can be notified before each polling attempt and before each
1080
+ # delay. If you throw `:success` or `:failure` from these callbacks,
1081
+ # it will terminate the waiter.
1082
+ #
1083
+ # started_at = Time.now
1084
+ # client.wait_until(waiter_name, params, {
1085
+ #
1086
+ # # disable max attempts
1087
+ # max_attempts: nil,
1088
+ #
1089
+ # # poll for 1 hour, instead of a number of attempts
1090
+ # before_wait: -> (attempts, response) do
1091
+ # throw :failure if Time.now - started_at > 3600
1092
+ # end
1093
+ # })
1094
+ #
1095
+ # ## Handling Errors
1096
+ #
1097
+ # When a waiter is unsuccessful, it will raise an error.
1098
+ # All of the failure errors extend from
1099
+ # {Aws::Waiters::Errors::WaiterFailed}.
1100
+ #
1101
+ # begin
1102
+ # client.wait_until(...)
1103
+ # rescue Aws::Waiters::Errors::WaiterFailed
1104
+ # # resource did not enter the desired state in time
1105
+ # end
1106
+ #
1107
+ # ## Valid Waiters
1108
+ #
1109
+ # The following table lists the valid waiter names, the operations they call,
1110
+ # and the default `:delay` and `:max_attempts` values.
1111
+ #
1112
+ # | waiter_name | params | :delay | :max_attempts |
1113
+ # | ------------ | ------------------ | -------- | ------------- |
1114
+ # | alarm_exists | {#describe_alarms} | 5 | 40 |
1115
+ #
1116
+ # @raise [Errors::FailureStateError] Raised when the waiter terminates
1117
+ # because the waiter has entered a state that it will not transition
1118
+ # out of, preventing success.
1119
+ #
1120
+ # @raise [Errors::TooManyAttemptsError] Raised when the configured
1121
+ # maximum number of attempts have been made, and the waiter is not
1122
+ # yet successful.
1123
+ #
1124
+ # @raise [Errors::UnexpectedError] Raised when an error is encounted
1125
+ # while polling for a resource that is not expected.
1126
+ #
1127
+ # @raise [Errors::NoSuchWaiterError] Raised when you request to wait
1128
+ # for an unknown state.
1129
+ #
1130
+ # @return [Boolean] Returns `true` if the waiter was successful.
1131
+ # @param [Symbol] waiter_name
1132
+ # @param [Hash] params ({})
1133
+ # @param [Hash] options ({})
1134
+ # @option options [Integer] :max_attempts
1135
+ # @option options [Integer] :delay
1136
+ # @option options [Proc] :before_attempt
1137
+ # @option options [Proc] :before_wait
1138
+ def wait_until(waiter_name, params = {}, options = {})
1139
+ w = waiter(waiter_name, options)
1140
+ yield(w.waiter) if block_given? # deprecated
1141
+ w.wait(params)
1142
+ end
953
1143
 
954
- private
1144
+ # @api private
1145
+ # @deprecated
1146
+ def waiter_names
1147
+ waiters.keys
1148
+ end
955
1149
 
956
- # @param [Symbol] waiter_name
957
- # @param [Hash] options ({})
958
- def waiter(waiter_name, options = {})
959
- waiter_class = waiters[waiter_name]
960
- if waiter_class
961
- waiter_class.new(options.merge(client: self))
962
- else
963
- raise Aws::Waiters::Errors::NoSuchWaiterError.new(waiter_name, waiters.keys)
964
- end
965
- end
1150
+ private
966
1151
 
967
- def waiters
968
- {
969
- alarm_exists: Waiters::AlarmExists
970
- }
1152
+ # @param [Symbol] waiter_name
1153
+ # @param [Hash] options ({})
1154
+ def waiter(waiter_name, options = {})
1155
+ waiter_class = waiters[waiter_name]
1156
+ if waiter_class
1157
+ waiter_class.new(options.merge(client: self))
1158
+ else
1159
+ raise Aws::Waiters::Errors::NoSuchWaiterError.new(waiter_name, waiters.keys)
971
1160
  end
1161
+ end
972
1162
 
973
- class << self
1163
+ def waiters
1164
+ {
1165
+ alarm_exists: Waiters::AlarmExists
1166
+ }
1167
+ end
974
1168
 
975
- # @api private
976
- attr_reader :identifier
1169
+ class << self
977
1170
 
978
- # @api private
979
- def errors_module
980
- Errors
981
- end
1171
+ # @api private
1172
+ attr_reader :identifier
982
1173
 
1174
+ # @api private
1175
+ def errors_module
1176
+ Errors
983
1177
  end
1178
+
984
1179
  end
985
1180
  end
986
1181
  end