aws-sdk 1.38.0 → 1.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +23 -8
  3. data/bin/aws-rb +0 -1
  4. data/lib/aws/api_config/AutoScaling-2011-01-01.yml +2 -0
  5. data/lib/aws/api_config/DynamoDB-2012-08-10.yml +101 -1
  6. data/lib/aws/api_config/ElastiCache-2014-03-24.yml +1375 -0
  7. data/lib/aws/api_config/OpsWorks-2013-02-18.yml +28 -0
  8. data/lib/aws/auto_scaling/group.rb +1 -1
  9. data/lib/aws/core.rb +14 -0
  10. data/lib/aws/core/client.rb +2 -1
  11. data/lib/aws/core/configuration.rb +1 -1
  12. data/lib/aws/core/credential_providers.rb +23 -10
  13. data/lib/aws/core/http/connection_pool.rb +12 -2
  14. data/lib/aws/core/http/request.rb +3 -0
  15. data/lib/aws/core/log_formatter.rb +1 -1
  16. data/lib/aws/core/policy.rb +2 -3
  17. data/lib/aws/dynamo_db/table.rb +4 -8
  18. data/lib/aws/ec2/instance.rb +1 -1
  19. data/lib/aws/ec2/instance_collection.rb +12 -3
  20. data/lib/aws/elasticache/client.rb +5 -2
  21. data/lib/aws/glacier/vault.rb +1 -1
  22. data/lib/aws/iam/server_certificate.rb +24 -17
  23. data/lib/aws/rails.rb +1 -1
  24. data/lib/aws/record/abstract_base.rb +0 -1
  25. data/lib/aws/record/hash_model.rb +1 -1
  26. data/lib/aws/record/model.rb +1 -1
  27. data/lib/aws/route_53/hosted_zone_collection.rb +2 -1
  28. data/lib/aws/s3/bucket_lifecycle_configuration.rb +1 -2
  29. data/lib/aws/s3/client.rb +48 -2
  30. data/lib/aws/s3/presign_v4.rb +1 -0
  31. data/lib/aws/s3/s3_object.rb +1 -0
  32. data/lib/aws/simple_workflow/decision_task.rb +2 -2
  33. data/lib/aws/simple_workflow/decision_task_collection.rb +0 -2
  34. data/lib/aws/simple_workflow/option_formatters.rb +1 -1
  35. data/lib/aws/simple_workflow/workflow_type.rb +0 -2
  36. data/lib/aws/sqs/queue.rb +1 -1
  37. data/lib/aws/version.rb +1 -1
  38. metadata +3 -16
@@ -83,6 +83,12 @@
83
83
  - :string
84
84
  Version:
85
85
  - :string
86
+ ChefConfiguration:
87
+ - :structure:
88
+ ManageBerkshelf:
89
+ - :boolean
90
+ BerkshelfVersion:
91
+ - :string
86
92
  UseCustomCookbooks:
87
93
  - :boolean
88
94
  UseOpsworksSecurityGroups:
@@ -357,6 +363,12 @@
357
363
  - :string
358
364
  Version:
359
365
  - :string
366
+ ChefConfiguration:
367
+ - :structure:
368
+ ManageBerkshelf:
369
+ - :boolean
370
+ BerkshelfVersion:
371
+ - :string
360
372
  UseCustomCookbooks:
361
373
  - :boolean
362
374
  UseOpsworksSecurityGroups:
@@ -1261,6 +1273,16 @@
1261
1273
  Version:
1262
1274
  :sym: :version
1263
1275
  :type: :string
1276
+ ChefConfiguration:
1277
+ :sym: :chef_configuration
1278
+ :type: :hash
1279
+ :members:
1280
+ ManageBerkshelf:
1281
+ :sym: :manage_berkshelf
1282
+ :type: :boolean
1283
+ BerkshelfVersion:
1284
+ :sym: :berkshelf_version
1285
+ :type: :string
1264
1286
  UseCustomCookbooks:
1265
1287
  :sym: :use_custom_cookbooks
1266
1288
  :type: :boolean
@@ -1835,6 +1857,12 @@
1835
1857
  - :string
1836
1858
  Version:
