aws-sdk 1.9.2 → 1.9.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,7 +35,7 @@ module AWS
35
35
  # :access_key_id => 'YOUR_ACCESS_KEY_ID',
36
36
  # :secret_access_key => 'YOUR_SECRET_ACCESS_KEY')
37
37
  #
38
- # Or you can set them directly on the AWS::Route53 interface:
38
+ # Or you can set them directly on the AWS::CloudWatch interface:
39
39
  #
40
40
  # cw = AWS::CloudWatch.new(
41
41
  # :access_key_id => 'YOUR_ACCESS_KEY_ID',
@@ -708,5 +708,30 @@ module AWS
708
708
  nil
709
709
  end
710
710
 
711
+ # @api private
712
+ # @return [Hash]
713
+ def api_versions
714
+ @versions ||= begin
715
+ # get a list of support services/apis from disk
716
+ versions = {}
717
+ pattern = File.join(File.dirname(__FILE__), 'api_config', '*.yml')
718
+ Dir.glob(pattern).each do |path|
719
+ matches = path.match(/(\w+)-(\d{4}-\d{2}-\d{2})/)
720
+ svc = SERVICES[$1][:full_name]
721
+ versions[svc] ||= []
722
+ versions[svc] << $2
723
+ end
724
+
725
+ # s3 does not have an API configuration, so we have to add it manually
726
+ versions[SERVICES['S3'][:full_name]] = ['2006-03-01']
727
+
728
+ # sort the services alphabetically
729
+ versions.keys.sort_by(&:downcase).inject({}) do |hash,svc|
730
+ hash[svc] = versions[svc]
731
+ hash
732
+ end
733
+ end
734
+ end
735
+
711
736
  end
712
737
  end
@@ -473,7 +473,9 @@ module AWS
473
473
  client = self
474
474
 
475
475
  response = new_response do
476
- client.send(:build_request, name, options)
476
+ req = client.send(:build_request, name, options)
477
+ req.add_authorization!(credential_provider)
478
+ req
477
479
  end
478
480
 
479
481
  response.request_type = name
@@ -533,7 +535,6 @@ module AWS
533
535
 
534
536
  # configure the http request
535
537
  http_request.service_ruby_name = service_ruby_name
536
- http_request.default_read_timeout = @config.http_read_timeout
537
538
  http_request.host = endpoint
538
539
  http_request.port = port
539
540
  http_request.region = config.send(:"#{service_ruby_name}_region")
@@ -554,8 +555,6 @@ module AWS
554
555
  http_request.continue_timeout = nil
555
556
  end
556
557
 
557
- http_request.add_authorization!(credential_provider)
558
-
559
558
  http_request
560
559
 
561
560
  end
@@ -21,21 +21,18 @@ module AWS
21
21
  # and parses the actual response.
22
22
  class Request
23
23
 
24
+ extend Deprecations
25
+
24
26
  # Returns a new empty http request object.
25
27
  def initialize
26
- @default_read_timeout = 60
27
28
  @http_method = 'POST'
28
29
  @use_ssl = true
29
30
  @headers = CaseInsensitiveHash.new
30
31
  @uri = '/'
31
32
  @params = []
33
+ @read_timeout = 60
32
34
  end
33
35
 
34
- # @return [Integer] The number of seconds the service has to respond
35
- # before a timeout error is raised on the request. Defaults to
36
- # 60 seconds.
37
- attr_accessor :default_read_timeout
38
-
39
36
  # @return [String] hostname of the request
40
37
  attr_accessor :host
41
38
 
@@ -75,10 +72,12 @@ module AWS
75
72
  attr_accessor :service_ruby_name
76
73
 
77
74
  # @return [Integer] The number of seconds the service has to respond
78
- # before a timeout error is raised on the request. Defaults to
79
- # 60 seconds.
75
+ # before a timeout error is raised on the request.
80
76
  attr_accessor :read_timeout
81
77
 
78
+ alias_method :default_read_timeout, :read_timeout
79
+ deprecated :default_read_timeout, :use => :read_timeout
80
+
82
81
  # @return [Boolean] Returns `true` if this request should be made
83
82
  # with SSL enabled.
84
83
  attr_accessor :use_ssl
@@ -105,14 +104,6 @@ module AWS
105
104
  @port || (use_ssl? ? 443 : 80)
106
105
  end
107
106
 
108
- # Some subclasses override this method to obseve requirements
109
- # set by the services (e.q. SimpleWorlfow and SQS have special
110
- # long-pulling requirements and require special read timeouts).
111
- # @api private
112
- def read_timeout
113
- default_read_timeout
114
- end
115
-
116
107
  # @return [String] Returns the HTTP request path.
117
108
  def path
118
109
  uri.split(/\?/)[0]
@@ -280,6 +280,14 @@ module AWS
280
280
 
281
281
  define_client_methods('2012-06-01')
282
282
 
283
+ private
284
+
285
+ def build_request *args
286
+ request = super(*args)
287
+ request.headers['x-amz-glacier-version'] = API_VERSION
288
+ request
289
+ end
290
+
283
291
  end
284
292
  end
285
293
  end
@@ -19,11 +19,6 @@ module AWS
19
19
 
20
20
  include Core::Signature::Version4
