aws-sdk 1.5.6 → 1.5.7

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.
Files changed (55) hide show
  1. data/lib/aws.rb +2 -0
  2. data/lib/aws/api_config/CloudWatch-2010-08-01.yml +424 -0
  3. data/lib/aws/api_config/STS-2011-06-15.yml +4 -0
  4. data/lib/aws/auto_scaling/activity.rb +2 -2
  5. data/lib/aws/auto_scaling/activity_collection.rb +1 -1
  6. data/lib/aws/auto_scaling/group_collection.rb +1 -1
  7. data/lib/aws/auto_scaling/instance_collection.rb +1 -1
  8. data/lib/aws/auto_scaling/launch_configuration_collection.rb +1 -1
  9. data/lib/aws/auto_scaling/notification_configuration_collection.rb +1 -1
  10. data/lib/aws/auto_scaling/scaling_policy_collection.rb +1 -1
  11. data/lib/aws/auto_scaling/scheduled_action_collection.rb +1 -1
  12. data/lib/aws/auto_scaling/tag_collection.rb +1 -1
  13. data/lib/aws/cloud_watch.rb +75 -0
  14. data/lib/aws/cloud_watch/alarm.rb +272 -0
  15. data/lib/aws/cloud_watch/alarm_collection.rb +153 -0
  16. data/lib/aws/cloud_watch/alarm_history_item.rb +50 -0
  17. data/lib/aws/cloud_watch/alarm_history_item_collection.rb +84 -0
  18. data/lib/aws/cloud_watch/client.rb +333 -0
  19. data/lib/aws/cloud_watch/config.rb +18 -0
  20. data/lib/aws/cloud_watch/errors.rb +22 -0
  21. data/lib/aws/cloud_watch/metric.rb +135 -0
  22. data/lib/aws/cloud_watch/metric_alarm_collection.rb +160 -0
  23. data/lib/aws/cloud_watch/metric_collection.rb +131 -0
  24. data/lib/aws/cloud_watch/metric_statistics.rb +69 -0
  25. data/lib/aws/cloud_watch/request.rb +23 -0
  26. data/lib/aws/core.rb +1 -1
  27. data/lib/aws/core/client.rb +2 -2
  28. data/lib/aws/core/client/query_json.rb +2 -0
  29. data/lib/aws/core/collection.rb +58 -25
  30. data/lib/aws/core/collection/simple.rb +18 -26
  31. data/lib/aws/core/collection/with_limit_and_next_token.rb +71 -0
  32. data/lib/aws/core/collection/with_next_token.rb +97 -0
  33. data/lib/aws/core/credential_providers.rb +36 -0
  34. data/lib/aws/core/option_grammar.rb +19 -0
  35. data/lib/aws/core/page_result.rb +5 -3
  36. data/lib/aws/dynamo_db/client.rb +0 -16
  37. data/lib/aws/dynamo_db/item_collection.rb +1 -1
  38. data/lib/aws/dynamo_db/request.rb +5 -1
  39. data/lib/aws/dynamo_db/table_collection.rb +1 -1
  40. data/lib/aws/iam/collection.rb +1 -1
  41. data/lib/aws/s3/client.rb +1 -1
  42. data/lib/aws/s3/paginated_collection.rb +1 -1
  43. data/lib/aws/simple_db/domain_collection.rb +14 -41
  44. data/lib/aws/simple_db/item_collection.rb +2 -2
  45. data/lib/aws/simple_email_service/identity_collection.rb +1 -1
  46. data/lib/aws/simple_workflow/domain_collection.rb +1 -1
  47. data/lib/aws/simple_workflow/history_event_collection.rb +1 -1
  48. data/lib/aws/simple_workflow/type_collection.rb +1 -1
  49. data/lib/aws/simple_workflow/workflow_execution_collection.rb +1 -1
  50. data/lib/aws/sns/topic.rb +1 -1
  51. data/lib/aws/sts.rb +9 -1
  52. data/lib/aws/sts/client.rb +31 -14
  53. data/lib/net/http/connection_pool.rb +11 -5
  54. metadata +19 -4
  55. data/lib/aws/core/collection/limitable.rb +0 -99