1837
1859
  - :string
1860
+ ChefConfiguration:
1861
+ - :structure:
1862
+ ManageBerkshelf:
1863
+ - :boolean
1864
+ BerkshelfVersion:
1865
+ - :string
1838
1866
  UseCustomCookbooks:
1839
1867
  - :boolean
1840
1868
  CustomCookbooksSource:
@@ -175,7 +175,7 @@ module AWS
175
175
  #
176
176
  def ec2_instances
177
177
  instances = EC2::InstanceCollection.new(:config => config)
178
- instances.tagged('aws:autoscaling:groupName').tagged_values(name)
178
+ instances.filter('tag:aws:autoscaling:groupName', name)
179
179
  end
180
180
 
181
181
  # @return [Array<EC2::Subnet>]
@@ -12,6 +12,7 @@
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
14
  require 'set'
15
+ require 'securerandom'
15
16
 
16
17
  # AWS is the root module for all of the Amazon Web Services. It is also
17
18
  # where you can configure you access to AWS.
@@ -657,6 +658,7 @@ module AWS
657
658
  end
658
659
  end
659
660
  end
661
+ visited
660
662
  end
661
663
 
662
664
  # Patches Net::HTTP, fixing a bug in how it handles non 100-continue
@@ -699,3 +701,15 @@ module AWS
699
701
  end
700
702
 
701
703
  end
704
+
705
+ # Backport SecureRandom.uuid for Ruby 1.8
706
+ unless SecureRandom.respond_to?(:uuid)
707
+ module SecureRandom
708
+ def self.uuid
709
+ ary = random_bytes(16).unpack("NnnnnN")
710
+ ary[2] = (ary[2] & 0x0fff) | 0x4000
711
+ ary[3] = (ary[3] & 0x3fff) | 0x8000
712
+ "%08x-%04x-%04x-%04x-%04x%08x" % ary
713
+ end
714
+ end
715
+ end
@@ -546,6 +546,7 @@ module AWS
546
546
 
547
547
  http_request = new_request
548
548
  http_request.access_key_id = credential_provider.access_key_id
549
+ http_request.service = self.class.name.split('::')[1]
549
550
 
550
551
  # configure the http request
551
552
  http_request.service_ruby_name = service_ruby_name
@@ -698,7 +699,7 @@ module AWS
698
699
  @signer ||= begin
699
700
  signer_class = AWS::Core::Signers.const_get(version)
700
701
  signer_args = (version == :Version4) ?
701
- [credential_provider, service_signing_name, @region] :
702
+ [credential_provider, service_signing_name, req.region] :
702
703
  [credential_provider]
703
704
  signer_class.new(*signer_args)
704
705
  end
@@ -483,7 +483,7 @@ module AWS
483
483
  add_option :session_token
484
484
 
485
485
  add_option :region do |cfg,region|
486
- region || ENV['AWS_REGION'] || ENV['AMAZON_REGION'] || 'us-east-1'
486
+ region || ENV['AWS_REGION'] || ENV['AMAZON_REGION'] || ENV['AWS_DEFAULT_REGION'] || 'us-east-1'
487
487
  end
488
488
 
489
489
  add_option_with_needs :credential_provider,
@@ -37,14 +37,22 @@ module AWS
37
37
  # `:access_key_id` or the `:secret_access_key` can not be found.
38
38
  #
39
39
  def credentials
40
- @cached_credentials ||= begin
41
- creds = get_credentials
42
- unless creds[:access_key_id] and creds[:secret_access_key]
43
- raise Errors::MissingCredentialsError
40
+ raise Errors::MissingCredentialsError unless set?
41
+ @cached_credentials.dup
42
+ end
43
+
44
+ # @return [Boolean] Returns true if has credentials and it contains
45
+ # at least the `:access_key_id` and `:secret_access_key`.
46
+ #
47
+ def set?
48
+ @cache_mutex ||= Mutex.new
49
+ unless @cached_credentials
50
+ @cache_mutex.synchronize do
51
+ @cached_credentials ||= get_credentials
44
52
  end
45
- creds
46
53
  end
