aws-sdk-v1 1.54.0 → 1.55.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99cc3c43b9f242437b98a559ad99666e50709b92
4
- data.tar.gz: 7cb63559555044a4732bbaf229ef8d120a378a66
3
+ metadata.gz: 00ae7ed02850c7e4e23ea26b1b1efe6c739a456d
4
+ data.tar.gz: e7394ac1815b813ea14c1c534dd6643c8aa12fbd
5
5
  SHA512:
6
- metadata.gz: e5b9feb784ae55d047041c70b6c054d6e03580207e065c1dbcb4009641f4fc0c27be58679b26de012434d4bed1a2156317aaf5dbc406d320c7176091db895274
7
- data.tar.gz: 2663ec4f188e14684f682344441727f16bb40209fbd0ce5d3cf94516e3e9bff287e890294deeff2a2bee737928d6f01002699d0abd05162266cf66bf6b3d937e
6
+ metadata.gz: e3848fee9c1e29345a3c3f1c3a2e66fd214cf6a7a9214fb3d0bfb75d713a8c97c40c1b03029bf9837669c307b976d8f998513a4eaa0ce45624d157bf437f4a93
7
+ data.tar.gz: 62c6aea9c28fb36a43814fb21619ed4594e8652a5ac0024e9c20206c4faf95ad93e769899878bcc8ad406a5672f9e90501f99c8624f76c7f590530200723f76f
data/README.md CHANGED
@@ -82,6 +82,14 @@ ec2.instances['i-12345678'].tags.to_h
82
82
 
