aws-sdk-cloudwatch 1.32.0 → 1.33.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,9 @@ module Aws::CloudWatch
20
20
  AlarmName = Shapes::StringShape.new(name: 'AlarmName')
21
21
  AlarmNamePrefix = Shapes::StringShape.new(name: 'AlarmNamePrefix')
22
22
  AlarmNames = Shapes::ListShape.new(name: 'AlarmNames')
23
+ AlarmRule = Shapes::StringShape.new(name: 'AlarmRule')
24
+ AlarmType = Shapes::StringShape.new(name: 'AlarmType')
25
+ AlarmTypes = Shapes::ListShape.new(name: 'AlarmTypes')
23
26
  AmazonResourceName = Shapes::StringShape.new(name: 'AmazonResourceName')
24
27
  AnomalyDetector = Shapes::StructureShape.new(name: 'AnomalyDetector')
25
28
  AnomalyDetectorConfiguration = Shapes::StructureShape.new(name: 'AnomalyDetectorConfiguration')
@@ -30,6 +33,8 @@ module Aws::CloudWatch
30
33
  AwsQueryErrorMessage = Shapes::StringShape.new(name: 'AwsQueryErrorMessage')
31
34
  BatchFailures = Shapes::ListShape.new(name: 'BatchFailures')
32
35
  ComparisonOperator = Shapes::StringShape.new(name: 'ComparisonOperator')
36
+ CompositeAlarm = Shapes::StructureShape.new(name: 'CompositeAlarm')
37
+ CompositeAlarms = Shapes::ListShape.new(name: 'CompositeAlarms')
33
38
  ConcurrentModificationException = Shapes::StructureShape.new(name: 'ConcurrentModificationException')
34
39
  Counts = Shapes::ListShape.new(name: 'Counts')
35
40
  DashboardArn = Shapes::StringShape.new(name: 'DashboardArn')
@@ -175,6 +180,7 @@ module Aws::CloudWatch
175
180
  Period = Shapes::IntegerShape.new(name: 'Period')
176
181
  PutAnomalyDetectorInput = Shapes::StructureShape.new(name: 'PutAnomalyDetectorInput')
177
182
  PutAnomalyDetectorOutput = Shapes::StructureShape.new(name: 'PutAnomalyDetectorOutput')
183
+ PutCompositeAlarmInput = Shapes::StructureShape.new(name: 'PutCompositeAlarmInput')
178
184
  PutDashboardInput = Shapes::StructureShape.new(name: 'PutDashboardInput')
179
185
  PutDashboardOutput = Shapes::StructureShape.new(name: 'PutDashboardOutput')
180
186
  PutInsightRuleInput = Shapes::StructureShape.new(name: 'PutInsightRuleInput')
@@ -218,6 +224,7 @@ module Aws::CloudWatch
218
224
  Values = Shapes::ListShape.new(name: 'Values')
219
225
 
220
226
  AlarmHistoryItem.add_member(:alarm_name, Shapes::ShapeRef.new(shape: AlarmName, location_name: "AlarmName"))
227
+ AlarmHistoryItem.add_member(:alarm_type, Shapes::ShapeRef.new(shape: AlarmType, location_name: "AlarmType"))
221
228
  AlarmHistoryItem.add_member(:timestamp, Shapes::ShapeRef.new(shape: Timestamp, location_name: "Timestamp"))
222
229
  AlarmHistoryItem.add_member(:history_item_type, Shapes::ShapeRef.new(shape: HistoryItemType, location_name: "HistoryItemType"))
223
230
  AlarmHistoryItem.add_member(:history_summary, Shapes::ShapeRef.new(shape: HistorySummary, location_name: "HistorySummary"))
@@ -228,6 +235,8 @@ module Aws::CloudWatch
228
235
 
229
236
  AlarmNames.member = Shapes::ShapeRef.new(shape: AlarmName)
230
237
 