47
- @cached_credentials.dup
54
+ @cached_credentials[:access_key_id] &&
55
+ @cached_credentials[:secret_access_key]
48
56
  end
49
57
 
50
58
  # @return [String] Returns the AWS access key id.
@@ -108,6 +116,7 @@ module AWS
108
116
  @providers = []
109
117
  @providers << StaticProvider.new(static_credentials)
110
118
  @providers << ENVProvider.new('AWS')
119
+ @providers << ENVProvider.new('AWS', :access_key_id => 'ACCESS_KEY', :secret_access_key => 'SECRET_KEY', :session_token => 'SESSION_TOKEN')
111
120
  @providers << ENVProvider.new('AMAZON')
112
121
  @providers << EC2Provider.new
113
122
  end
@@ -117,14 +126,17 @@ module AWS
117
126
 
118
127
  def credentials
119
128
  providers.each do |provider|
120
- begin
129
+ if provider.set?
121
130
  return provider.credentials
122
- rescue Errors::MissingCredentialsError
123
131
  end
124
132
  end
125
133
  raise Errors::MissingCredentialsError
126
134
  end
127
135
 
136
+ def set?
137
+ providers.any?(&:set?)
138
+ end
139
+
128
140
  def refresh
129
141
  providers.each do |provider|
130
142
  provider.refresh
@@ -181,8 +193,9 @@ module AWS
181
193
  include Provider
182
194
 
183
195
  # @param [String] prefix The prefix to apply to the ENV variable.
184
- def initialize prefix
196
+ def initialize(prefix, suffixes=Hash[KEYS.map{|key| [key, key.to_s.upcase]}])
185
197
  @prefix = prefix
198
+ @suffixes = suffixes
186
199
  end
187
200
 
188
201
  # @return [String]
@@ -192,7 +205,7 @@ module AWS
192
205
  def get_credentials
193
206
  credentials = {}
194
207
  KEYS.each do |key|
195
- if value = ENV["#{@prefix}_#{key.to_s.upcase}"]
208
+ if value = ENV["#{@prefix}_#{@suffixes[key]}"]
196
209
  credentials[key] = value
197
210
  end
198
211
  end
@@ -287,8 +287,18 @@ module AWS
287
287
  args << endpoint.port
288
288
  args << proxy_uri.host
289
289
  args << proxy_uri.port
290
- args << proxy_uri.user
291
- args << proxy_uri.password
290
+
291
+ if proxy_uri.user
292
+ args << URI::decode(proxy_uri.user)
293
+ else
294
+ args << nil
295
+ end
296
+
297
+ if proxy_uri.password
298
+ args << URI::decode(proxy_uri.password)
299
+ else
300
+ args << nil
301
+ end
292
302
 
293
303
  http = Net::HTTP.new(*args.compact)
294
304
  http.extend(SessionExtensions)
@@ -54,6 +54,9 @@ module AWS
54
54
  # to be populated for requests against signature v4 endpoints.
55
55
  attr_accessor :region
56
56
 
57
+ # @api private
58
+ attr_accessor :service
59
+
57
60
  # @return [String] Returns the AWS access key ID used to authorize the
58
61
  # request.
59
62
  # @api private
@@ -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
@@ -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)
@@ -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
@@ -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
 
@@ -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
  #
@@ -257,6 +259,11 @@ module AWS
257
259
  options.delete(:availability_zone)
258
260
  end
259
261
 
262
+ if options[:placement_group]
263
+ placement[:group_name] = options[:placement_group].to_s
264
+ options.delete(:placement_group)
265
+ end
266
+
260
267
  if options[:dedicated_tenancy]
261
268
  placement[:tenancy] = 'dedicated'
262
269
  options.delete(:dedicated_tenancy)
@@ -291,7 +298,7 @@ module AWS
291
298
 
292
299
  security_group_opts(options)
293
300
 
294
- options[:client_token] = UUIDTools::UUID.timestamp_create.to_s
301
+ options[:client_token] = SecureRandom.uuid
295
302
 
296
303
  resp = client.run_instances(options)
297
304
 
@@ -310,7 +317,9 @@ module AWS
310
317
  response = filtered_request(:describe_instances)
311
318
  response.reservation_set.each do |reservation|
