aws-sdk 1.32.0 → 1.50.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -10
  3. data/bin/aws-rb +11 -1
  4. data/endpoints.json +191 -26
  5. data/lib/aws/api_config/AutoScaling-2011-01-01.yml +201 -0
  6. data/lib/aws/api_config/CloudFormation-2010-05-15.yml +15 -1
  7. data/lib/aws/api_config/CloudFront-2013-11-22.yml +2918 -0
  8. data/lib/aws/api_config/CloudFront-2014-01-31.yml +2934 -0
  9. data/lib/aws/api_config/CloudFront-2014-05-31.yml +3100 -0
  10. data/lib/aws/api_config/CloudSearch-2013-01-01.yml +1164 -0
  11. data/lib/aws/api_config/CloudTrail-2013-11-01.yml +4 -33
  12. data/lib/aws/api_config/DynamoDB-2012-08-10.yml +101 -1
  13. data/lib/aws/api_config/EC2-2013-08-15.yml +2 -2
  14. data/lib/aws/api_config/EC2-2013-10-01.yml +2 -2
  15. data/lib/aws/api_config/EC2-2013-10-15.yml +3 -78
  16. data/lib/aws/api_config/EC2-2014-02-01.yml +4755 -0
  17. data/lib/aws/api_config/EC2-2014-05-01.yml +4812 -0
  18. data/lib/aws/api_config/ELB-2012-06-01.yml +65 -1
  19. data/lib/aws/api_config/EMR-2009-03-31.yml +20 -1
  20. data/lib/aws/api_config/ElastiCache-2014-03-24.yml +1375 -0
  21. data/lib/aws/api_config/ElastiCache-2014-07-15.yml +1385 -0
  22. data/lib/aws/api_config/ElasticBeanstalk-2010-12-01.yml +8 -1
  23. data/lib/aws/api_config/ElasticTranscoder-2012-09-25.yml +798 -1
  24. data/lib/aws/api_config/IAM-2010-05-08.yml +44 -2
  25. data/lib/aws/api_config/Kinesis-2013-12-02.yml +1 -1
  26. data/lib/aws/api_config/OpsWorks-2013-02-18.yml +201 -1
  27. data/lib/aws/api_config/RDS-2013-09-09.yml +1 -2
  28. data/lib/aws/api_config/Redshift-2012-12-01.yml +25 -1
  29. data/lib/aws/api_config/Route53-2013-04-01.yml +889 -0
  30. data/lib/aws/api_config/SNS-2010-03-31.yml +16 -1
  31. data/lib/aws/api_config/SQS-2012-11-05.yml +86 -1
  32. data/lib/aws/api_config/STS-2011-06-15.yml +5 -1
  33. data/lib/aws/api_config/SimpleEmailService-2010-12-01.yml +1 -1
  34. data/lib/aws/api_config/Support-2013-04-15.yml +63 -0
  35. data/lib/aws/auto_scaling/group.rb +1 -1
  36. data/lib/aws/cloud_formation/stack_resource_collection.rb +1 -1
  37. data/lib/aws/cloud_front/client.rb +13 -1
  38. data/lib/aws/cloud_search/client.rb +6 -2
  39. data/lib/aws/cloud_watch/alarm.rb +3 -0
  40. data/lib/aws/core.rb +16 -1
  41. data/lib/aws/core/client.rb +10 -1
  42. data/lib/aws/core/configuration.rb +3 -2
  43. data/lib/aws/core/credential_providers.rb +130 -12
  44. data/lib/aws/core/http/connection_pool.rb +23 -3
  45. data/lib/aws/core/http/net_http_handler.rb +18 -21
  46. data/lib/aws/core/http/request.rb +10 -0
  47. data/lib/aws/core/ini_parser.rb +42 -0
  48. data/lib/aws/core/lazy_error_classes.rb +20 -2
  49. data/lib/aws/core/log_formatter.rb +1 -1
  50. data/lib/aws/core/model.rb +5 -0
  51. data/lib/aws/core/option_grammar.rb +9 -9
  52. data/lib/aws/core/policy.rb +2 -3
  53. data/lib/aws/core/response.rb +4 -0
  54. data/lib/aws/core/signers/version_4.rb +1 -1
  55. data/lib/aws/core/signers/version_4/chunk_signed_stream.rb +1 -1
  56. data/lib/aws/core/xml/frame.rb +1 -0
  57. data/lib/aws/core/xml/grammar.rb +1 -0
  58. data/lib/aws/dynamo_db.rb +16 -0
  59. data/lib/aws/dynamo_db/batch_write.rb +2 -0
  60. data/lib/aws/dynamo_db/table.rb +4 -8
  61. data/lib/aws/ec2.rb +1 -1
  62. data/lib/aws/ec2/client.rb +64 -1
  63. data/lib/aws/ec2/image_collection.rb +1 -2
  64. data/lib/aws/ec2/instance.rb +3 -3
  65. data/lib/aws/ec2/instance_collection.rb +14 -3
  66. data/lib/aws/ec2/snapshot_collection.rb +1 -1
  67. data/lib/aws/ec2/subnet_collection.rb +7 -3
  68. data/lib/aws/ec2/tagged_collection.rb +14 -0
  69. data/lib/aws/ec2/volume_collection.rb +4 -0
  70. data/lib/aws/ec2/vpc.rb +8 -0
  71. data/lib/aws/ec2/vpc_collection.rb +1 -1
  72. data/lib/aws/elasticache/client.rb +8 -2
  73. data/lib/aws/emr/job_flow_collection.rb +4 -6
  74. data/lib/aws/glacier.rb +4 -4
  75. data/lib/aws/glacier/vault.rb +1 -1
  76. data/lib/aws/iam/server_certificate.rb +24 -17
  77. data/lib/aws/iam/signing_certificate.rb +13 -1
  78. data/lib/aws/rails.rb +1 -1
  79. data/lib/aws/rds/db_instance.rb +5 -6
  80. data/lib/aws/record/abstract_base.rb +0 -1
  81. data/lib/aws/record/hash_model.rb +1 -1
  82. data/lib/aws/record/model.rb +1 -1
  83. data/lib/aws/route_53/client.rb +5 -2
  84. data/lib/aws/route_53/hosted_zone.rb +39 -16
  85. data/lib/aws/route_53/hosted_zone_collection.rb +2 -1
  86. data/lib/aws/s3/bucket_lifecycle_configuration.rb +22 -6
  87. data/lib/aws/s3/cipher_io.rb +1 -1
  88. data/lib/aws/s3/client.rb +155 -7
  89. data/lib/aws/s3/client/xml.rb +7 -0
  90. data/lib/aws/s3/multipart_upload.rb +3 -1
  91. data/lib/aws/s3/object_collection.rb +1 -1
  92. data/lib/aws/s3/presign_v4.rb +13 -4
  93. data/lib/aws/s3/s3_object.rb +3 -0
  94. data/lib/aws/simple_email_service.rb +13 -0
  95. data/lib/aws/simple_email_service/identity.rb +21 -0
  96. data/lib/aws/simple_workflow/decision_task.rb +2 -2
  97. data/lib/aws/simple_workflow/decision_task_collection.rb +0 -2
  98. data/lib/aws/simple_workflow/option_formatters.rb +1 -1
  99. data/lib/aws/simple_workflow/workflow_execution_collection.rb +2 -2
  100. data/lib/aws/simple_workflow/workflow_type.rb +0 -2
  101. data/lib/aws/sns/message.rb +11 -1
  102. data/lib/aws/sns/topic.rb +1 -1
  103. data/lib/aws/sns/topic_collection.rb +1 -1
  104. data/lib/aws/sqs/queue.rb +26 -14
  105. data/lib/aws/sqs/queue_collection.rb +4 -0
  106. data/lib/aws/sqs/received_message.rb +4 -0
  107. data/lib/aws/sts/client.rb +9 -0
  108. data/lib/aws/version.rb +1 -1
  109. metadata +113 -117