83
83
  See the [API Documentation](http://docs.aws.amazon.com/AWSRubySDK/latest/frames.html) for more examples.
84
84
 
85
+ ## Testing
86
+
87
+ All HTTP requests to live services can be globally mocked (e.g. from within the `spec_helper.rb` file):
88
+
89
+ ```
90
+ AWS.stub!
91
+ ```
92
+
85
93
  ## Links of Interest
86
94
 
87
95
  * [API Documentation](http://docs.aws.amazon.com/AWSRubySDK/latest/frames.html)
data/bin/aws-rb CHANGED
@@ -104,7 +104,7 @@ options[:load_paths].each do |path|
104
104
  $LOAD_PATH.unshift(path)
105
105
  end
106
106
 
107
- require 'aws-sdk'
107
+ require 'aws-sdk-v1'
108
108
 
109
109
  # configure the aws-sdk gem
110
110
 
@@ -678,7 +678,7 @@ module AWS
678
678
  versions = {}
679
679
  pattern = File.join(File.dirname(__FILE__), 'api_config', '*.yml')
680
680
  Dir.glob(pattern).each do |path|
681
- matches = path.match(/(\w+)-(\d{4}-\d{2}-\d{2})/)
681
+ path.match(/(\w+)-(\d{4}-\d{2}-\d{2})/)
682
682
  svc = SERVICES[$1].full_name
683
683
  versions[svc] ||= []
684
684
  versions[svc] << $2
@@ -354,6 +354,8 @@ module AWS
354
354
  # @param [Hash] options
355
355
  # @option options [String] :ip_address ('169.254.169.254')
356
356
  # @option options [Integer] :port (80)
357
+ # @option options [Integer] :retries (0) Number of times to
358
+ # retry retrieving credentials.
357
359
  # @option options [Float] :http_open_timeout (1)
358
360
  # @option options [Float] :http_read_timeout (1)
359
361
  # @option options [Object] :http_debug_output (nil) HTTP wire
@@ -362,6 +364,7 @@ module AWS
362
364
  def initialize options = {}
363
365
  @ip_address = options[:ip_address] || '169.254.169.254'
364
366
  @port = options[:port] || 80
367
+ @retries = options[:retries] || 0
365
368
  @http_open_timeout = options[:http_open_timeout] || 1
366
369
  @http_read_timeout = options[:http_read_timeout] || 1
367
370
  @http_debug_output = options[:http_debug_output]
@@ -373,6 +376,9 @@ module AWS
373
376
  # @return [Integer] Defaults to port 80.
374
377
  attr_accessor :port
375
378
 
379
+ # @return [Integer] Defaults to 0
380
+ attr_accessor :retries
381
+
376
382
  # @return [Float]
377
383
  attr_accessor :http_open_timeout
378
384
 
@@ -404,6 +410,8 @@ module AWS
404
410
 
405
411
  # (see Provider#get_credentials)
406
412
  def get_credentials
413
+ retries_left = retries
414
+
407
415
  begin
408
416
 
409
417
  http = Net::HTTP.new(ip_address, port, nil)
@@ -432,7 +440,15 @@ module AWS
432
440
  credentials
433
441
 
434
442
  rescue *FAILURES => e
435
- {}
443
+ if retries_left > 0
444
+ sleep_time = 2 ** (retries - retries_left)
445
+ Kernel.sleep(sleep_time)
446
+
447
+ retries_left -= 1
448
+ retry
449
+ else
450
+ {}
451
+ end
436
452
  end
437
453
  end
438
454
 
@@ -566,7 +582,7 @@ module AWS
566
582
 
567
583
  include Provider
568
584
 
569
- # @option options [AWS::STS] :sts (STS.new) An instance of {AWS::STS}.
585
+ # @option options [AWS::STS] :sts (STS.new) An instance of {AWS::STS}.
570
586
  # This is used to make the API call to assume role.
571
587
  # @option options [required, String] :role_arn
572
588
  # @option options [required, String] :role_session_name
@@ -241,6 +241,11 @@ module AWS
241
241
  end
242
242
  alias_method :is_a?, :kind_of?
243
243
 
244
+ # @api private
245
+ def empty?
246
+ @data.empty?
247
+ end
248
+
244
249
  end
245
250
  end
246
251
  end
@@ -19,7 +19,7 @@ module AWS
19
19
 
20
20
  # @api private
21
21
  class CurbHandler
22
-
22
+ class NetworkError < StandardError; end
23
23
  def initialize
24
24
  @q = []
25
25
  @sem = Mutex.new
@@ -133,6 +133,9 @@ module AWS
133
133
 
134
134
  curl.on_complete do
135
135
  response.status = curl.response_code
136
+ unless curl.response_code > 0
137
+ response.network_error = NetworkError.new('Empty response. Assume network error.')
138
+ end
136
139
  unless read_block
137
140
  response.body = buffer.join("")
138
141
  end
@@ -231,7 +231,8 @@ 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
+ milliseconds = parts.pop
235
+ parts[-1] = parts[-1] + "0.#{milliseconds}".to_f
235
236
  klass.send(parts_constructor, *parts)
236
237
  else
237
238
  # fallback in case we have to handle another date format
@@ -105,6 +105,7 @@ module AWS
105
105
  # * `:volume_type` - (String) Valid values include:
106
106
  # * `standard`
107
107
  # * `io1`
108
+ # * `gp2`
108
109
  # * `:iops` - (Integer)
109
110
  # * `:no_device` - (String) Specifies the device name to suppress
110
111
  # during instance launch.
@@ -104,7 +104,7 @@ module AWS
104
104
 
105
105
  path = Pathname.new("#{rails_root}/config/aws.yml")
106
106
 
107
- if File.exists?(path)
107
+ if File.exist?(path)
108
108
  cfg = YAML::load(ERB.new(File.read(path)).result)
109
109
  unless cfg[rails_env]
110
110
  raise "config/aws.yml is missing a section for `#{rails_env}`"
@@ -128,6 +128,7 @@ module AWS
128
128
  q[:resource_record_set][:ttl] = @change_options[:ttl] if @change_options[:ttl]
129
129
  q[:resource_record_set][:resource_records] = @change_options[:resource_records] if @change_options[:resource_records]
130
130
  q[:resource_record_set][:alias_target] = @change_options[:alias_target] if @change_options[:alias_target]
131
+ q[:resource_record_set][:geo_location] = @change_options[:geo_location] if @change_options[:geo_location]
131
132
  q[:resource_record_set][:failover] = @change_options[:failover] if @change_options[:failover]
132
133
  q[:resource_record_set][:health_check_id] = @change_options[:health_check_id] if @change_options[:health_check_id]
133
134
  q
@@ -119,6 +119,12 @@ module AWS
119
119
  @create_options[:ttl] = new_ttl
120
120
  end
121
121
 
122
+ attribute :geo_location
123
+
124
+ def geo_location= new_geo_location
125
+ @create_options[:geo_location] = new_geo_location
126
+ end
127
+
122
128
  attribute :failover
123
129
 
124
130
  def failover= new_failover
@@ -241,6 +247,7 @@ module AWS
241
247
  options[:region] = region if region
242
248
  options[:ttl] = ttl if ttl
243
249
  options[:resource_records] = resource_records if resource_records && !resource_records.empty?
250
+ options[:geo_location] = geo_location if geo_location
244
251
  options[:failover] = failover if failover
245
252
  options[:health_check_id] = health_check_id if health_check_id
246
253
  end
@@ -238,11 +238,12 @@ module AWS
238
238
 
239
239
  # Returns the url for this bucket.
240
240
  # @return [String] url to the bucket
241
- def url
241
+ def url(options = {})
242
+ protocol = options.fetch(:secure, false) ? "https://" : "http://"
242
243
  if client.dns_compatible_bucket_name?(name)
243
- "http://#{name}.s3.amazonaws.com/"
244
+ "#{protocol}#{name}.s3.amazonaws.com/"
244
245
  else
245
- "http://s3.amazonaws.com/#{name}/"
246
+ "#{protocol}s3.amazonaws.com/#{name}/"
246
247
  end
247
248
  end
248
249
 
@@ -51,10 +51,7 @@ module AWS
51
51
  # @param [Core::Http::Request] request
52
52
  # @api private
53
53
  def sign_request request
54
- version = @config.s3_signature_version ?
55
- @config.s3_signature_version.to_sym :
56
- (@region =~ /cn-/ ? :v4 : :v3)
57
- case version
54
+ case @config.s3_signature_version
58
55
  when :v4 then v4_signer.sign_request(request)
59
56
  when :v3 then v3_signer.sign_request(request)
60
57
  else
@@ -36,14 +36,25 @@ AWS::Core::Configuration.module_eval do
36
36
  add_option :s3_cache_object_attributes, false, :boolean => true
37
37
 
38
38
  add_option :s3_signature_version do |config, value|
39
- if config.s3_region.match(/^cn-/)
40
- :v4
41
- elsif value
39
+ v3_regions = %w(
40
+ us-east-1
41
+ us-west-1
42
+ us-west-2
43
+ ap-northeast-1
44
+ ap-southeast-1
45
+ ap-southeast-2
46
+ sa-east-1
47
+ eu-west-1
48
+ us-gov-west-1
49
+ )
50
+ if value
42
51
  value
43
52
  elsif config.s3 && config.s3[:signature_version]
44
53
  config.s3[:signature_version]
45
- else
54
+ elsif v3_regions.include?(config.s3_region)
46
55
  :v3
56
+ else
57
+ :v4
47
58
  end
48
59
  end
49
60
 
@@ -55,7 +55,7 @@ module AWS
55
55
  signed_headers = 'Host'
56
56
 
57
57
  if options[:acl]
58
- request.add_param("X-Amz-Acl", options[:acl].to_s.gsub(/_/, '-'))
58
+ request.add_param("x-amz-acl", options[:acl].to_s.gsub(/_/, '-'))
59
59
  end
60
60
 
61
61
  # must be sent along with the PUT request headers
@@ -805,9 +805,9 @@ module AWS
805
805
  #
806
806
  # @param [Hash] options
807
807
  #
808
- # @option options [String] :bucket_name The name of the bucket
809
- # the source object can be found in. Defaults to the current
810
- # object's bucket.
808
+ # @option options [String] :bucket_name The slash-prefixed name of
809
+ # the bucket the source object can be found in. Defaults to the
810
+ # current object's bucket.
811
811
  #
812
812
  # @option options [Bucket] :bucket The bucket the source object
813
813
  # can be found in. Defaults to the current object's bucket.
@@ -873,17 +873,20 @@ module AWS
873
873
  options[:copy_source] =
874
874
  case source
875
875
  when S3Object
876
- "#{source.bucket.name}/#{source.key}"
876
+ "/#{source.bucket.name}/#{source.key}"
877
877
  when ObjectVersion
878
878
  options[:version_id] = source.version_id
879
- "#{source.object.bucket.name}/#{source.object.key}"
879
+ "/#{source.object.bucket.name}/#{source.object.key}"
880
880
  else
881
881
  if options[:bucket]
882
- "#{options.delete(:bucket).name}/#{source}"
882
+ "/#{options.delete(:bucket).name}/#{source}"
883
883
  elsif options[:bucket_name]
884
+ # oops, this should be slash-prefixed, but unable to change
885
+ # this without breaking users that already work-around this
886
+ # bug by sending :bucket_name => "/bucket-name"
884
887
  "#{options.delete(:bucket_name)}/#{source}"
885
888
  else
886
- "#{self.bucket.name}/#{source}"
889
+ "/#{self.bucket.name}/#{source}"
887
890
  end
888
891
  end
889
892
 
@@ -936,9 +939,9 @@ module AWS
936
939
  #
937
940
  # @param [Hash] options
938
941
  #
939
- # @option options [String] :bucket_name The name of the bucket
940
- # the object should be copied into. Defaults to the current object's
941
- # bucket.
942
+ # @option options [String] :bucket_name The slash-prefixed name of the
943
+ # bucket the object should be copied into. Defaults to the current
944
+ # object's bucket.
942
945
  #
943
946
  # @option options [Bucket] :bucket The bucket the target object
944
947
  # should be copied into. Defaults to the current object's bucket.
@@ -13,5 +13,5 @@
13
13
 
14
14
  module AWS
15
15
  # Current version of the AWS SDK for Ruby
16
- VERSION = '1.54.0'
16
+ VERSION = '1.55.0'
17
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.54.0
4
+ version: 1.55.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-25 00:00:00.000000000 Z
11
+ date: 2014-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri