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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,14 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
3
+ # This file is generated. See the contributing guide for more information:
4
4
  # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
5
  #
6
6
  # WARNING ABOUT GENERATED CODE
7
7
 
8
- module Aws
9
- module CloudWatch
10
- module Errors
8
+ module Aws::CloudWatch
9
+ module Errors
11
10
 
12
- extend Aws::Errors::DynamicErrors
11
+ extend Aws::Errors::DynamicErrors
13
12
 
14
- # Raised when calling #load or #data on a resource class that can not be
15
- # loaded. This can happen when:
16
- #
17
- # * A resource class has identifiers, but no data attributes.
18
- # * Resource data is only available when making an API call that
19
- # enumerates all resources of that type.
20
- class ResourceNotLoadable < RuntimeError; end
21
- end
22
13
  end
23
14
  end
@@ -1,424 +1,453 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
3
+ # This file is generated. See the contributing guide for more information:
4
4
  # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
5
  #
6
6
  # WARNING ABOUT GENERATED CODE
7
7
 
8
- module Aws
9
- module CloudWatch
10
- class Metric
8
+ module Aws::CloudWatch
9
+ class Metric
11
10
 
12
- extend Aws::Deprecations
11
+ extend Aws::Deprecations
13
12
 
14
- # @overload def initialize(namespace, name, options = {})
15
- # @param [String] namespace
16
- # @param [String] name
17
- # @option options [Client] :client
18
- # @overload def initialize(options = {})
19
- # @option options [required, String] :namespace
20
- # @option options [required, String] :name
21
- # @option options [Client] :client
22
- def initialize(*args)
23
- options = Hash === args.last ? args.pop.dup : {}
24
- @namespace = extract_namespace(args, options)
25
- @name = extract_name(args, options)
26
- @data = options.delete(:data)
27
- @client = options.delete(:client) || Client.new(options)
28
- end
13
+ # @overload def initialize(namespace, name, options = {})
14
+ # @param [String] namespace
15
+ # @param [String] name
16
+ # @option options [Client] :client
17
+ # @overload def initialize(options = {})
18
+ # @option options [required, String] :namespace
19
+ # @option options [required, String] :name
20
+ # @option options [Client] :client
21
+ def initialize(*args)
22
+ options = Hash === args.last ? args.pop.dup : {}
23
+ @namespace = extract_namespace(args, options)
24
+ @name = extract_name(args, options)
25
+ @data = options.delete(:data)
26
+ @client = options.delete(:client) || Client.new(options)
27
+ end
29
28
 
30
- # @!group Read-Only Attributes
29
+ # @!group Read-Only Attributes
31
30
 
32
- # @return [String]
33
- def namespace
34
- @namespace
35
- end
31
+ # @return [String]
32
+ def namespace
33
+ @namespace
34
+ end
36
35
 
37
- # @return [String]
38
- def name
39
- @name
40
- end
41
- alias :metric_name :name
36
+ # @return [String]
37
+ def name
38
+ @name
39
+ end
40
+ alias :metric_name :name
42
41
 
43
- # The dimensions for the metric.
44
- # @return [Array<Types::Dimension>]
45
- def dimensions
46
- data.dimensions
47
- end
42
+ # The dimensions for the metric.
43
+ # @return [Array<Types::Dimension>]
44
+ def dimensions
45
+ data.dimensions
46
+ end
48
47
 
49
- # @!endgroup
48
+ # @!endgroup
50
49
 
51
- # @return [Client]
52
- def client
53
- @client
54
- end
50
+ # @return [Client]
51
+ def client
52
+ @client
53
+ end
55
54
 
56
- # Loads, or reloads {#data} for the current {Metric}.
57
- # Returns `self` making it possible to chain methods.
58
- #
59
- # metric.reload.data
60
- #
61
- # @return [self]
62
- def load
63
- resp = @client.list_metrics(
64
- metric_name: @name,
65
- namespace: @namespace
66
- )
67
- @data = resp.metrics[0]
68
- self
69
- end
70
- alias :reload :load
55
+ # Loads, or reloads {#data} for the current {Metric}.
56
+ # Returns `self` making it possible to chain methods.
57
+ #
58
+ # metric.reload.data
59
+ #
60
+ # @return [self]
61
+ def load
62
+ resp = @client.list_metrics(
63
+ metric_name: @name,
64
+ namespace: @namespace
65
+ )
66
+ @data = resp.metrics[0]
67
+ self
68
+ end
69
+ alias :reload :load
71
70
 
72
- # @return [Types::Metric]
73
- # Returns the data for this {Metric}. Calls
74
- # {Client#list_metrics} if {#data_loaded?} is `false`.
75
- def data
76
- load unless @data
77
- @data
78
- end
71
+ # @return [Types::Metric]
72
+ # Returns the data for this {Metric}. Calls
73
+ # {Client#list_metrics} if {#data_loaded?} is `false`.
74
+ def data
75
+ load unless @data
76
+ @data
77
+ end
79
78
 
80
- # @return [Boolean]
81
- # Returns `true` if this resource is loaded. Accessing attributes or
82
- # {#data} on an unloaded resource will trigger a call to {#load}.
83
- def data_loaded?
84
- !!@data
85
- end
79
+ # @return [Boolean]
80
+ # Returns `true` if this resource is loaded. Accessing attributes or
81
+ # {#data} on an unloaded resource will trigger a call to {#load}.
82
+ def data_loaded?
83
+ !!@data
84
+ end
86
85
 
87
- # @!group Actions
86
+ # @!group Actions
88
87
 
89
- # @example Request syntax with placeholder values
90
- #
91
- # metric.get_statistics({
92
- # dimensions: [
93
- # {
94
- # name: "DimensionName", # required
95
- # value: "DimensionValue", # required
96
- # },
97
- # ],
98
- # start_time: Time.now, # required
99
- # end_time: Time.now, # required
100
- # period: 1, # required
101
- # statistics: ["SampleCount"], # accepts SampleCount, Average, Sum, Minimum, Maximum
102
- # extended_statistics: ["ExtendedStatistic"],
103
- # 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
104
- # })
105
- # @param [Hash] options ({})
106
- # @option options [Array<Types::Dimension>] :dimensions
107
- # The dimensions. CloudWatch treats each unique combination of
108
- # dimensions as a separate metric. You can't retrieve statistics using
109
- # combinations of dimensions that were not specially published. You must
110
- # specify the same dimensions that were used when the metrics were
111
- # created. For an example, see [Dimension Combinations][1] in the
112
- # *Amazon CloudWatch User Guide*.
113
- #
114
- #
115
- #
116
- # [1]: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#dimension-combinations
117
- # @option options [required, Time,DateTime,Date,Integer,String] :start_time
118
- # The time stamp that determines the first data point to return. Note
119
- # that start times are evaluated relative to the time that CloudWatch
120
- # receives the request.
121
- #
122
- # The value specified is inclusive; results include data points with the
123
- # specified time stamp. The time stamp must be in ISO 8601 UTC format
124
- # (for example, 2016-10-03T23:00:00Z).
125
- #
126
- # CloudWatch rounds the specified time stamp as follows:
127
- #
128
- # * Start time less than 15 days ago - Round down to the nearest whole
129
- # minute. For example, 12:32:34 is rounded down to 12:32:00.
130
- #
131
- # * Start time between 15 and 63 days ago - Round down to the nearest
132
- # 5-minute clock interval. For example, 12:32:34 is rounded down to
133
- # 12:30:00.
134
- #
135
- # * Start time greater than 63 days ago - Round down to the nearest
136
- # 1-hour clock interval. For example, 12:32:34 is rounded down to
137
- # 12:00:00.
138
- # @option options [required, Time,DateTime,Date,Integer,String] :end_time
139
- # The time stamp that determines the last data point to return.
140
- #
141
- # The value specified is exclusive; results will include data points up
142
- # to the specified time stamp. The time stamp must be in ISO 8601 UTC
143
- # format (for example, 2016-10-10T23:00:00Z).
144
- # @option options [required, Integer] :period
145
- # The granularity, in seconds, of the returned data points. A period can
146
- # be as short as one minute (60 seconds) and must be a multiple of 60.
147
- # The default value is 60.
148
- #
149
- # If the `StartTime` parameter specifies a time stamp that is greater
150
- # than 15 days ago, you must specify the period as follows or no data
151
- # points in that time range is returned:
152
- #
153
- # * Start time between 15 and 63 days ago - Use a multiple of 300
154
- # seconds (5 minutes).
155
- #
156
- # * Start time greater than 63 days ago - Use a multiple of 3600 seconds
157
- # (1 hour).
158
- # @option options [Array<String>] :statistics
159
- # The metric statistics, other than percentile. For percentile
160
- # statistics, use `ExtendedStatistic`.
161
- # @option options [Array<String>] :extended_statistics
162
- # The percentile statistics. Specify values between p0.0 and p100.
163
- # @option options [String] :unit
164
- # The unit for a given metric. Metrics may be reported in multiple
165
- # units. Not supplying a unit results in all units being returned. If
166
- # the metric only ever reports one unit, specifying a unit has no
167
- # effect.
168
- # @return [Types::GetMetricStatisticsOutput]
169
- def get_statistics(options = {})
170
- options = options.merge(
171
- namespace: @namespace,
172
- metric_name: @name
173
- )
174
- resp = @client.get_metric_statistics(options)
175
- resp.data
176
- end
88
+ # @example Request syntax with placeholder values
89
+ #
90
+ # metric.get_statistics({
91
+ # dimensions: [
92
+ # {
93
+ # name: "DimensionName", # required
94
+ # value: "DimensionValue", # required
95
+ # },
96
+ # ],
97
+ # start_time: Time.now, # required
98
+ # end_time: Time.now, # required
99
+ # period: 1, # required
100
+ # statistics: ["SampleCount"], # accepts SampleCount, Average, Sum, Minimum, Maximum
101
+ # extended_statistics: ["ExtendedStatistic"],
102
+ # 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
103
+ # })
104
+ # @param [Hash] options ({})
105
+ # @option options [Array<Types::Dimension>] :dimensions
106
+ # The dimensions. If the metric contains multiple dimensions, you must
107
+ # include a value for each dimension. CloudWatch treats each unique
108
+ # combination of dimensions as a separate metric. You can't retrieve
109
+ # statistics using combinations of dimensions that were not specially
110
+ # published. You must specify the same dimensions that were used when
111
+ # the metrics were created. For an example, see [Dimension
112
+ # Combinations][1] in the *Amazon CloudWatch User Guide*. For more
113
+ # information on specifying dimensions, see [Publishing Metrics][2] in
114
+ # the *Amazon CloudWatch User Guide*.
115
+ #
116
+ #
117
+ #
118
+ # [1]: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#dimension-combinations
119
+ # [2]: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html
120
+ # @option options [required, Time,DateTime,Date,Integer,String] :start_time
121
+ # The time stamp that determines the first data point to return. Note
122
+ # that start times are evaluated relative to the time that CloudWatch
123
+ # receives the request.
124
+ #
125
+ # The value specified is inclusive; results include data points with the
126
+ # specified time stamp. The time stamp must be in ISO 8601 UTC format
127
+ # (for example, 2016-10-03T23:00:00Z).
128
+ #
129
+ # CloudWatch rounds the specified time stamp as follows:
130
+ #
131
+ # * Start time less than 15 days ago - Round down to the nearest whole
132
+ # minute. For example, 12:32:34 is rounded down to 12:32:00.
133
+ #
134
+ # * Start time between 15 and 63 days ago - Round down to the nearest
135
+ # 5-minute clock interval. For example, 12:32:34 is rounded down to
136
+ # 12:30:00.
137
+ #
138
+ # * Start time greater than 63 days ago - Round down to the nearest
139
+ # 1-hour clock interval. For example, 12:32:34 is rounded down to
140
+ # 12:00:00.
141
+ # @option options [required, Time,DateTime,Date,Integer,String] :end_time
142
+ # The time stamp that determines the last data point to return.
143
+ #
144
+ # The value specified is exclusive; results will include data points up
145
+ # to the specified time stamp. The time stamp must be in ISO 8601 UTC
146
+ # format (for example, 2016-10-10T23:00:00Z).
147
+ # @option options [required, Integer] :period
148
+ # The granularity, in seconds, of the returned data points. A period can
149
+ # be as short as one minute (60 seconds) and must be a multiple of 60.
150
+ # The default value is 60.
151
+ #
152
+ # If the `StartTime` parameter specifies a time stamp that is greater
153
+ # than 15 days ago, you must specify the period as follows or no data
154
+ # points in that time range is returned:
155
+ #
156
+ # * Start time between 15 and 63 days ago - Use a multiple of 300
157
+ # seconds (5 minutes).
158
+ #
159
+ # * Start time greater than 63 days ago - Use a multiple of 3600 seconds
160
+ # (1 hour).
161
+ # @option options [Array<String>] :statistics
162
+ # The metric statistics, other than percentile. For percentile
163
+ # statistics, use `ExtendedStatistic`.
164
+ # @option options [Array<String>] :extended_statistics
165
+ # The percentile statistics. Specify values between p0.0 and p100.
166
+ # @option options [String] :unit
167
+ # The unit for a given metric. Metrics may be reported in multiple
168
+ # units. Not supplying a unit results in all units being returned. If
169
+ # the metric only ever reports one unit, specifying a unit has no
170
+ # effect.
171
+ # @return [Types::GetMetricStatisticsOutput]
172
+ def get_statistics(options = {})
173
+ options = options.merge(
174
+ namespace: @namespace,
175
+ metric_name: @name
176
+ )
177
+ resp = @client.get_metric_statistics(options)
178
+ resp.data
179
+ end
177
180
 
178
- # @example Request syntax with placeholder values
179
- #
180
- # alarm = metric.put_alarm({
181
- # alarm_name: "AlarmName", # required
182
- # alarm_description: "AlarmDescription",
183
- # actions_enabled: false,
184
- # ok_actions: ["ResourceName"],
185
- # alarm_actions: ["ResourceName"],
186
- # insufficient_data_actions: ["ResourceName"],
187
- # statistic: "SampleCount", # accepts SampleCount, Average, Sum, Minimum, Maximum
188
- # extended_statistic: "ExtendedStatistic",
189
- # dimensions: [
190
- # {
191
- # name: "DimensionName", # required
192
- # value: "DimensionValue", # required
193
- # },
194
- # ],
195
- # period: 1, # required
196
- # 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
197
- # evaluation_periods: 1, # required
198
- # threshold: 1.0, # required
199
- # comparison_operator: "GreaterThanOrEqualToThreshold", # required, accepts GreaterThanOrEqualToThreshold, GreaterThanThreshold, LessThanThreshold, LessThanOrEqualToThreshold
200
- # })
201
- # @param [Hash] options ({})
202
- # @option options [required, String] :alarm_name
203
- # The name for the alarm. This name must be unique within the AWS
204
- # account.
205
- # @option options [String] :alarm_description
206
- # The description for the alarm.
207
- # @option options [Boolean] :actions_enabled
208
- # Indicates whether actions should be executed during any changes to the
209
- # alarm state.
210
- # @option options [Array<String>] :ok_actions
211
- # The actions to execute when this alarm transitions to an `OK` state
212
- # from any other state. Each action is specified as an Amazon Resource
213
- # Name (ARN).
214
- #
215
- # Valid Values: arn:aws:automate:*region*\:ec2:stop \|
216
- # arn:aws:automate:*region*\:ec2:terminate \|
217
- # arn:aws:automate:*region*\:ec2:recover
218
- #
219
- # Valid Values (for use with IAM roles):
220
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Stop/1.0
221
- # \|
222
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Terminate/1.0
223
- # \|
224
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Reboot/1.0
225
- # @option options [Array<String>] :alarm_actions
226
- # The actions to execute when this alarm transitions to the `ALARM`
227
- # state from any other state. Each action is specified as an Amazon
228
- # Resource Name (ARN).
229
- #
230
- # Valid Values: arn:aws:automate:*region*\:ec2:stop \|
231
- # arn:aws:automate:*region*\:ec2:terminate \|
232
- # arn:aws:automate:*region*\:ec2:recover
233
- #
234
- # Valid Values (for use with IAM roles):
235
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Stop/1.0
236
- # \|
237
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Terminate/1.0
238
- # \|
239
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Reboot/1.0
240
- # @option options [Array<String>] :insufficient_data_actions
241
- # The actions to execute when this alarm transitions to the
242
- # `INSUFFICIENT_DATA` state from any other state. Each action is
243
- # specified as an Amazon Resource Name (ARN).
244
- #
245
- # Valid Values: arn:aws:automate:*region*\:ec2:stop \|
246
- # arn:aws:automate:*region*\:ec2:terminate \|
247
- # arn:aws:automate:*region*\:ec2:recover
248
- #
249
- # Valid Values (for use with IAM roles):
250
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Stop/1.0
251
- # \|
252
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Terminate/1.0
253
- # \|
254
- # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Reboot/1.0
255
- # @option options [String] :statistic
256
- # The statistic for the metric associated with the alarm, other than
257
- # percentile. For percentile statistics, use `ExtendedStatistic`.
258
- # @option options [String] :extended_statistic
259
- # The percentile statistic for the metric associated with the alarm.
260
- # Specify a value between p0.0 and p100.
261
- # @option options [Array<Types::Dimension>] :dimensions
262
- # The dimensions for the metric associated with the alarm.
263
- # @option options [required, Integer] :period
264
- # The period, in seconds, over which the specified statistic is applied.
265
- # @option options [String] :unit
266
- # The unit of measure for the statistic. For example, the units for the
267
- # Amazon EC2 NetworkIn metric are Bytes because NetworkIn tracks the
268
- # number of bytes that an instance receives on all network interfaces.
269
- # You can also specify a unit when you create a custom metric. Units
270
- # help provide conceptual meaning to your data. Metric data points that
271
- # specify a unit of measure, such as Percent, are aggregated separately.
272
- #
273
- # If you specify a unit, you must use a unit that is appropriate for the
274
- # metric. Otherwise, the Amazon CloudWatch alarm can get stuck in the
275
- # `INSUFFICIENT DATA` state.
276
- # @option options [required, Integer] :evaluation_periods
277
- # The number of periods over which data is compared to the specified
278
- # threshold.
279
- # @option options [required, Float] :threshold
280
- # The value against which the specified statistic is compared.
281
- # @option options [required, String] :comparison_operator
282
- # The arithmetic operation to use when comparing the specified statistic
283
- # and threshold. The specified statistic value is used as the first
284
- # operand.
285
- # @return [Alarm]
286
- def put_alarm(options = {})
181
+ # @example Request syntax with placeholder values
182
+ #
183
+ # alarm = metric.put_alarm({
184
+ # alarm_name: "AlarmName", # required
185
+ # alarm_description: "AlarmDescription",
186
+ # actions_enabled: false,
187
+ # ok_actions: ["ResourceName"],
188
+ # alarm_actions: ["ResourceName"],
189
+ # insufficient_data_actions: ["ResourceName"],
190
+ # statistic: "SampleCount", # accepts SampleCount, Average, Sum, Minimum, Maximum
191
+ # extended_statistic: "ExtendedStatistic",
192
+ # dimensions: [
193
+ # {
194
+ # name: "DimensionName", # required
195
+ # value: "DimensionValue", # required
196
+ # },
197
+ # ],
198
+ # period: 1, # required
199
+ # 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
200
+ # evaluation_periods: 1, # required
201
+ # threshold: 1.0, # required
202
+ # comparison_operator: "GreaterThanOrEqualToThreshold", # required, accepts GreaterThanOrEqualToThreshold, GreaterThanThreshold, LessThanThreshold, LessThanOrEqualToThreshold
203
+ # treat_missing_data: "TreatMissingData",
204
+ # evaluate_low_sample_count_percentile: "EvaluateLowSampleCountPercentile",
205
+ # })
206
+ # @param [Hash] options ({})
207
+ # @option options [required, String] :alarm_name
208
+ # The name for the alarm. This name must be unique within the AWS
209
+ # account.
210
+ # @option options [String] :alarm_description
211
+ # The description for the alarm.
212
+ # @option options [Boolean] :actions_enabled
213
+ # Indicates whether actions should be executed during any changes to the
214
+ # alarm state.
215
+ # @option options [Array<String>] :ok_actions
216
+ # The actions to execute when this alarm transitions to an `OK` state
217
+ # from any other state. Each action is specified as an Amazon Resource
218
+ # Name (ARN).
219
+ #
220
+ # Valid Values: arn:aws:automate:*region*\:ec2:stop \|
221
+ # arn:aws:automate:*region*\:ec2:terminate \|
222
+ # arn:aws:automate:*region*\:ec2:recover
223
+ #
224
+ # Valid Values (for use with IAM roles):
225
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Stop/1.0
226
+ # \|
227
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Terminate/1.0
228
+ # \|
229
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Reboot/1.0
230
+ # @option options [Array<String>] :alarm_actions
231
+ # The actions to execute when this alarm transitions to the `ALARM`
232
+ # state from any other state. Each action is specified as an Amazon
233
+ # Resource Name (ARN).
234
+ #
235
+ # Valid Values: arn:aws:automate:*region*\:ec2:stop \|
236
+ # arn:aws:automate:*region*\:ec2:terminate \|
237
+ # arn:aws:automate:*region*\:ec2:recover
238
+ #
239
+ # Valid Values (for use with IAM roles):
240
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Stop/1.0
241
+ # \|
242
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Terminate/1.0
243
+ # \|
244
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Reboot/1.0
245
+ # @option options [Array<String>] :insufficient_data_actions
246
+ # The actions to execute when this alarm transitions to the
247
+ # `INSUFFICIENT_DATA` state from any other state. Each action is
248
+ # specified as an Amazon Resource Name (ARN).
249
+ #
250
+ # Valid Values: arn:aws:automate:*region*\:ec2:stop \|
251
+ # arn:aws:automate:*region*\:ec2:terminate \|
252
+ # arn:aws:automate:*region*\:ec2:recover
253
+ #
254
+ # Valid Values (for use with IAM roles):
255
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Stop/1.0
256
+ # \|
257
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Terminate/1.0
258
+ # \|
259
+ # arn:aws:swf:us-east-1:\\\{*customer-account*\\}:action/actions/AWS\_EC2.InstanceId.Reboot/1.0
260
+ # @option options [String] :statistic
261
+ # The statistic for the metric associated with the alarm, other than
262
+ # percentile. For percentile statistics, use `ExtendedStatistic`.
263
+ # @option options [String] :extended_statistic
264
+ # The percentile statistic for the metric associated with the alarm.
265
+ # Specify a value between p0.0 and p100.
266
+ # @option options [Array<Types::Dimension>] :dimensions
267
+ # The dimensions for the metric associated with the alarm.
268
+ # @option options [required, Integer] :period
269
+ # The period, in seconds, over which the specified statistic is applied.
270
+ # @option options [String] :unit
271
+ # The unit of measure for the statistic. For example, the units for the
272
+ # Amazon EC2 NetworkIn metric are Bytes because NetworkIn tracks the
273
+ # number of bytes that an instance receives on all network interfaces.
274
+ # You can also specify a unit when you create a custom metric. Units
275
+ # help provide conceptual meaning to your data. Metric data points that
276
+ # specify a unit of measure, such as Percent, are aggregated separately.
277
+ #
278
+ # If you specify a unit, you must use a unit that is appropriate for the
279
+ # metric. Otherwise, the Amazon CloudWatch alarm can get stuck in the
280
+ # `INSUFFICIENT DATA` state.
281
+ # @option options [required, Integer] :evaluation_periods
282
+ # The number of periods over which data is compared to the specified
283
+ # threshold.
284
+ # @option options [required, Float] :threshold
285
+ # The value against which the specified statistic is compared.
286
+ # @option options [required, String] :comparison_operator
287
+ # The arithmetic operation to use when comparing the specified statistic
288
+ # and threshold. The specified statistic value is used as the first
289
+ # operand.
290
+ # @option options [String] :treat_missing_data
291
+ # Sets how this alarm is to handle missing data points. If
292
+ # `TreatMissingData` is omitted, the default behavior of `missing` is
293
+ # used. For more information, see [Configuring How CloudWatch Alarms
294
+ # Treats Missing Data][1].
295
+ #
296
+ # Valid Values: `breaching | notBreaching | ignore | missing`
297
+ #
298
+ #
299
+ #
300
+ # [1]: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data
301
+ # @option options [String] :evaluate_low_sample_count_percentile
302
+ # Used only for alarms based on percentiles. If you specify `ignore`,
303
+ # the alarm state will not change during periods with too few data
304
+ # points to be statistically significant. If you specify `evaluate` or
305
+ # omit this parameter, the alarm will always be evaluated and possibly
306
+ # change state no matter how many data points are available. For more
307
+ # information, see [Percentile-Based CloudWatch Alarms and Low Data
308
+ # Samples][1].
309
+ #
310
+ # Valid Values: `evaluate | ignore`
311
+ #
312
+ #
313
+ #
314
+ # [1]: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#percentiles-with-low-samples
315
+ # @return [Alarm]
316
+ def put_alarm(options = {})
317
+ options = options.merge(
318
+ namespace: @namespace,
319
+ metric_name: @name
320
+ )
321
+ resp = @client.put_metric_alarm(options)
322
+ Alarm.new(
323
+ name: options[:alarm_name],
324
+ client: @client
325
+ )
326
+ end
327
+
328
+ # @example Request syntax with placeholder values
329
+ #
330
+ # metric.put_data({
331
+ # metric_data: [ # required
332
+ # {
333
+ # metric_name: "MetricName", # required
334
+ # dimensions: [
335
+ # {
336
+ # name: "DimensionName", # required
337
+ # value: "DimensionValue", # required
338
+ # },
339
+ # ],
340
+ # timestamp: Time.now,
341
+ # value: 1.0,
342
+ # statistic_values: {
343
+ # sample_count: 1.0, # required
344
+ # sum: 1.0, # required
345
+ # minimum: 1.0, # required
346
+ # maximum: 1.0, # required
347
+ # },
348
+ # 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
349
+ # },
350
+ # ],
351
+ # })
352
+ # @param [Hash] options ({})
353
+ # @option options [required, Array<Types::MetricDatum>] :metric_data
354
+ # The data for the metric.
355
+ # @return [EmptyStructure]
356
+ def put_data(options = {})
357
+ options = Aws::Util.deep_merge(options,
358
+ namespace: @namespace,
359
+ metric_data: [{ metric_name: @name }]
360
+ )
361
+ resp = @client.put_metric_data(options)
362
+ resp.data
363
+ end
364
+
365
+ # @!group Associations
366
+
367
+ # @example Request syntax with placeholder values
368
+ #
369
+ # alarms = metric.alarms({
370
+ # statistic: "SampleCount", # accepts SampleCount, Average, Sum, Minimum, Maximum
371
+ # extended_statistic: "ExtendedStatistic",
372
+ # dimensions: [
373
+ # {
374
+ # name: "DimensionName", # required
375
+ # value: "DimensionValue", # required
376
+ # },
377
+ # ],
378
+ # period: 1,
379
+ # 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
380
+ # })
381
+ # @param [Hash] options ({})
382
+ # @option options [String] :statistic
383
+ # The statistic for the metric, other than percentiles. For percentile
384
+ # statistics, use `ExtendedStatistics`.
385
+ # @option options [String] :extended_statistic
386
+ # The percentile statistic for the metric. Specify a value between p0.0
387
+ # and p100.
388
+ # @option options [Array<Types::Dimension>] :dimensions
389
+ # The dimensions associated with the metric. If the metric has any
390
+ # associated dimensions, you must specify them in order for the call to
391
+ # succeed.
392
+ # @option options [Integer] :period
393
+ # The period, in seconds, over which the statistic is applied.
394
+ # @option options [String] :unit
395
+ # The unit for the metric.
396
+ # @return [Alarm::Collection]
397
+ def alarms(options = {})
398
+ batches = Enumerator.new do |y|
399
+ batch = []
287
400
  options = options.merge(
288
401
  namespace: @namespace,
289
402
  metric_name: @name
290
403
  )