@@ -154,7 +154,7 @@ module AWS
154
154
  end
155
155
 
156
156
  def _service response
157
- response.http_request.class.name.split('::')[1]
157
+ response.http_request.service
158
158
  end
159
159
 
160
160
  def _region response
@@ -52,6 +52,11 @@ module AWS
52
52
  "<#{self.class}>"
53
53
  end
54
54
 
55
+ # @api private
56
+ def to_yaml_properties
57
+ instance_variables.map(&:to_s) - %w(@config)
58
+ end
59
+
55
60
  end
56
61
  end
57
62
  end
@@ -378,13 +378,13 @@ module AWS
378
378
 
379
379
  option.extend self
380
380
 
381
- key_option = option.key_option
381
+ key_option = option.key_option(members)
382
382
  if key_descriptors = members[:key]
383
383
  key_option = key_option.extend_with_config(*key_descriptors)
384
384
  MetaUtils.extend_method(option, :key_option) { key_option }
385
385
  end
386
386
 
387
- value_option = option.value_option
387
+ value_option = option.value_option(members)
388
388
  if value_descriptors = members[:value]
389
389
  value_option = value_option.extend_with_config(*value_descriptors)
390
390
  MetaUtils.extend_method(option, :value_option) { value_option }
@@ -416,13 +416,13 @@ module AWS
416
416
  values.inject([]) do |params, (key,value)|