312
319
  reservation.instances_set.each do |i|
313
- 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)
314
323
  end
315
324
  end
316
325
  end
@@ -17,7 +17,7 @@ module AWS
17
17
  # Client class for Amazon ElastiCache.
18
18
  class Client < Core::QueryClient
19
19
 
20
- API_VERSION = '2013-06-15'
20
+ API_VERSION = '2014-03-24'
21
21
 
22
22
  signature_version :Version4, 'elasticache'
23
23
 
@@ -27,9 +27,12 @@ module AWS
27
27
  end
28
28
 
29
29
  class Client::V20130615 < Client
30
-
31
30
  define_client_methods('2013-06-15')
31
+ end
32
32
 
33
+ class Client::V20140324 < Client
34
+ define_client_methods('2014-03-24')
33
35
  end
36
+
34
37
  end
35
38
  end
@@ -69,7 +69,7 @@ module AWS
69
69
 
70
70
  # @return [ArchiveCollection]
71
71
  def archives
72
- ArchiveCollection.new(self)
72
+ ArchiveCollection.new(self, :account_id => account_id)
73
73
  end
74
74
 
75
75
  # @param [String,SNS::Topic] topic The SNS topic ARN string or an
@@ -20,6 +20,30 @@ module AWS
20
20
  #
21
21
  # You can use this class to get information about a certificate
22
22
  # and to delete it.
23
+ #
24
+ # @attr [String] The name that identifies the server certificate.
25
+ #
26
+ # @attr_reader [String] The stable and unique string identifying
27
+ # the server certificate.
28
+ #
29
+ # @attr_reader [Time] The date when the server certificate was
30
+ # uploaded.
31
+ #
32
+ # @attr_reader [String] The Amazon Resource Name (ARN)
33
+ # specifying the server certificate. For more information
34
+ # about ARNs and how to use them in policies, see
35
+ # {http://docs.amazonwebservices.com/IAM/latest/UserGuide/index.html?Using_Identifiers.html
36
+ # Identifiers for IAM Entities} in <i>Using AWS Identity and
37
+ # Access Management</i>.
38
+ #
39
+ # @attr [String] Path to the server certificate.
40
+ #
41
+ # @attr_reader [String] The contents of the public key
42
+ # certificate.
43
+ #
44
+ # @attr_reader [String] The contents of the public key
45
+ # certificate chain.
46
+ #
23
47
  class ServerCertificate < Resource
24
48
 
25
49
  prefix_update_attributes
@@ -30,27 +54,14 @@ module AWS
30
54
  super(opts)
31
55
  end
32
56
 
33
- # @attr [String] The name that identifies the server
34
- # certificate.
35
57
  mutable_attribute :name, :static => true, :from => :server_certificate_name
36
58
 
37
- # @attr_reader [String] The stable and unique string identifying
38
- # the server certificate.
39
59
  attribute :id, :static => true, :from => :server_certificate_id
40
60
 
41
- # @attr_reader [Time] The date when the server certificate was
42
- # uploaded.
43
61
  attribute :upload_date, :static => true
44
62
 
45
- # @attr_reader [String] The Amazon Resource Name (ARN)
46
- # specifying the server certificate. For more information
47
- # about ARNs and how to use them in policies, see
48
- # {http://docs.amazonwebservices.com/IAM/latest/UserGuide/index.html?Using_Identifiers.html
49
- # Identifiers for IAM Entities} in <i>Using AWS Identity and
50
- # Access Management</i>.
51
63
  attribute :arn
52
64
 
53
- # @attr [String] Path to the server certificate.
54
65
  mutable_attribute :path do
55
66
  translates_input do |path|
56
67
  path = "/#{path}" unless path[0] == ?/
@@ -59,12 +70,8 @@ module AWS
59
70
  end
60
71
  end
61
72
 
62
- # @attr_reader [String] The contents of the public key
63
- # certificate.
64
73
  attribute :certificate_body
65
74
 
66
- # @attr_reader [String] The contents of the public key
67
- # certificate chain.
68
75
  attribute :certificate_chain
69
76
 
70
77
  provider(:get_server_certificate) do |provider|