238
+ AlarmTypes.member = Shapes::ShapeRef.new(shape: AlarmType)
239
+
231
240
  AnomalyDetector.add_member(:namespace, Shapes::ShapeRef.new(shape: Namespace, location_name: "Namespace"))
232
241
  AnomalyDetector.add_member(:metric_name, Shapes::ShapeRef.new(shape: MetricName, location_name: "MetricName"))
233
242
  AnomalyDetector.add_member(:dimensions, Shapes::ShapeRef.new(shape: Dimensions, location_name: "Dimensions"))
@@ -246,6 +255,25 @@ module Aws::CloudWatch
246
255
 
247
256
  BatchFailures.member = Shapes::ShapeRef.new(shape: PartialFailure)
248
257
 
258
+ CompositeAlarm.add_member(:actions_enabled, Shapes::ShapeRef.new(shape: ActionsEnabled, location_name: "ActionsEnabled"))
259
+ CompositeAlarm.add_member(:alarm_actions, Shapes::ShapeRef.new(shape: ResourceList, location_name: "AlarmActions"))
260
+ CompositeAlarm.add_member(:alarm_arn, Shapes::ShapeRef.new(shape: AlarmArn, location_name: "AlarmArn"))
261
+ CompositeAlarm.add_member(:alarm_configuration_updated_timestamp, Shapes::ShapeRef.new(shape: Timestamp, location_name: "AlarmConfigurationUpdatedTimestamp"))
262
+ CompositeAlarm.add_member(:alarm_description, Shapes::ShapeRef.new(shape: AlarmDescription, location_name: "AlarmDescription"))
263
+ CompositeAlarm.add_member(:alarm_name, Shapes::ShapeRef.new(shape: AlarmName, location_name: "AlarmName"))
264
+ CompositeAlarm.add_member(:alarm_rule, Shapes::ShapeRef.new(shape: AlarmRule, location_name: "AlarmRule"))
265
+ CompositeAlarm.add_member(:insufficient_data_actions, Shapes::ShapeRef.new(shape: ResourceList, location_name: "InsufficientDataActions"))
266
+ CompositeAlarm.add_member(:ok_actions, Shapes::ShapeRef.new(shape: ResourceList, location_name: "OKActions"))
267
+ CompositeAlarm.add_member(:state_reason, Shapes::ShapeRef.new(shape: StateReason, location_name: "StateReason"))
268
+ CompositeAlarm.add_member(:state_reason_data, Shapes::ShapeRef.new(shape: StateReasonData, location_name: "StateReasonData"))
269
+ CompositeAlarm.add_member(:state_updated_timestamp, Shapes::ShapeRef.new(shape: Timestamp, location_name: "StateUpdatedTimestamp"))
270
+ CompositeAlarm.add_member(:state_value, Shapes::ShapeRef.new(shape: StateValue, location_name: "StateValue"))
271
+ CompositeAlarm.struct_class = Types::CompositeAlarm
272
+
273
+ CompositeAlarms.member = Shapes::ShapeRef.new(shape: CompositeAlarm)
274
+
275
+ ConcurrentModificationException.struct_class = Types::ConcurrentModificationException
276
+
249
277
  Counts.member = Shapes::ShapeRef.new(shape: DatapointValue)
250
278
 
251
279
  DashboardEntries.member = Shapes::ShapeRef.new(shape: DashboardEntry)
@@ -311,11 +339,13 @@ module Aws::CloudWatch
311
339
  DeleteInsightRulesOutput.struct_class = Types::DeleteInsightRulesOutput
312
340
 
313
341
  DescribeAlarmHistoryInput.add_member(:alarm_name, Shapes::ShapeRef.new(shape: AlarmName, location_name: "AlarmName"))
342
+ DescribeAlarmHistoryInput.add_member(:alarm_types, Shapes::ShapeRef.new(shape: AlarmTypes, location_name: "AlarmTypes"))
314
343
  DescribeAlarmHistoryInput.add_member(:history_item_type, Shapes::ShapeRef.new(shape: HistoryItemType, location_name: "HistoryItemType"))