417
417
 
418
418
  index = params.size / 2 + 1
419
- common_prefix = "#{prefixed_name(prefix)}#{separator}#{index}."
419
+ common_prefix = "#{prefixed_name(prefix)}#{separator}#{index}"
420
420
 
421
421
  key_name = common_prefix + key_option.param_name
422
422
  value_name = common_prefix + value_option.param_name
423
423
 
424
- params << Http::Request::Param.new(key_name, key)
425
- params << Http::Request::Param.new(value_name, value)
424
+ params += key_option.request_params(key, common_prefix)
425
+ params += value_option.request_params(value, common_prefix)
426
426
 
427
427
  end
428
428
  end
@@ -436,12 +436,12 @@ module AWS
436
436
  end
437
437
  end
438
438
 
439
- def key_option
440
- @_key_option ||= MapOption.new("key")
439
+ def key_option(options)
440
+ @_key_option ||= MapOption.new(options[:key_param] || "key")
441
441
  end
442
442
 
443
- def value_option
444
- @_value_option ||= MapOption.new("value")
443
+ def value_option(options)
444
+ @_value_option ||= MapOption.new(options[:value_param] || "value")
445
445
  end
446
446
 
447
447
  end
@@ -11,7 +11,6 @@
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
- require 'uuidtools'
15
14
  require 'date'
16
15
  require 'json'
17
16
 
@@ -84,7 +83,7 @@ module AWS
84
83
  if opts.has_key?(:id) or opts.has_key?("Id")
85
84
  @id = opts[:id] || opts["Id"]
86
85
  else
87
- @id = UUIDTools::UUID.timestamp_create.to_s.tr('-','')
86
+ @id = SecureRandom.uuid.tr('-','')
88
87
  end
89
88
  if opts.has_key?(:version) or opts.has_key?("Version")
90
89
  @version = opts[:version] || opts["Version"]
@@ -748,7 +747,7 @@ module AWS
748
747
  # Policy#deny to add conditions to a statement.
749
748
  # @see S3::Client
750
749
  def initialize(opts = {})
751
- self.sid = UUIDTools::UUID.timestamp_create.to_s.tr('-','')
750
+ self.sid = SecureRandom.uuid.tr('-','')
752
751
  self.conditions = ConditionBlock.new
753
752
 
754
753
  parse_options(opts)
@@ -70,6 +70,9 @@ module AWS
70
70
  # returned this response.
71
71
  attr_accessor :request_type
72
72
 
73
+ # @return [String] The API version of the request/client.
74
+ attr_accessor :api_version
75
+
73
76
  # @return [Hash] Returns the hash of options passed to the client
74
77
  # request method that generated this response.
75
78
  attr_accessor :request_options
@@ -141,6 +144,7 @@ module AWS
141
144
  # @api private
142
145
  def cache_key