@@ -0,0 +1,50 @@
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
4
+ # may not use this file except in compliance with the License. A copy of
5
+ # the License is located at
6
+ #
7
+ # http://aws.amazon.com/apache2.0/
8
+ #
9
+ # or in the "license" file accompanying this file. This file is
10
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ # ANY KIND, either express or implied. See the License for the specific
12
+ # language governing permissions and limitations under the License.
13
+
14
+ module AWS
15
+ class CloudWatch
16
+ class AlarmHistoryItem
17
+
18
+ # @private
19
+ def initialize options
20
+ @alarm_name = options[:alarm_name]
21
+ @history_data = options[:history_data]
22
+ @history_item_type = options[:history_item_type]
23
+ @history_summary = options[:history_summary]
24
+ @timestamp = options[:timestamp]
25
+ end
26
+
27
+ # @return [String] The descriptive name for the alarm.
28
+ attr_reader :alarm_name
29
+
30
+ # @return [String] Machine-readable data about the alarm in JSON format.
31
+ attr_reader :history_data
32
+
33
+ alias_method :data, :history_data
34
+
35
+ # @return [String] The type of alarm history item.
36
+ attr_reader :history_item_type
37
+
38
+ alias_method :type, :history_item_type
39
+
40
+ # @return [String] A human-readable summary of the alarm history.
41
+ attr_reader :history_summary
42
+
43
+ alias_method :summary, :history_summary
44
+
45
+ # @return [Time] The time stamp for the alarm history item.
46
+ attr_reader :timestamp
47
+
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,84 @@
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
4
+ # may not use this file except in compliance with the License. A copy of
5
+ # the License is located at
6
+ #
7
+ # http://aws.amazon.com/apache2.0/
8
+ #
9
+ # or in the "license" file accompanying this file. This file is
10
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ # ANY KIND, either express or implied. See the License for the specific
12
+ # language governing permissions and limitations under the License.
13
+
14
+ require 'date'
15
+ require 'time'
16
+
17
+ module AWS
18
+ class CloudWatch
19
+ class AlarmHistoryItemCollection
20
+
21
+ include Core::Collection::WithLimitAndNextToken
22
+
23
+ # @private
24
+ def initialize options = {}
25
+ @filters = options[:filters] || {}
26
+ super
27
+ end
28
+
29
+ # @param [String,Symbol] name
30
+ # @param [String] value
31
+ # @return [AlarmHistoryItemCollection]
32
+ def filter name, value
33
+ filters = @filters.merge(name.to_s.to_sym => value)
34
+ AlarmHistoryItemCollection.new(:filters => filters, :config => config)
35
+ end
36
+
37
+ # @param [String] name
38
+ # @return [AlarmHistoryItemCollection]
39
+ def with_alarm_name name
40
+ filter(:alarm_name, name)
41
+ end
42
+
43
+ # @param [Time,DateTime,String<ISO8601>] date
44
+ # @return [AlarmHistoryItemCollection]
45
+ def with_start_date date
46
+ date = date.iso8601 if date.respond_to?(:iso8601)
47
+ filter(:start_date, date)
48
+ end
49
+
50
+ # @param [Time,DateTime,String<ISO8601>] date
51
+ # @return [AlarmHistoryItemCollection]
52
+ def with_end_date date
53
+ date = date.iso8601 if date.respond_to?(:iso8601)
54
+ filter(:end_date, date)
55
+ end
56
+
57
+ # @param [String] type
58
+ # @return [AlarmHistoryItemCollection]
59
+ def with_type type
60
+ filter(:history_item_type, type)
61
+ end
62
+
63
+ protected
64
+
65
+ def _each_item next_token, limit, options = {}, &block
66
+
67
+ options = @filters.merge(options)
68
+ options[:max_records] = limit if limit
69
+ options[:next_token] = next_token if next_token
70
+
71
+ resp = client.describe_alarm_history(options)
72
+ resp.data[:alarm_history_items].each do |details|
73
+
74
+ yield(AlarmHistoryItem.new(details))
75
+
76
+ end
77
+
78
+ resp.data[:next_token]
79
+
80
+ end
81
+
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,333 @@
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
4
+ # may not use this file except in compliance with the License. A copy of
5
+ # the License is located at
6
+ #
7
+ # http://aws.amazon.com/apache2.0/
8
+ #
9
+ # or in the "license" file accompanying this file. This file is
10
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ # ANY KIND, either express or implied. See the License for the specific
12
+ # language governing permissions and limitations under the License.
13
+
14
+ module AWS
15
+ class CloudWatch
16
+
17
+ # Client class for Cloud Watch
18
+ class Client < Core::Client
19
+
20
+ API_VERSION = '2010-08-01'
21
+
22
+ extend Core::Client::QueryXML
23
+
24
+ # @private
25
+ CACHEABLE_REQUESTS = Set[
26
+ :describe_alarm_history,
27
+ :describe_alarms,
28
+ :describe_alarms_for_metric,
29
+ :list_metrics,
30
+ ]
31
+
32
+ ## client methods ##
33
+
34
+ # Calls the DeleteAlarms API operation.
35
+ # @method delete_alarms(options = {})
36
+ #
37
+ # === Options:
38
+ #
39
+ # * +:alarm_names+ - *required* - (Array<String>)
40
+ #
41
+ # === Response Structure:
42
+ #
43
+ # This method returns no response data.
44
+ #
45
+ # @return [Core::Response]
46
+ #
47
+ define_client_method :delete_alarms, 'DeleteAlarms'
48
+
49
+ # Calls the DescribeAlarmHistory API operation.
50
+ # @method describe_alarm_history(options = {})
51
+ #
52
+ # === Options:
53
+ #
54
+ # * +:alarm_name+ - (String)
55
+ # * +:history_item_type+ - (String)
56
+ # * +:start_date+ - (String<ISO8601 datetime>)
57
+ # * +:end_date+ - (String<ISO8601 datetime>)
58
+ # * +:max_records+ - (Integer)
59
+ # * +:next_token+ - (String)
60
+ #
61
+ # === Response Structure:
62
+ #
63
+ # * +:alarm_history_items+ - (Array<Hash>)
64
+ # * +:alarm_name+ - (String)
65
+ # * +:timestamp+ - (Time)
66
+ # * +:history_item_type+ - (String)
67
+ # * +:history_summary+ - (String)
68
+ # * +:history_data+ - (String)
69
+ # * +:next_token+ - (String)
70
+ #
71
+ # @return [Core::Response]
72
+ #
73
+ define_client_method :describe_alarm_history, 'DescribeAlarmHistory'
74
+
75
+ # Calls the DescribeAlarms API operation.
76
+ # @method describe_alarms(options = {})
77
+ #
78
+ # === Options:
79
+ #
80
+ # * +:alarm_names+ - (Array<String>)
81
+ # * +:alarm_name_prefix+ - (String)
82
+ # * +:state_value+ - (String)
83
+ # * +:action_prefix+ - (String)
84
+ # * +:max_records+ - (Integer)
85
+ # * +:next_token+ - (String)
86
+ #
87
+ # === Response Structure:
88
+ #
89
+ # * +:metric_alarms+ - (Array<Hash>)
90
+ # * +:alarm_name+ - (String)
91
+ # * +:alarm_arn+ - (String)
92
+ # * +:alarm_description+ - (String)
93
+ # * +:alarm_configuration_updated_timestamp+ - (Time)
94
+ # * +:actions_enabled+ - (Boolean)
95
+ # * +:ok_actions+ - (Array<String>)
96
+ # * +:alarm_actions+ - (Array<String>)
97
+ # * +:insufficient_data_actions+ - (Array<String>)
98
+ # * +:state_value+ - (String)
99
+ # * +:state_reason+ - (String)
100
+ # * +:state_reason_data+ - (String)
101
+ # * +:state_updated_timestamp+ - (Time)
102
+ # * +:metric_name+ - (String)
103
+ # * +:namespace+ - (String)
104
+ # * +:statistic+ - (String)
105
+ # * +:dimensions+ - (Array<Hash>)
106
+ # * +:name+ - (String)
107
+ # * +:value+ - (String)
108
+ # * +:period+ - (Integer)
109
+ # * +:unit+ - (String)
110
+ # * +:evaluation_periods+ - (Integer)
111
+ # * +:threshold+ - (Numeric)
112
+ # * +:comparison_operator+ - (String)
113
+ # * +:next_token+ - (String)
114
+ #
115
+ # @return [Core::Response]
116
+ #
117
+ define_client_method :describe_alarms, 'DescribeAlarms'
118
+
119
+ # Calls the DescribeAlarmsForMetric API operation.
120
+ # @method describe_alarms_for_metric(options = {})
121
+ #
122
+ # === Options:
123
+ #
124
+ # * +:metric_name+ - *required* - (String)
125
+ # * +:namespace+ - *required* - (String)
126
+ # * +:statistic+ - (String)
127
+ # * +:dimensions+ - (Array<Hash>)
128
+ # * +:name+ - *required* - (String)
129
+ # * +:value+ - *required* - (String)
130
+ # * +:period+ - (Integer)
131
+ # * +:unit+ - (String)
132
+ #
133
+ # === Response Structure:
134
+ #
135
+ # * +:metric_alarms+ - (Array<Hash>)
136
+ # * +:alarm_name+ - (String)
137
+ # * +:alarm_arn+ - (String)
138
+ # * +:alarm_description+ - (String)
139
+ # * +:alarm_configuration_updated_timestamp+ - (Time)
140
+ # * +:actions_enabled+ - (Boolean)
141
+ # * +:ok_actions+ - (Array<String>)
142
+ # * +:alarm_actions+ - (Array<String>)
143
+ # * +:insufficient_data_actions+ - (Array<String>)
144
+ # * +:state_value+ - (String)
145
+ # * +:state_reason+ - (String)
146
+ # * +:state_reason_data+ - (String)
147
+ # * +:state_updated_timestamp+ - (Time)
148
+ # * +:metric_name+ - (String)
149
+ # * +:namespace+ - (String)
150
+ # * +:statistic+ - (String)
151
+ # * +:dimensions+ - (Array<Hash>)
152
+ # * +:name+ - (String)
153
+ # * +:value+ - (String)
154
+ # * +:period+ - (Integer)
155
+ # * +:unit+ - (String)
156
+ # * +:evaluation_periods+ - (Integer)
157
+ # * +:threshold+ - (Numeric)
158
+ # * +:comparison_operator+ - (String)
159
+ #
160
+ # @return [Core::Response]
161
+ #
162
+ define_client_method :describe_alarms_for_metric, 'DescribeAlarmsForMetric'
163
+
164
+ # Calls the DisableAlarmActions API operation.
165
+ # @method disable_alarm_actions(options = {})
166
+ #
167
+ # === Options:
168
+ #
169
+ # * +:alarm_names+ - *required* - (Array<String>)
170
+ #
171
+ # === Response Structure:
172
+ #
173
+ # This method returns no response data.
174
+ #
175
+ # @return [Core::Response]
176
+ #
177
+ define_client_method :disable_alarm_actions, 'DisableAlarmActions'
178
+
179
+ # Calls the EnableAlarmActions API operation.
180
+ # @method enable_alarm_actions(options = {})
181
+ #
182
+ # === Options:
183
+ #
184
+ # * +:alarm_names+ - *required* - (Array<String>)
185
+ #
186
+ # === Response Structure:
187
+ #
188
+ # This method returns no response data.
189
+ #
190
+ # @return [Core::Response]
191
+ #
192
+ define_client_method :enable_alarm_actions, 'EnableAlarmActions'
193
+
194
+ # Calls the GetMetricStatistics API operation.
195
+ # @method get_metric_statistics(options = {})
196
+ #
197
+ # === Options:
198
+ #
199
+ # * +:namespace+ - *required* - (String)
200
+ # * +:metric_name+ - *required* - (String)
201
+ # * +:dimensions+ - (Array<Hash>)
202
+ # * +:name+ - *required* - (String)
203
+ # * +:value+ - *required* - (String)
204
+ # * +:start_time+ - *required* - (String<ISO8601 datetime>)
205
+ # * +:end_time+ - *required* - (String<ISO8601 datetime>)
206
+ # * +:period+ - *required* - (Integer)
207
+ # * +:statistics+ - *required* - (Array<String>)
208
+ # * +:unit+ - (String)
209
+ #
210
+ # === Response Structure:
211
+ #
212
+ # * +:label+ - (String)
213
+ # * +:datapoints+ - (Array<Hash>)
214
+ # * +:timestamp+ - (Time)
215
+ # * +:sample_count+ - (Numeric)
216
+ # * +:average+ - (Numeric)
217
+ # * +:sum+ - (Numeric)
218
+ # * +:minimum+ - (Numeric)
219
+ # * +:maximum+ - (Numeric)
220
+ # * +:unit+ - (String)
221
+ #
222
+ # @return [Core::Response]
223
+ #
224
+ define_client_method :get_metric_statistics, 'GetMetricStatistics'
225
+
226
+ # Calls the ListMetrics API operation.
227
+ # @method list_metrics(options = {})
228
+ #
229
+ # === Options:
230
+ #
231
+ # * +:namespace+ - (String)
232
+ # * +:metric_name+ - (String)
233
+ # * +:dimensions+ - (Array<Hash>)
234
+ # * +:name+ - *required* - (String)
235
+ # * +:value+ - (String)
236
+ # * +:next_token+ - (String)
237
+ #
238
+ # === Response Structure:
239
+ #
240
+ # * +:metrics+ - (Array<Hash>)
241
+ # * +:namespace+ - (String)
242
+ # * +:metric_name+ - (String)
243
+ # * +:dimensions+ - (Array<Hash>)
244
+ # * +:name+ - (String)
245
+ # * +:value+ - (String)
246
+ # * +:next_token+ - (String)
247
+ #
248
+ # @return [Core::Response]
249
+ #
250
+ define_client_method :list_metrics, 'ListMetrics'
251
+
252
+ # Calls the PutMetricAlarm API operation.
253
+ # @method put_metric_alarm(options = {})
254
+ #
255
+ # === Options:
256
+ #
257
+ # * +:alarm_name+ - *required* - (String)
258
+ # * +:alarm_description+ - (String)
259
+ # * +:actions_enabled+ - (Boolean)
260
+ # * +:ok_actions+ - (Array<String>)
261
+ # * +:alarm_actions+ - (Array<String>)
262
+ # * +:insufficient_data_actions+ - (Array<String>)
263
+ # * +:metric_name+ - *required* - (String)
264
+ # * +:namespace+ - *required* - (String)
265
+ # * +:statistic+ - *required* - (String)
266
+ # * +:dimensions+ - (Array<Hash>)
267
+ # * +:name+ - *required* - (String)
268
+ # * +:value+ - *required* - (String)
269
+ # * +:period+ - *required* - (Integer)
270
+ # * +:unit+ - (String)
271
+ # * +:evaluation_periods+ - *required* - (Integer)
272
+ # * +:threshold+ - *required* - (Float)
273
+ # * +:comparison_operator+ - *required* - (String)
274
+ #
275
+ # === Response Structure:
276
+ #
277
+ # This method returns no response data.
278
+ #
279
+ # @return [Core::Response]
280
+ #
281
+ define_client_method :put_metric_alarm, 'PutMetricAlarm'
282
+
283
+ # Calls the PutMetricData API operation.
284
+ # @method put_metric_data(options = {})
285
+ #
286
+ # === Options:
287
+ #
288
+ # * +:namespace+ - *required* - (String)
289
+ # * +:metric_data+ - *required* - (Array<Hash>)
290
+ # * +:metric_name+ - *required* - (String)
291
+ # * +:dimensions+ - (Array<Hash>)
292
+ # * +:name+ - *required* - (String)
293
+ # * +:value+ - *required* - (String)
294
+ # * +:timestamp+ - (String<ISO8601 datetime>)
295
+ # * +:value+ - (Float)
296
+ # * +:statistic_values+ - (Hash)
297
+ # * +:sample_count+ - *required* - (Float)
298
+ # * +:sum+ - *required* - (Float)
299
+ # * +:minimum+ - *required* - (Float)
300
+ # * +:maximum+ - *required* - (Float)
301
+ # * +:unit+ - (String)
302
+ #
303
+ # === Response Structure:
304
+ #
305
+ # This method returns no response data.
306
+ #
307
+ # @return [Core::Response]
308
+ #
309
+ define_client_method :put_metric_data, 'PutMetricData'
310
+
311
+ # Calls the SetAlarmState API operation.
312
+ # @method set_alarm_state(options = {})
313
+ #
314
+ # === Options:
315
+ #
316
+ # * +:alarm_name+ - *required* - (String)
317
+ # * +:state_value+ - *required* - (String)
318
+ # * +:state_reason+ - *required* - (String)
319
+ # * +:state_reason_data+ - (String)
320
+ #
321
+ # === Response Structure:
322
+ #
323
+ # This method returns no response data.
324
+ #
325
+ # @return [Core::Response]
326
+ #
327
+ define_client_method :set_alarm_state, 'SetAlarmState'
328
+
329
+ ## end client methods ##
330
+
331
+ end
332
+ end
333
+ end