315
344
  DescribeAlarmHistoryInput.add_member(:start_date, Shapes::ShapeRef.new(shape: Timestamp, location_name: "StartDate"))
316
345
  DescribeAlarmHistoryInput.add_member(:end_date, Shapes::ShapeRef.new(shape: Timestamp, location_name: "EndDate"))
317
346
  DescribeAlarmHistoryInput.add_member(:max_records, Shapes::ShapeRef.new(shape: MaxRecords, location_name: "MaxRecords"))
318
347
  DescribeAlarmHistoryInput.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "NextToken"))
348
+ DescribeAlarmHistoryInput.add_member(:scan_by, Shapes::ShapeRef.new(shape: ScanBy, location_name: "ScanBy"))
319
349
  DescribeAlarmHistoryInput.struct_class = Types::DescribeAlarmHistoryInput
320
350
 
321
351
  DescribeAlarmHistoryOutput.add_member(:alarm_history_items, Shapes::ShapeRef.new(shape: AlarmHistoryItems, location_name: "AlarmHistoryItems"))
@@ -336,12 +366,16 @@ module Aws::CloudWatch
336
366
 
337
367
  DescribeAlarmsInput.add_member(:alarm_names, Shapes::ShapeRef.new(shape: AlarmNames, location_name: "AlarmNames"))
338
368
  DescribeAlarmsInput.add_member(:alarm_name_prefix, Shapes::ShapeRef.new(shape: AlarmNamePrefix, location_name: "AlarmNamePrefix"))
369
+ DescribeAlarmsInput.add_member(:alarm_types, Shapes::ShapeRef.new(shape: AlarmTypes, location_name: "AlarmTypes"))
370
+ DescribeAlarmsInput.add_member(:children_of_alarm_name, Shapes::ShapeRef.new(shape: AlarmName, location_name: "ChildrenOfAlarmName"))
371
+ DescribeAlarmsInput.add_member(:parents_of_alarm_name, Shapes::ShapeRef.new(shape: AlarmName, location_name: "ParentsOfAlarmName"))
339
372
  DescribeAlarmsInput.add_member(:state_value, Shapes::ShapeRef.new(shape: StateValue, location_name: "StateValue"))
340
373
  DescribeAlarmsInput.add_member(:action_prefix, Shapes::ShapeRef.new(shape: ActionPrefix, location_name: "ActionPrefix"))
341
374
  DescribeAlarmsInput.add_member(:max_records, Shapes::ShapeRef.new(shape: MaxRecords, location_name: "MaxRecords"))
342
375
  DescribeAlarmsInput.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "NextToken"))
343
376
  DescribeAlarmsInput.struct_class = Types::DescribeAlarmsInput
344
377
 
378
+ DescribeAlarmsOutput.add_member(:composite_alarms, Shapes::ShapeRef.new(shape: CompositeAlarms, location_name: "CompositeAlarms"))
345
379
  DescribeAlarmsOutput.add_member(:metric_alarms, Shapes::ShapeRef.new(shape: MetricAlarms, location_name: "MetricAlarms"))
346
380
  DescribeAlarmsOutput.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "NextToken"))
347
381
  DescribeAlarmsOutput.struct_class = Types::DescribeAlarmsOutput
@@ -513,6 +547,8 @@ module Aws::CloudWatch
513
547
  InvalidParameterValueException.add_member(:message, Shapes::ShapeRef.new(shape: AwsQueryErrorMessage, location_name: "message"))
514
548
  InvalidParameterValueException.struct_class = Types::InvalidParameterValueException
515
549
 
550
+ LimitExceededException.struct_class = Types::LimitExceededException
551
+
516
552
  LimitExceededFault.add_member(:message, Shapes::ShapeRef.new(shape: ErrorMessage, location_name: "message"))