21
21
 
22
- def initialize
23
- super
24
- self.headers['x-amz-glacier-version'] = Glacier::Client::API_VERSION
25
- end
26
-
27
22
  def service
28
23
  'glacier'
29
24
  end
@@ -24,7 +24,6 @@ module AWS
24
24
  autoload :Conversion, 'aws/record/conversion'
25
25
  autoload :DirtyTracking, 'aws/record/dirty_tracking'
26
26
  autoload :Errors, 'aws/record/errors'
27
- autoload :Exceptions, 'aws/record/exceptions'
28
27
  autoload :HashModel, 'aws/record/hash_model'
29
28
  autoload :Model, 'aws/record/model'
30
29
  autoload :Naming, 'aws/record/naming'
@@ -32,6 +31,7 @@ module AWS
32
31
  autoload :Validations, 'aws/record/validations'
33
32
 
34
33
  # errors
34
+ autoload :RecordNotFound, 'aws/record/exceptions'
35
35
  autoload :InvalidRecordError, 'aws/record/exceptions'
36
36
  autoload :EmptyRecordError, 'aws/record/exceptions'
37
37
  autoload :UndefinedAttributeError, 'aws/record/exceptions'
@@ -50,9 +50,6 @@ module AWS
50
50
  autoload :PresenceValidator, 'aws/record/validators/presence'
51
51
  autoload :Validator, 'aws/record/validator'
52
52
 
53
- # @api private
54
- class RecordNotFound < StandardError; end
55
-
56
53
  # Sets a prefix to be applied to all SimpleDB domains associated with
57
54
  # AWS::Record::Base classes.
58
55
  #
@@ -14,6 +14,9 @@
14
14
  module AWS
15
15
  module Record
16
16
 
17
+ # @api private
18
+ class RecordNotFound < StandardError; end
19
+
17
20
  # Raised when trying to access an attribute that does not exist.
18
21
  # @api private
19
22
  class UndefinedAttributeError < StandardError
@@ -54,7 +54,7 @@ module AWS
54
54
  end
55
55
  if options[:comment]
56
56
  options[:hosted_zone_config] ||= {}
57
- options[:hosted_zone_config][:comment] = options[:comment]
57
+ options[:hosted_zone_config][:comment] = options.delete(:comment)
58
58
  end
59
59
 
60
60
  resp = client.create_hosted_zone(options)
@@ -1247,6 +1247,14 @@ module AWS
1247
1247
  end
1248
1248
  end
1249
1249
 
1250
+ def build_request *args
1251
+ request = super(*args)
1252
+ if request.headers['x-amz-target'] =~ /PollFor(Decision|Activity)Task/
1253
+ request.read_timeout = 90
1254
+ end
1255
+ request
1256
+ end
1257
+
1250
1258
  end
1251
1259
  end
1252
1260
  end
@@ -19,15 +19,6 @@ module AWS
19
19
 
20
20
  include Core::Signature::Version3
21
21
 
22
- def read_timeout
23
- # increase read timeout for long polling
24
- if headers['x-amz-target'] =~ /PollFor(Decision|Activity)Task/
25
- 90
26
- else
27
- @read_timeout
28
- end
29
- end
30
-
31
22
  end
32
23
  end
33
24
  end
@@ -253,6 +253,21 @@ module AWS
253
253
 
254
254
  define_client_methods('2012-11-05')
255
255
 
256
+ private
257
+
258
+ def build_request *args
259
+ request = super(*args)
260
+ if url_param = request.params.find { |p| p.name == "QueueUrl" }
261
+ url = URI.parse(url_param.value)
262
+ request.host = url.host
263
+ request.uri = url.request_uri
264
+ if matches = request.host.match(/^sqs\.(.+?)\./)
265
+ request.region = matches[1]
266
+ end
267
+ end
268
+ request
269
+ end
270
+
256
271
  end
257
272
  end
258
273
  end
@@ -25,42 +25,6 @@ module AWS
25
25
  'sqs'
26
26
  end
27
27
 
28
- def path
29
- full_url.path
30
- end
31
-
32
- def host
33
- full_url.host
34
- end
35
-
36
- def uri
37
- path
38
- end
39
-
40
- def region
41
- # sigv4 requires the region name when signing, this should come from
42
- # the QueueUrl param whenever present
43
- if
44
- param = params.find{|p| p.name == 'QueueUrl' } and
45
- host = URI.parse(param.value).host and
46
- matches = host.match(/^sqs\.(.+?)\./)
47
- then
48
- return matches[1]
49
- else
50
- super
51
- end
52
- end
53
-
54
- private
55
-
56
- def full_url
57
- if url_param = params.find { |p| p.name == "QueueUrl" }
58
- URI.parse(url_param.value)
59
- else
60
- URI::HTTP.build(:host => @host, :path => '/')
61
- end
62
- end
63
-
64
28
  end
65
29
 
66
30
  end
@@ -13,5 +13,5 @@
13
13
 
14
14
  module AWS
15
15
  # Current version of the AWS SDK for Ruby
16
- VERSION = '1.9.2'
16
+ VERSION = '1.9.3'
17
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.2
4
+ version: 1.9.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-24 00:00:00.000000000 Z
12
+ date: 2013-04-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: uuidtools