291
- resp = @client.put_metric_alarm(options)
292
- Alarm.new(
293
- name: options[:alarm_name],
294
- client: @client
295
- )
296
- end
297
-
298
- # @example Request syntax with placeholder values
299
- #
300
- # metric.put_data({
301
- # metric_data: [ # required
302
- # {
303
- # metric_name: "MetricName", # required
304
- # dimensions: [
305
- # {
306
- # name: "DimensionName", # required
307
- # value: "DimensionValue", # required
308
- # },
309
- # ],
310
- # timestamp: Time.now,
311
- # value: 1.0,
312
- # statistic_values: {
313
- # sample_count: 1.0, # required
314
- # sum: 1.0, # required
315
- # minimum: 1.0, # required
316
- # maximum: 1.0, # required
317
- # },
318
- # 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
319
- # },
320
- # ],
321
- # })
322
- # @param [Hash] options ({})
323
- # @option options [required, Array<Types::MetricDatum>] :metric_data
324
- # The data for the metric.
325
- # @return [EmptyStructure]
326
- def put_data(options = {})
327
- options = Aws::Util.deep_merge(options,
328
- namespace: @namespace,
329
- metric_data: [{ metric_name: @name }]
330
- )
331
- resp = @client.put_metric_data(options)
332
- resp.data
333
- end
334
-
335
- # @!group Associations
336
-
337
- # @example Request syntax with placeholder values
338
- #
339
- # alarms = metric.alarms({
340
- # statistic: "SampleCount", # accepts SampleCount, Average, Sum, Minimum, Maximum
341
- # extended_statistic: "ExtendedStatistic",
342
- # dimensions: [
343
- # {
344
- # name: "DimensionName", # required
345
- # value: "DimensionValue", # required
346
- # },
347
- # ],
348
- # period: 1,
349
- # 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
350
- # })
351
- # @param [Hash] options ({})
352
- # @option options [String] :statistic
353
- # The statistic for the metric, other than percentiles. For percentile
354
- # statistics, use `ExtendedStatistics`.
355
- # @option options [String] :extended_statistic
356
- # The percentile statistic for the metric. Specify a value between p0.0
357
- # and p100.
358
- # @option options [Array<Types::Dimension>] :dimensions
359
- # The dimensions associated with the metric. If the metric has any
360
- # associated dimensions, you must specify them in order for the call to
361
- # succeed.
362
- # @option options [Integer] :period
363
- # The period, in seconds, over which the statistic is applied.
364
- # @option options [String] :unit
365
- # The unit for the metric.
366
- # @return [Alarm::Collection]
367
- def alarms(options = {})
368
- batches = Enumerator.new do |y|
369
- batch = []
370
- options = options.merge(
371
- namespace: @namespace,
372
- metric_name: @name
404
+ resp = @client.describe_alarms_for_metric(options)
405
+ resp.data.metric_alarms.each do |m|
406
+ batch << Alarm.new(
407
+ name: m.alarm_name,
408
+ data: m,
409
+ client: @client
373
410
  )
374
- resp = @client.describe_alarms_for_metric(options)
375
- resp.data.metric_alarms.each do |m|
376
- batch << Alarm.new(
377
- name: m.alarm_name,
378
- data: m,
379
- client: @client
380
- )
381
- end
382
- y.yield(batch)
383
411
  end
384
- Alarm::Collection.new(batches)
412
+ y.yield(batch)
385
413
  end
414
+ Alarm::Collection.new(batches)
415
+ end
386
416
 
387
- # @deprecated
388
- # @api private
389
- def identifiers
390
- {
391
- namespace: @namespace,
392
- name: @name
393
- }
394
- end
395
- deprecated(:identifiers)
417
+ # @deprecated
418
+ # @api private
419
+ def identifiers
420
+ {
421
+ namespace: @namespace,
422
+ name: @name
423
+ }
424
+ end
425
+ deprecated(:identifiers)
396
426
 
397
- private
427
+ private
398
428
 
399
- def extract_namespace(args, options)
400
- value = args[0] || options.delete(:namespace)
401
- case value
402
- when String then value
403
- when nil then raise ArgumentError, "missing required option :namespace"
404
- else
405
- msg = "expected :namespace to be a String, got #{value.class}"
406
- raise ArgumentError, msg
407
- end
429
+ def extract_namespace(args, options)
430
+ value = args[0] || options.delete(:namespace)
431
+ case value
432
+ when String then value
433
+ when nil then raise ArgumentError, "missing required option :namespace"
434
+ else
435
+ msg = "expected :namespace to be a String, got #{value.class}"
436
+ raise ArgumentError, msg
408
437
  end
438
+ end
409
439
 
410
- def extract_name(args, options)
411
- value = args[1] || options.delete(:name)
412
- case value
413
- when String then value
414
- when nil then raise ArgumentError, "missing required option :name"
415
- else
416
- msg = "expected :name to be a String, got #{value.class}"
417
- raise ArgumentError, msg
418
- end
440
+ def extract_name(args, options)
441
+ value = args[1] || options.delete(:name)
442
+ case value
443
+ when String then value
444
+ when nil then raise ArgumentError, "missing required option :name"
445
+ else
446
+ msg = "expected :name to be a String, got #{value.class}"
447
+ raise ArgumentError, msg
419
448
  end
420
-
421
- class Collection < Aws::Resources::Collection; end
422
449
  end
450
+
451
+ class Collection < Aws::Resources::Collection; end
423
452
  end
424
453
  end