143
146
  [
147
+ api_version,
144
148
  http_request.access_key_id,
145
149
  http_request.host,
146
150
  request_type,
@@ -192,7 +192,7 @@ module AWS
192
192
  # @param [String] value
193
193
  # @return [String]
194
194
  def hexdigest value
195
- digest = Digest::SHA256.new
195
+ digest = OpenSSL::Digest::SHA256.new
196
196
  if value.respond_to?(:read)
197
197
  chunk = nil
198
198
  chunk_size = 1024 * 1024 # 1 megabyte
@@ -150,7 +150,7 @@ module AWS
150
150
  end
151
151
 
152
152
  def hash value
153
- Digest::SHA256.new.update(value).hexdigest
153
+ OpenSSL::Digest::SHA256.new.update(value).hexdigest
154
154
  end
155
155
 
156
156
  class << self
@@ -231,6 +231,7 @@ module AWS
231
231
  # that AWS uses almost (??) everywhere.
232
232
  if @text.tr(*TRANSLATE_DIGITS) == EASY_FORMAT
233
233
  parts = @text.tr(*DATE_PUNCTUATION).chop.split.map {|p| p.to_i }
234
+ parts[-1] = parts[-1] * 1000
234
235
  klass.send(parts_constructor, *parts)
235
236
  else
236
237
  # fallback in case we have to handle another date format
@@ -283,6 +283,7 @@ module AWS
283
283
  other.is_a?(Grammar) and self.rules == other.rules
284
284
  end
285
285
  alias_method :==, :eql?
286
+ public :==
286
287
 
287
288
  def enum *args; end
288
289
  def position *args; end
data/lib/aws/dynamo_db.rb CHANGED
@@ -22,6 +22,20 @@ module AWS
22
22
  # :access_key_id => '...',
23
23
  # :secret_access_key => '...')
24
24
  #
25
+ # # Supported API Version
26
+ #
27
+ # Please note, the `AWS::DynamoDB` classes have been built against
28
+ # the 2011-12-05 API version. Constructing a `AWS::DynamoDB` object
29
+ # with a newer API version will emit a warning and then ignore the
30
+ # specified version.
31
+ #
32
+ # If you would like to use features of the newer 2012-08-10 API
33
+ # version, then please construct a DynamoDB client and use the
34
+ # client API directly.
35
+ #
36
+ # # supports the latest API version
37
+ # ddb = AWS::DynamoDB::Client.new(api_verison:'2012-08-10')
38
+ #
25
39
  # # Tables
26
40
  #
27
41
  # Tables contain items, and organize information into discrete
@@ -124,10 +138,12 @@ module AWS
124
138
 
125
139
  endpoint_prefix 'dynamodb'
126
140
 
141
+ IGNORING_API_SPECIFIED_MSG = "WARNING: Ignoring DynamoDB API version specified because only '2011-12-05' is supported by this class. To use another version of the API, invoke the lower level AWS::DynamoDB::Client explicitly."
127
142
 
128
143
  def initialize options = {}
129
144
  options = options.dup
130
145
  options[:dynamo_db] ||= {}
146
+ warn(IGNORING_API_SPECIFIED_MSG) if options[:dynamo_db][:api_version]
131
147
  options[:dynamo_db][:api_version] = '2011-12-05'
132
148
  super(options)
133
149
  end
@@ -240,8 +240,10 @@ module AWS
240
240
  case type
241
241
  when "S" then { :s => value }
242
242
  when "N" then { :n => value }
243
+ when "B" then { :b => value }
243
244
  when "SS" then { :ss => value }
244
245
  when "NS" then { :ns => value }
246
+ when "BS" then { :bs => value }
245
247
  else
246
248
  raise "unhandled key type: #{type.inspect}"
247
249
  end
@@ -154,15 +154,11 @@ module AWS
154
154
  end
155
155
  end
156
156
 
157
+ # Updates the provisioned throughput for this table.
157
158
  # @param [Hash] options
158
- #
159
- # @option options [Integer] :read_capacity_units
160
- #
161
- # @option options [Integer] :write_capacity_units
162
- #
163
- # @return [Hash] Returns a hash with the current throughput
164
- # provisioning (`:read_capacity_units` and `:write_capacity_units`).
165
- #
159
+ # @option options [Integer] :read_capacity_units The desired read capacity units.
160
+ # @option options [Integer] :write_capacity_units The desired write capacity units.
161
+ # @return [Hash] Returns the given `options` hash.
166
162
  def provision_throughput options = {}
167
163
 
168
164
  options[:read_capacity_units] ||= read_capacity_units
data/lib/aws/ec2.rb CHANGED
@@ -123,7 +123,7 @@ module AWS
123
123
  # In the following example we release all elastic IP addresses that are
124
124
  # not currently associated with an instance:
125
125
  #
126
- # ec2.select{|ip| !ip.associated? }.each(&:release)
126
+ # ec2.elastic_ips.select{|ip| !ip.associated? }.each(&:release)
127
127
  #
128
128
  # ## Key Pairs
129
129
  #
@@ -17,7 +17,7 @@ module AWS
17
17
  # Client class for Amazon Elastic Compute Cloud (EC2).
18
18
  class Client < Core::QueryClient
19
19
 
20
- API_VERSION = '2013-10-15'
20
+ API_VERSION = '2014-05-01'
21
21
 
22
22
  def sign_request request
23
23
  version = @config.ec2_signature_version ?
@@ -31,6 +31,14 @@ module AWS
31
31
  end
32
32
  end
33
33
 
34
+ def retryable_error?(response)
35
+ if response.error.is_a?(Errors::InsufficientInstanceCapacity)
36
+ false
37
+ else
38
+ super
39
+ end
40
+ end
41
+
34
42
  # @api private
35
43
  CACHEABLE_REQUESTS = Set[
36
44
  :describe_addresses,
@@ -97,5 +105,60 @@ module AWS
97
105
  define_client_methods('2013-10-15')
98
106
  end
99
107
 
108
+ class Client::V20140201 < Client
109
+ define_client_methods('2014-02-01')
110
+ end
111
+
112
+ class Client::V20140501 < Client
113
+
114
+ define_client_methods('2014-05-01')
115
+
116
+ alias basic_copy_snapshot copy_snapshot
117
+
118
+ def copy_snapshot(params = {})
119
+ # Adding logic to auto-compute the destination group and presigned
120
+ # url params for the copy snapshot operation. This is necessary
121
+ # when calling copy snapshot on snapshots for encrypted volumes.
122
+ # This addition should be transparent to the API user.
123
+ params = params.dup
124
+ params[:destination_region] = @region
125
+ params[:presigned_url] = presigned_copy_snapshot_url(params)
126
+ basic_copy_snapshot(params)
127
+ end
128
+
129
+ private
130
+
131
+ def presigned_copy_snapshot_url(params)
132
+ token = credential_provider.session_token
133
+
134
+ client = self.with_options(:ec2_region => params[:source_region])
135
+
136
+ req = client.build_request(:copy_snapshot, params)
137
+
138
+ now = req.remove_param("Timestamp").value
139
+ now = Time.parse(now).strftime("%Y%m%dT%H%M%SZ")
140
+
141
+ req.add_param("X-Amz-Algorithm", "AWS4-HMAC-SHA256")
142
+ req.add_param("X-Amz-Date", now)
143
+ req.add_param("X-Amz-SignedHeaders", 'host')
144
+ req.add_param("X-Amz-Expires", "3600")
145
+ req.add_param('X-Amz-Security-Token', token) if token
146
+ req.add_param("X-Amz-Credential", client.v4_signer.credential(now))
147
+
148
+ req.http_method = 'GET'
149
+ req.uri = '/?' + req.url_encoded_params
150
+ req.body = ''
151
+ req.headers.clear
152
+ req.headers['host'] = client.config.ec2_endpoint
153
+
154
+ key = client.v4_signer.derive_key(now)
155
+ sig = client.v4_signer.signature(req, key, now, client.v4_signer.class::EMPTY_DIGEST)
156
+
157
+ req.add_param('X-Amz-Signature', sig)
158
+
159
+ req.endpoint + '/?' + req.url_encoded_params
160
+ end
161
+
162
+ end
100
163
  end
101
164
  end
@@ -72,8 +72,7 @@ module AWS
72
72
 
73
73
  # @yield [image] Each image in the collection.
74
74
  # @return [nil]
75
- def each &block
76
- opts = {}
75
+ def each(opts = {}, &block)
77
76
  opts[:owners] = @owners.map { |id| id.to_s } unless @owners.empty?
78
77
  opts[:executable_users] = @executable_users.map { |id| id.to_s } unless
79
78
  @executable_users.empty?
@@ -40,7 +40,7 @@ module AWS
40
40
  # @attr [Boolean] ebs_optimized The instance must be in a stopped state to
41
41
  # change the ebs_optimized state.
42
42
  #
43
- # @attr [Boolean] api_termination_disabled True if the instance
43
+ # @attr [Boolean] api_termination_disabled? True if the instance
44
44
  # cannot be terminated using the {#terminate} method. This
45
45
  # attribute can be changed at any time.
46
46
  #
@@ -267,7 +267,7 @@ module AWS
267
267
 
268
268
  describe_call_attribute :client_token
269
269
 
270
- describe_call_attribute :image_id
270
+ describe_call_attribute :image_id, :static => true
271
271
 
272
272
  describe_call_attribute :key_name, :static => true
273
273
 
@@ -304,7 +304,7 @@ module AWS
304
304
  mutable_describe_call_attribute :ramdisk_id, :set_as => :ramdisk
305
305
 
306
306
  mutable_describe_attribute :source_dest_check do
307
- translates_output{|bool| bool == "true" }
307
+ translates_output{|bool| bool.to_s == "true" }
308
308
  end
309
309
 
310
310
  alias_method :source_dest_check?, :source_dest_check
@@ -12,7 +12,6 @@
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
14
  require 'base64'
15
- require 'uuidtools'
16
15
 
17
16
  module AWS
18
17
  class EC2
@@ -118,6 +117,9 @@ module AWS
118
117
  # availability zone where the instance should run. Without
119
118
  # this option, EC2 will choose an availability zone for you.
120
119
  #
120
+ # @option options [String] :placement_group Specifies the
121
+ # cluster placement group where the instance should run.
122
+ #
121
123
  # @option options [String] :image_id ID of the AMI you want to
122
124
  # launch.
123
125
  #
@@ -199,6 +201,8 @@ module AWS
199
201
  # *NOTE:* EBS Optimized instances incur an additional service charge. This
200
202
  # optional is only valid for certain instance types.
201
203
  #
204
+ # @option options [Boolean] :associate_public_ip_address (false)
205
+ #
202
206
  # @return [Instance or Array] If a single instance is being created,
203
207
  # this returns an {EC2::Instance} to represent the newly
204
208
  # created instance. Otherwise it returns an array of instance
@@ -255,6 +259,11 @@ module AWS
255
259
  options.delete(:availability_zone)
256
260
  end
257
261
 
262
+ if options[:placement_group]
263
+ placement[:group_name] = options[:placement_group].to_s
264
+ options.delete(:placement_group)
265
+ end
266
+
258
267
  if options[:dedicated_tenancy]
259
268
  placement[:tenancy] = 'dedicated'
260
269
  options.delete(:dedicated_tenancy)
@@ -289,7 +298,7 @@ module AWS
289
298
 
290
299
  security_group_opts(options)
291
300
 
292
- options[:client_token] = UUIDTools::UUID.timestamp_create.to_s
301
+ options[:client_token] = SecureRandom.uuid
293
302
 
294
303
  resp = client.run_instances(options)
295
304
 
@@ -308,7 +317,9 @@ module AWS
308
317
  response = filtered_request(:describe_instances)
309
318
  response.reservation_set.each do |reservation|
310
319
  reservation.instances_set.each do |i|
311
- yield(Instance.new(i.instance_id, :config => config))
320
+ instance = Instance.new_from(:describe_instances, i,
321
+ i.instance_id, :config => config)
322
+ yield(instance)
312
323
  end
313
324
  end
314
325
  end
@@ -29,7 +29,7 @@ module AWS
29
29
  # snapshot.exists?
30
30
  #
31
31
  # @example Get a map of snapshot IDs to snapshot status
32
- # ec2.snapshots.inject({}) { |m, s| m[i.id] = s.status; m }
32
+ # ec2.snapshots.inject({}) { |m, s| m[s.id] = s.status; m }
33
33
  # # => { "snap-12345678" => :pending, "snap-87654321" => :completed }
34
34
  class SnapshotCollection < Collection
35
35
 
@@ -51,9 +51,13 @@ module AWS
51
51
  include TaggedCollection
52
52
  include Core::Collection::Simple
53
53
 
54
- # Creates a Subnet. Subnets require a valid CIDR block and
55
- # are created inside a VPC. If this collection does not
56
- # have a
54
+ # Creates a Subnet. Subnets require a valid CIDR block and are created
55
+ # inside an existing VPC. If you do not set an AvailabilityZone, then
56
+ # Amazon EC2 will select one for you (this is recommended).
57
+ #
58
+ # For complete information about creating subnets, see
59
+ # {http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSubnet.html
60
+ # CreateSubnet} in the Amazon EC2 API Reference.
57
61
  #
58
62
  # @param [String] cidr_block The CIDR block you want the subnet to
59
63
  # cover (e.g., 10.0.0.0/24).
@@ -22,6 +22,20 @@ module AWS
22
22
  #
23
23
  module TaggedCollection
24
24
 
25
+ # Filters the collection by a paired tag key and value.
26
+ #
27
+ # ec2.instances.with_tag('role', 'web')
28
+ #
29
+ # You can filter a single tag key with multiple values:
30
+ #
31
+ # ec2.instances.with_tag('role', ['web', 'db'])
32
+ #
33
+ # @param [String] tag_key
34
+ # @param [String, Array<String>] tag_value
35
+ def with_tag(tag_key, *values)
36
+ filter("tag:#{tag_key}", *values)
37
+ end
38
+
25
39
  # Filter the collection by one or more tag keys. If you pass multiple
26
40
  # tag keys they will be be treated as OR conditions. If you want to
27
41
  # AND them together call tagged multiple times (chained).