517
553
  LimitExceededFault.struct_class = Types::LimitExceededFault
518
554
 
@@ -641,6 +677,16 @@ module Aws::CloudWatch
641
677
 
642
678
  PutAnomalyDetectorOutput.struct_class = Types::PutAnomalyDetectorOutput
643
679
 
680
+ PutCompositeAlarmInput.add_member(:actions_enabled, Shapes::ShapeRef.new(shape: ActionsEnabled, location_name: "ActionsEnabled"))
681
+ PutCompositeAlarmInput.add_member(:alarm_actions, Shapes::ShapeRef.new(shape: ResourceList, location_name: "AlarmActions"))
682
+ PutCompositeAlarmInput.add_member(:alarm_description, Shapes::ShapeRef.new(shape: AlarmDescription, location_name: "AlarmDescription"))
683
+ PutCompositeAlarmInput.add_member(:alarm_name, Shapes::ShapeRef.new(shape: AlarmName, required: true, location_name: "AlarmName"))
684
+ PutCompositeAlarmInput.add_member(:alarm_rule, Shapes::ShapeRef.new(shape: AlarmRule, required: true, location_name: "AlarmRule"))
685
+ PutCompositeAlarmInput.add_member(:insufficient_data_actions, Shapes::ShapeRef.new(shape: ResourceList, location_name: "InsufficientDataActions"))
686
+ PutCompositeAlarmInput.add_member(:ok_actions, Shapes::ShapeRef.new(shape: ResourceList, location_name: "OKActions"))
687
+ PutCompositeAlarmInput.add_member(:tags, Shapes::ShapeRef.new(shape: TagList, location_name: "Tags"))
688
+ PutCompositeAlarmInput.struct_class = Types::PutCompositeAlarmInput
689
+
644
690
  PutDashboardInput.add_member(:dashboard_name, Shapes::ShapeRef.new(shape: DashboardName, required: true, location_name: "DashboardName"))
645
691
  PutDashboardInput.add_member(:dashboard_body, Shapes::ShapeRef.new(shape: DashboardBody, required: true, location_name: "DashboardBody"))
646
692
  PutDashboardInput.struct_class = Types::PutDashboardInput
@@ -1005,6 +1051,15 @@ module Aws::CloudWatch
1005
1051
  o.errors << Shapes::ShapeRef.new(shape: MissingRequiredParameterException)
1006
1052
  end)
1007
1053
 
1054
+ api.add_operation(:put_composite_alarm, Seahorse::Model::Operation.new.tap do |o|
1055
+ o.name = "PutCompositeAlarm"
1056
+ o.http_method = "POST"
1057
+ o.http_request_uri = "/"
1058
+ o.input = Shapes::ShapeRef.new(shape: PutCompositeAlarmInput)
1059
+ o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
1060
+ o.errors << Shapes::ShapeRef.new(shape: LimitExceededFault)
1061
+ end)
1062
+
1008
1063
  api.add_operation(:put_dashboard, Seahorse::Model::Operation.new.tap do |o|
1009
1064
  o.name = "PutDashboard"
1010
1065
  o.http_method = "POST"
@@ -0,0 +1,472 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing guide for more information:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ module Aws::CloudWatch
9
+ class CompositeAlarm
10
+
11
+ extend Aws::Deprecations
12
+
13
+ # @overload def initialize(name, options = {})
14
+ # @param [String] name
15
+ # @option options [Client] :client
16
+ # @overload def initialize(options = {})
17
+ # @option options [required, String] :name
18
+ # @option options [Client] :client
19
+ def initialize(*args)
20
+ options = Hash === args.last ? args.pop.dup : {}
21
+ @name = extract_name(args, options)
22
+ @data = options.delete(:data)
23
+ @client = options.delete(:client) || Client.new(options)
24
+ @waiter_block_warned = false
25
+ end
26
+
27
+ # @!group Read-Only Attributes
28
+
29
+ # @return [String]
30
+ def name
31
+ @name
32
+ end
33
+ alias :alarm_name :name
34
+
35
+ # Indicates whether actions should be executed during any changes to the
36
+ # alarm state.
37
+ # @return [Boolean]
38
+ def actions_enabled
39
+ data[:actions_enabled]
40
+ end
41
+
42
+ # The actions to execute when this alarm transitions to the ALARM state
43
+ # from any other state. Each action is specified as an Amazon Resource
44
+ # Name (ARN).
45
+ # @return [Array<String>]
46
+ def alarm_actions
47
+ data[:alarm_actions]
48
+ end
49
+
50
+ # The Amazon Resource Name (ARN) of the alarm.
51
+ # @return [String]
52
+ def alarm_arn
53
+ data[:alarm_arn]
54
+ end
55
+
56
+ # The time stamp of the last update to the alarm configuration.
57
+ # @return [Time]
58
+ def alarm_configuration_updated_timestamp
59
+ data[:alarm_configuration_updated_timestamp]
60
+ end
61
+
62
+ # The description of the alarm.
63
+ # @return [String]
64
+ def alarm_description
65
+ data[:alarm_description]
66
+ end
67
+
68
+ # The rule that this alarm uses to evaluate its alarm state.
69
+ # @return [String]
70
+ def alarm_rule
71
+ data[:alarm_rule]
72
+ end
73
+
74
+ # The actions to execute when this alarm transitions to the
75
+ # INSUFFICIENT\_DATA state from any other state. Each action is
76
+ # specified as an Amazon Resource Name (ARN).
77
+ # @return [Array<String>]
78
+ def insufficient_data_actions
79
+ data[:insufficient_data_actions]
80
+ end
81
+
82
+ # The actions to execute when this alarm transitions to the OK state
83
+ # from any other state. Each action is specified as an Amazon Resource
84
+ # Name (ARN).
85
+ # @return [Array<String>]
86
+ def ok_actions
87
+ data[:ok_actions]
88
+ end
89
+
90
+ # An explanation for the alarm state, in text format.
91
+ # @return [String]
92
+ def state_reason
93
+ data[:state_reason]
94
+ end
95
+
96
+ # An explanation for the alarm state, in JSON format.
97
+ # @return [String]
98
+ def state_reason_data
99
+ data[:state_reason_data]
100
+ end
101
+
102
+ # The time stamp of the last update to the alarm state.
103
+ # @return [Time]
104
+ def state_updated_timestamp
105
+ data[:state_updated_timestamp]
106
+ end
107
+
108
+ # The state value for the alarm.
109
+ # @return [String]
110
+ def state_value
111
+ data[:state_value]
112
+ end
113
+
114
+ # @!endgroup
115
+
116
+ # @return [Client]
117
+ def client
118
+ @client
119
+ end
120
+
121
+ # Loads, or reloads {#data} for the current {CompositeAlarm}.
122
+ # Returns `self` making it possible to chain methods.
123
+ #
124
+ # composite_alarm.reload.data
125
+ #
126
+ # @return [self]
127
+ def load
128
+ resp = @client.describe_alarms(alarm_names: [@name])
129
+ @data = resp.composite_alarms[0]
130
+ self
131
+ end
132
+ alias :reload :load
133
+
134
+ # @return [Types::CompositeAlarm]
135
+ # Returns the data for this {CompositeAlarm}. Calls
136
+ # {Client#describe_alarms} if {#data_loaded?} is `false`.
137
+ def data
138
+ load unless @data
139
+ @data
140
+ end
141
+
142
+ # @return [Boolean]
143
+ # Returns `true` if this resource is loaded. Accessing attributes or
144
+ # {#data} on an unloaded resource will trigger a call to {#load}.
145
+ def data_loaded?
146
+ !!@data
147
+ end
148
+
149
+ # @param [Hash] options ({})
150
+ # @return [Boolean]
151
+ # Returns `true` if the CompositeAlarm exists.
152
+ def exists?(options = {})
153
+ begin
154
+ wait_until_exists(options.merge(max_attempts: 1))
155
+ true
156
+ rescue Aws::Waiters::Errors::UnexpectedError => e
157
+ raise e.error
158
+ rescue Aws::Waiters::Errors::WaiterFailed
159
+ false
160
+ end
161
+ end
162
+
163
+ # @param [Hash] options ({})
164
+ # @option options [Integer] :max_attempts (40)
165
+ # @option options [Float] :delay (5)
166
+ # @option options [Proc] :before_attempt
167
+ # @option options [Proc] :before_wait
168
+ # @return [CompositeAlarm]
169
+ def wait_until_exists(options = {}, &block)
170
+ options, params = separate_params_and_options(options)
171
+ waiter = Waiters::CompositeAlarmExists.new(options)
172
+ yield_waiter_and_warn(waiter, &block) if block_given?
173
+ waiter.wait(params.merge(alarm_names: [@name]))
174
+ CompositeAlarm.new({
175
+ name: @name,
176
+ client: @client
177
+ })
178
+ end
179
+
180
+ # @deprecated Use [Aws::CloudWatch::Client] #wait_until instead
181
+ #
182
+ # Waiter polls an API operation until a resource enters a desired
183
+ # state.
184
+ #
185
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
186
+ #
187
+ # ## Basic Usage
188
+ #
189
+ # Waiter will polls until it is successful, it fails by
190
+ # entering a terminal state, or until a maximum number of attempts
191
+ # are made.
192
+ #
193
+ # # polls in a loop until condition is true
194
+ # resource.wait_until(options) {|resource| condition}
195
+ #
196
+ # ## Example
197
+ #
198
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
199
+ #
200
+ # ## Configuration
201
+ #
202
+ # You can configure the maximum number of polling attempts, and the
203
+ # delay (in seconds) between each polling attempt. The waiting condition is set
204
+ # by passing a block to {#wait_until}:
205
+ #
206
+ # # poll for ~25 seconds
207
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
208
+ #
209
+ # ## Callbacks
210
+ #
211
+ # You can be notified before each polling attempt and before each
212
+ # delay. If you throw `:success` or `:failure` from these callbacks,
213
+ # it will terminate the waiter.
214
+ #
215
+ # started_at = Time.now
216
+ # # poll for 1 hour, instead of a number of attempts
217
+ # proc = Proc.new do |attempts, response|
218
+ # throw :failure if Time.now - started_at > 3600
219
+ # end
220
+ #
221
+ # # disable max attempts
222
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
223
+ #
224
+ # ## Handling Errors
225
+ #
226
+ # When a waiter is successful, it returns the Resource. When a waiter
227
+ # fails, it raises an error.
228
+ #
229
+ # begin
230
+ # resource.wait_until(...)
231
+ # rescue Aws::Waiters::Errors::WaiterFailed
232
+ # # resource did not enter the desired state in time
233
+ # end
234
+ #
235
+ #
236
+ # @yield param [Resource] resource to be used in the waiting condition
237
+ #
238
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
239
+ # because the waiter has entered a state that it will not transition
240
+ # out of, preventing success.
241
+ #
242
+ # yet successful.
243
+ #
244
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
245
+ # while polling for a resource that is not expected.
246
+ #
247
+ # @raise [NotImplementedError] Raised when the resource does not
248
+ #
249
+ # @option options [Integer] :max_attempts (10) Maximum number of
250
+ # attempts
251
+ # @option options [Integer] :delay (10) Delay between each
252
+ # attempt in seconds
253
+ # @option options [Proc] :before_attempt (nil) Callback
254
+ # invoked before each attempt
255
+ # @option options [Proc] :before_wait (nil) Callback
256
+ # invoked before each wait
257
+ # @return [Resource] if the waiter was successful
258
+ def wait_until(options = {}, &block)
259
+ self_copy = self.dup
260
+ attempts = 0
261
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
262
+ options[:delay] ||= 10
263
+ options[:poller] = Proc.new do
264
+ attempts += 1
265
+ if block.call(self_copy)
266
+ [:success, self_copy]
267
+ else
268
+ self_copy.reload unless attempts == options[:max_attempts]
269
+ :retry
270
+ end
271
+ end
272
+ Aws::Waiters::Waiter.new(options).wait({})
273
+ end
274
+
275
+ # @!group Actions
276
+
277
+ # @example Request syntax with placeholder values
278
+ #
279
+ # composite_alarm.delete()
280
+ # @param [Hash] options ({})
281
+ # @return [EmptyStructure]
282
+ def delete(options = {})
283
+ options = Aws::Util.deep_merge(options, alarm_names: [@name])
284
+ resp = @client.delete_alarms(options)
285
+ resp.data
286
+ end
287
+
288
+ # @example Request syntax with placeholder values
289
+ #
290
+ # composite_alarm.describe_history({
291
+ # alarm_types: ["CompositeAlarm"], # accepts CompositeAlarm, MetricAlarm
292
+ # history_item_type: "ConfigurationUpdate", # accepts ConfigurationUpdate, StateUpdate, Action
293
+ # start_date: Time.now,
294
+ # end_date: Time.now,
295
+ # max_records: 1,
296
+ # next_token: "NextToken",
297
+ # scan_by: "TimestampDescending", # accepts TimestampDescending, TimestampAscending
298
+ # })
299
+ # @param [Hash] options ({})
300
+ # @option options [Array<String>] :alarm_types
301
+ # Use this parameter to specify whether you want the operation to return
302
+ # metric alarms or composite alarms. If you omit this parameter, only
303
+ # metric alarms are returned.
304
+ # @option options [String] :history_item_type
305
+ # The type of alarm histories to retrieve.
306
+ # @option options [Time,DateTime,Date,Integer,String] :start_date
307
+ # The starting date to retrieve alarm history.
308
+ # @option options [Time,DateTime,Date,Integer,String] :end_date
309
+ # The ending date to retrieve alarm history.
310
+ # @option options [Integer] :max_records
311
+ # The maximum number of alarm history records to retrieve.
312
+ # @option options [String] :next_token
313
+ # The token returned by a previous call to indicate that there is more
314
+ # data available.
315
+ # @option options [String] :scan_by
316
+ # Specified whether to return the newest or oldest alarm history first.
317
+ # Specify `TimestampDescending` to have the newest event history
318
+ # returned first, and specify `TimestampAscending` to have the oldest
319
+ # history returned first.
320
+ # @return [Types::DescribeAlarmHistoryOutput]
321
+ def describe_history(options = {})
322
+ options = options.merge(alarm_name: @name)
323
+ resp = @client.describe_alarm_history(options)
324
+ resp.data
325
+ end
326
+
327
+ # @example Request syntax with placeholder values
328
+ #
329
+ # composite_alarm.disable_actions()
330
+ # @param [Hash] options ({})
331
+ # @return [EmptyStructure]
332
+ def disable_actions(options = {})
333
+ options = Aws::Util.deep_merge(options, alarm_names: [@name])
334
+ resp = @client.disable_alarm_actions(options)
335
+ resp.data
336
+ end
337
+
338
+ # @example Request syntax with placeholder values
339
+ #
340
+ # composite_alarm.enable_actions()
341
+ # @param [Hash] options ({})
342
+ # @return [EmptyStructure]
343
+ def enable_actions(options = {})
344
+ options = Aws::Util.deep_merge(options, alarm_names: [@name])
345
+ resp = @client.enable_alarm_actions(options)
346
+ resp.data
347
+ end
348
+
349
+ # @example Request syntax with placeholder values
350
+ #
351
+ # composite_alarm.set_state({
352
+ # state_value: "OK", # required, accepts OK, ALARM, INSUFFICIENT_DATA
353
+ # state_reason: "StateReason", # required
354
+ # state_reason_data: "StateReasonData",
355
+ # })
356
+ # @param [Hash] options ({})
357
+ # @option options [required, String] :state_value
358
+ # The value of the state.
359
+ # @option options [required, String] :state_reason
360
+ # The reason that this alarm is set to this specific state, in text
361
+ # format.
362
+ # @option options [String] :state_reason_data
363
+ # The reason that this alarm is set to this specific state, in JSON
364
+ # format.
365
+ #
366
+ # For SNS or EC2 alarm actions, this is just informational. But for EC2
367
+ # Auto Scaling or application Auto Scaling alarm actions, the Auto
368
+ # Scaling policy uses the information in this field to take the correct
369
+ # action.
370
+ # @return [EmptyStructure]
371
+ def set_state(options = {})
372
+ options = options.merge(alarm_name: @name)
373
+ resp = @client.set_alarm_state(options)
374
+ resp.data
375
+ end
376
+
377
+ # @deprecated
378
+ # @api private
379
+ def identifiers
380
+ { name: @name }
381
+ end
382
+ deprecated(:identifiers)
383
+
384
+ private
385
+
386
+ def extract_name(args, options)
387
+ value = args[0] || options.delete(:name)
388
+ case value
389
+ when String then value
390
+ when nil then raise ArgumentError, "missing required option :name"
391
+ else
392
+ msg = "expected :name to be a String, got #{value.class}"
393
+ raise ArgumentError, msg
394
+ end
395
+ end
396
+
397
+ def yield_waiter_and_warn(waiter, &block)
398
+ if !@waiter_block_warned
399
+ msg = "pass options to configure the waiter; "
400
+ msg << "yielding the waiter is deprecated"
401
+ warn(msg)
402
+ @waiter_block_warned = true
403
+ end
404
+ yield(waiter.waiter)
405
+ end
406
+
407
+ def separate_params_and_options(options)
408
+ opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
409
+ waiter_opts = {}
410
+ waiter_params = {}
411
+ options.each_pair do |key, value|
412
+ if opts.include?(key)
413
+ waiter_opts[key] = value
414
+ else
415
+ waiter_params[key] = value
416
+ end
417
+ end
418
+ waiter_opts[:client] ||= @client
419
+ [waiter_opts, waiter_params]
420
+ end
421
+
422
+ class Collection < Aws::Resources::Collection
423
+
424
+ # @!group Batch Actions
425
+
426
+ # @param options ({})
427
+ # @return [void]
428
+ def batch_delete!(options = {})
429
+ batch_enum.each do |batch|
430
+ params = Aws::Util.copy_hash(options)
431
+ params[:alarm_names] ||= []
432
+ batch.each do |item|
433
+ params[:alarm_names] << item.name
434
+ end
435
+ batch[0].client.delete_alarms(params)
436
+ end
437
+ nil
438
+ end
439
+
440
+ # @param options ({})
441
+ # @return [void]
442
+ def batch_disable_actions(options = {})
443
+ batch_enum.each do |batch|
444
+ params = Aws::Util.copy_hash(options)
445
+ params[:alarm_names] ||= []
446
+ batch.each do |item|
447
+ params[:alarm_names] << item.name
448
+ end
449
+ batch[0].client.disable_alarm_actions(params)
450
+ end
451
+ nil
452
+ end
453
+
454
+ # @param options ({})
455
+ # @return [void]
456
+ def batch_enable_actions(options = {})
457
+ batch_enum.each do |batch|
458
+ params = Aws::Util.copy_hash(options)
459
+ params[:alarm_names] ||= []
460
+ batch.each do |item|
461
+ params[:alarm_names] << item.name
462
+ end
463
+ batch[0].client.enable_alarm_actions(params)
464
+ end
465
+ nil
466
+ end
467
+
468
+ # @!endgroup
469
+
470
+ end
471
+ end
472
+ end