aws-sdk 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/aws/base_client.rb +8 -8
- data/lib/aws/common.rb +79 -49
- data/lib/aws/configuration.rb +232 -199
- data/lib/aws/default_signer.rb +5 -3
- data/lib/aws/iam.rb +1 -1
- data/lib/aws/s3/presigned_post.rb +2 -1
- data/lib/aws/uri_escape.rb +5 -1
- metadata +50 -83
- data/lib/aws/configurable.rb +0 -36
data/lib/aws/base_client.rb
CHANGED
@@ -16,7 +16,6 @@ require 'aws/inflection'
|
|
16
16
|
require 'aws/naming'
|
17
17
|
require 'aws/response'
|
18
18
|
require 'aws/async_handle'
|
19
|
-
require 'aws/configurable'
|
20
19
|
require 'aws/http/handler'
|
21
20
|
require 'aws/http/request'
|
22
21
|
require 'aws/http/response'
|
@@ -32,7 +31,6 @@ module AWS
|
|
32
31
|
# @private
|
33
32
|
class BaseClient
|
34
33
|
|
35
|
-
include Configurable
|
36
34
|
include ClientLogging
|
37
35
|
|
38
36
|
extend Naming
|
@@ -281,6 +279,7 @@ module AWS
|
|
281
279
|
code = nil
|
282
280
|
code = xml_error_grammar.parse(response.http_response.body).code if
|
283
281
|
xml_error_response?(response)
|
282
|
+
|
284
283
|
|
285
284
|
case
|
286
285
|
when response.timeout?
|
@@ -306,7 +305,6 @@ module AWS
|
|
306
305
|
response.http_response.status >= 300 and
|
307
306
|
response.http_response.body and
|
308
307
|
xml_error_grammar.parse(response.http_response.body).respond_to?(:code)
|
309
|
-
|
310
308
|
end
|
311
309
|
|
312
310
|
protected
|
@@ -433,15 +431,17 @@ module AWS
|
|
433
431
|
|
434
432
|
end
|
435
433
|
|
436
|
-
|
437
|
-
|
438
|
-
MetaUtils.extend_method(self, :configure_client) do
|
434
|
+
protected
|
435
|
+
def self.configure_client
|
439
436
|
|
440
437
|
module_eval('module Options; end')
|
441
438
|
module_eval('module XML; end')
|
442
439
|
|
443
|
-
|
444
|
-
|
440
|
+
name = :"#{service_ruby_name}_client"
|
441
|
+
needs = [:signer, :http_handler]
|
442
|
+
create_block = lambda {|config| new(:config => config) }
|
443
|
+
|
444
|
+
Configuration.add_option_with_needs(name, needs, &create_block)
|
445
445
|
|
446
446
|
end
|
447
447
|
|
data/lib/aws/common.rb
CHANGED
@@ -19,7 +19,7 @@ require 'aws/response_cache'
|
|
19
19
|
module AWS
|
20
20
|
|
21
21
|
# Current version of the AWS SDK for Ruby
|
22
|
-
VERSION = "1.1.
|
22
|
+
VERSION = "1.1.1"
|
23
23
|
|
24
24
|
class << self
|
25
25
|
|
@@ -51,72 +51,102 @@ module AWS
|
|
51
51
|
#
|
52
52
|
# @note Changing the global configuration does not affect objects
|
53
53
|
# that have already been constructed.
|
54
|
+
#
|
54
55
|
# @param [Hash] options
|
55
|
-
# @option options [String] :access_key_id
|
56
|
-
#
|
57
|
-
# @option options [String] :
|
58
|
-
#
|
56
|
+
# @option options [String] :access_key_id (nil) AWS access key id
|
57
|
+
# credential.
|
58
|
+
# @option options [String] :ec2_endpoint ('ec2.amazonaws.com') The
|
59
|
+
# service endpoint for Amazon EC2.
|
60
|
+
# @option options [Object] :http_handler (AWS::HTTPartyHandler) The
|
61
|
+
# http handler that sends requests to AWS.
|
62
|
+
# @option options [String] :iam_endpoint ('iam.amazonaws.com') The
|
63
|
+
# service endpoint for AWS Idenity Access Management (IAM).
|
64
|
+
# @option options [Object,nil] :logger (nil) A logger instance that
|
65
|
+
# should receive log messages generated by service requets.
|
66
|
+
# A logger needs to respond to #log and must accept a
|
67
|
+
# severity (e.g. :info, :error, etc) and a string message.
|
59
68
|
# @option options [Integer] :max_retries (3) The maximum number of times
|
60
69
|
# service errors (500) should be retried. There is an exponential
|
61
70
|
# backoff in between service request retries, so the more retries the
|
62
71
|
# longer it can take to fail.
|
63
|
-
# @option options [String] :ec2_endpoint ('ec2.amazonaws.com') The
|
64
|
-
# service endpoint to use when communicating with Amazon EC2.
|
65
|
-
# @option options :http_handler The request/response handler
|
66
|
-
# for all service requests. The default handler uses HTTParty to
|
67
|
-
# send requests.
|
68
|
-
# @option options :logger (nil) A logger instance that should receive log
|
69
|
-
# messages generated by service requets. A logger needs to respond to
|
70
|
-
# #log and must accept a severity (e.g. :info, :error, etc) and
|
71
|
-
# a string message.
|
72
72
|
# @option options [String, URI, nil] :proxy_uri (nil) The URI of the proxy
|
73
73
|
# to send service requests through. You can pass a URI object or a
|
74
74
|
# URI string:
|
75
75
|
#
|
76
76
|
# AWS.config(:proxy_uri => 'https://user:password@my.proxy:443/path?query')
|
77
|
-
#
|
78
|
-
# @option options [String] :s3_endpoint ('s3.amazonaws.com') The
|
79
|
-
# service endpoint
|
80
|
-
#
|
81
|
-
#
|
77
|
+
#
|
78
|
+
# @option options [String] :s3_endpoint ('s3.amazonaws.com') The
|
79
|
+
# service endpoint for Amazon S3.
|
80
|
+
#
|
81
|
+
# @option options [Integer] :s3_multipart_max_parts (1000) The maximum
|
82
|
+
# number of parts to split a file into when uploading in parts to S3.
|
83
|
+
#
|
84
|
+
# @option options [Integer] :s3_multipart_threshold (16777216) When
|
85
|
+
# uploading data to S3, if the number of bytes to send exceedes
|
82
86
|
# +:s3_multipart_threshold+ then a multi part session is automatically
|
83
87
|
# started and the data is sent up in chunks. The size of each part
|
84
|
-
# is specified by +:s3_multipart_min_part_size+.
|
85
|
-
#
|
86
|
-
#
|
87
|
-
# @option options [
|
88
|
-
#
|
88
|
+
# is specified by +:s3_multipart_min_part_size+. Defaults to
|
89
|
+
# 16777216 (16MB).
|
90
|
+
#
|
91
|
+
# @option options [Integer] :s3_multipart_min_part_size (5242880) The
|
92
|
+
# absolute minimum size (in bytes) each S3 multipart segment should be.
|
93
|
+
# Defaults to 5242880 (5MB).
|
94
|
+
#
|
95
|
+
# @option options [String] :secret_access_key (nil) AWS secret access
|
96
|
+
# key credential.
|
97
|
+
#
|
98
|
+
# @option options [String,nil] :session_token (nil) AWS secret token
|
99
|
+
# credential.
|
100
|
+
#
|
89
101
|
# @option options [String] :simple_db_endpoint ('sdb.amazonaws.com') The
|
90
|
-
# service endpoint
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
# @option options [String] :
|
97
|
-
# The service endpoint
|
98
|
-
#
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
102
|
-
#
|
103
|
-
#
|
104
|
-
#
|
105
|
-
#
|
106
|
-
#
|
107
|
-
#
|
108
|
-
#
|
102
|
+
# service endpoint for Amazon SimpleDB.
|
103
|
+
#
|
104
|
+
# @option options [Boolean] :simple_db_consistent_reads (false) Determines
|
105
|
+
# if all SimpleDB read requests should be done consistently.
|
106
|
+
# Consistent reads are slower, but reflect all changes to SDB.
|
107
|
+
#
|
108
|
+
# @option options [String] :simple_email_service_endpoint ('email.us-east-1.amazonaws.com')
|
109
|
+
# The service endpoint for Amazon Simple Email Service.
|
110
|
+
#
|
111
|
+
# @option options [Object] :signer (AWS::DefaultSigner) The request signer. Defaults to
|
112
|
+
# a default request signer implementation.
|
113
|
+
#
|
114
|
+
# @option options [String] :ssl_ca_file The path to a CA cert bundle in
|
115
|
+
# PEM format.
|
116
|
+
#
|
117
|
+
# If +:ssl_verify_peer+ is +true+ (the default) this bundle will be
|
118
|
+
# used to validate the server certificate in each HTTPS request.
|
119
|
+
# The AWS SDK for Ruby ships with a CA cert bundle, which is the
|
120
|
+
# default value for this option.
|
121
|
+
#
|
122
|
+
# @option options [Boolean] :ssl_verify_peer (true) When +true+
|
123
|
+
# the HTTP handler validate server certificates for HTTPS requests.
|
124
|
+
#
|
125
|
+
# This option should only be disabled for diagnostic purposes;
|
126
|
+
# leaving this option set to +false+ exposes your application to
|
109
127
|
# man-in-the-middle attacks and can pose a serious security
|
110
128
|
# risk.
|
111
|
-
#
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
#
|
129
|
+
#
|
130
|
+
# @option options[Boolean] :stub_requests (false) When +true+ requests
|
131
|
+
# are not sent to AWS, instead empty reponses are generated and
|
132
|
+
# returned to each service request.
|
133
|
+
#
|
134
|
+
# @option options [String] :sns_endpoint ('sns.us-east-1.amazonaws.com') The
|
135
|
+
# service endpoint for Amazon SNS.
|
136
|
+
#
|
137
|
+
# @option options [String] :sqs_endpoint ('sqs.us-east-1.amazonaws.com') The
|
138
|
+
# service endpoint for Amazon SQS.
|
139
|
+
#
|
140
|
+
# @option options [String] :sts_endpoint ('sts.amazonaws.com') The
|
141
|
+
# service endpoint for AWS Security Token Service.
|
142
|
+
#
|
143
|
+
# @option options [Boolean] :use_ssl (true) When +true+, all requests
|
144
|
+
# to AWS are sent using HTTPS instead vanilla HTTP.
|
145
|
+
#
|
117
146
|
# @option options [String] :user_agent_prefix (nil) A string prefix to
|
118
147
|
# append to all requets against AWS services. This should be set
|
119
148
|
# for clients and applications built ontop of the aws-sdk gem.
|
149
|
+
#
|
120
150
|
# @return [Configuration] Returns the new configuration.
|
121
151
|
def config options = {}
|
122
152
|
@@config ||= Configuration.new
|
data/lib/aws/configuration.rb
CHANGED
@@ -56,6 +56,114 @@ module AWS
|
|
56
56
|
#
|
57
57
|
# The global default configuration can be found at {AWS.config}
|
58
58
|
#
|
59
|
+
# @attr_reader [String,nil] access_key_id AWS access key id credential.
|
60
|
+
# Defaults to +nil+.
|
61
|
+
#
|
62
|
+
# @attr_reader [String] ec2_endpoint The service endpoint for Amazon EC2.
|
63
|
+
# Defaults to 'ec2.amazonaws.com'.
|
64
|
+
#
|
65
|
+
# @attr_reader [Object] http_handler The http handler that sends requests
|
66
|
+
# to AWS. Defaults to an {AWS::HTTPartyHandler}.
|
67
|
+
#
|
68
|
+
# @attr_reader [String] iam_endpoint The service endpoint for AWS Idenity
|
69
|
+
# Access Management (IAM). Defaults to 'iam.amazonaws.com'.
|
70
|
+
#
|
71
|
+
# @attr_reader [Object,nil] logger A logger instance that
|
72
|
+
# should receive log messages generated by service requets.
|
73
|
+
# A logger needs to respond to #log and must accept a
|
74
|
+
# severity (e.g. :info, :error, etc) and a string message.
|
75
|
+
# Defaults to +nil+.
|
76
|
+
#
|
77
|
+
# @attr_reader [Integer] max_retries The maximum number of times
|
78
|
+
# service errors (500) should be retried. There is an exponential
|
79
|
+
# backoff in between service request retries, so the more retries the
|
80
|
+
# longer it can take to fail. Defautls to 3.
|
81
|
+
#
|
82
|
+
# @attr_reader [String, URI, nil] proxy_uri The URI of the proxy
|
83
|
+
# to send service requests through. You can pass a URI object or a
|
84
|
+
# URI string. Defautls to +nil+.
|
85
|
+
#
|
86
|
+
# AWS.config(:proxy_uri => 'https://user:password@my.proxy:443/path?query')
|
87
|
+
#
|
88
|
+
#
|
89
|
+
# @attr_reader [String] s3_endpoint The service endpoint for Amazon S3.
|
90
|
+
# Defaults to 's3.amazonaws.com'.
|
91
|
+
#
|
92
|
+
# @attr_reader [Integer] s3_multipart_max_parts The maximum number of
|
93
|
+
# parts to split a file into when uploading in parts to S3.
|
94
|
+
# Defaults to 1000.
|
95
|
+
#
|
96
|
+
# @attr_reader [Integer] s3_multipart_threshold (16777216) When uploading
|
97
|
+
# data to S3, if the number of bytes to send exceedes
|
98
|
+
# +:s3_multipart_threshold+ then a multi part session is automatically
|
99
|
+
# started and the data is sent up in chunks. The size of each part
|
100
|
+
# is specified by +:s3_multipart_min_part_size+. Defaults to
|
101
|
+
# 16777216 (16MB).
|
102
|
+
#
|
103
|
+
# @attr_reader [Integer] s3_multipart_min_part_size The absolute minimum
|
104
|
+
# size (in bytes) each S3 multipart segment should be.
|
105
|
+
# Defaults to 5242880 (5MB).
|
106
|
+
#
|
107
|
+
# @attr_reader [String,nil] secret_access_key AWS secret access key
|
108
|
+
# credential. Defaults to +nil+.
|
109
|
+
#
|
110
|
+
# @attr_reader [String,nil] session_token AWS secret token credential.
|
111
|
+
# Defaults to +nil+.
|
112
|
+
#
|
113
|
+
# @attr_reader [String] simple_db_endpoint The service endpoint for Amazon
|
114
|
+
# SimpleDB. Defaults to 'sdb.amazonaws.com'.
|
115
|
+
#
|
116
|
+
# @attr_reader [Boolean] simple_db_consistent_reads Determines
|
117
|
+
# if all SimpleDB read requests should be done consistently.
|
118
|
+
# Consistent reads are slower, but reflect all changes to SDB.
|
119
|
+
# Defaults to +false+.
|
120
|
+
#
|
121
|
+
# @attr_reader [String] simple_email_service_endpoint The service endpoint
|
122
|
+
# for Amazon Simple Email Service. Defaults to
|
123
|
+
# 'email.us-east-1.amazonaws.com'.
|
124
|
+
#
|
125
|
+
# @attr_reader [Object] signer The request signer. Defaults to
|
126
|
+
# a default request signer implementation.
|
127
|
+
#
|
128
|
+
# @attr_reader [String] ssl_ca_file The path to a CA cert bundle in
|
129
|
+
# PEM format.
|
130
|
+
#
|
131
|
+
# If +ssl_verify_peer+ is true (the default) this bundle will be
|
132
|
+
# used to validate the server certificate in each HTTPS request.
|
133
|
+
# The AWS SDK for Ruby ships with a CA cert bundle, which is the
|
134
|
+
# default value for this option.
|
135
|
+
#
|
136
|
+
# @attr_reader [Boolean] ssl_verify_peer When +true+
|
137
|
+
# the HTTP handler validate server certificates for HTTPS requests.
|
138
|
+
# Defaults to +true+.
|
139
|
+
#
|
140
|
+
# This option should only be disabled for diagnostic purposes;
|
141
|
+
# leaving this option set to +false+ exposes your application to
|
142
|
+
# man-in-the-middle attacks and can pose a serious security
|
143
|
+
# risk.
|
144
|
+
#
|
145
|
+
# @attr_reader [Boolean] stub_requests When +true+ requests are not
|
146
|
+
# sent to AWS, instead empty reponses are generated and returned to
|
147
|
+
# each service request.
|
148
|
+
#
|
149
|
+
# @attr_reader [String] sns_endpoint The service endpoint for Amazon SNS.
|
150
|
+
# Defaults to 'sns.us-east-1.amazonaws.com'.
|
151
|
+
#
|
152
|
+
# @attr_reader [String] sqs_endpoint The service endpoint for Amazon SQS.
|
153
|
+
# Defaults to 'sqs.us-east-1.amazonaws.com'.
|
154
|
+
#
|
155
|
+
# @attr_reader [String] sts_endpoint The service endpoint for AWS
|
156
|
+
# Security Token Service. Defaults to 'sts.amazonaws.com'.
|
157
|
+
#
|
158
|
+
# @attr_reader [Boolean] use_ssl When +true+, all requests
|
159
|
+
# to AWS are sent using HTTPS instead vanilla HTTP.
|
160
|
+
# Defaults to +true+.
|
161
|
+
#
|
162
|
+
# @attr_reader [String] user_agent_prefix A string prefix to
|
163
|
+
# append to all requets against AWS services. This should be set
|
164
|
+
# for clients and applications built ontop of the aws-sdk gem.
|
165
|
+
# Defaults to +nil+.
|
166
|
+
#
|
59
167
|
class Configuration
|
60
168
|
|
61
169
|
# Creates a new Configuration object.
|
@@ -63,75 +171,17 @@ module AWS
|
|
63
171
|
# @option options (see AWS.config)
|
64
172
|
def initialize options = {}
|
65
173
|
|
66
|
-
@
|
67
|
-
|
68
|
-
@overridden = options.delete(:__overridden__) ||
|
69
|
-
Set.new(options.keys.map { |k| k.to_sym })
|
70
|
-
|
71
|
-
@options = {
|
72
|
-
:ec2_endpoint => 'ec2.amazonaws.com',
|
73
|
-
:http_handler => Http::HTTPartyHandler.new,
|
74
|
-
:max_retries => 3,
|
75
|
-
:iam_endpoint => 'iam.amazonaws.com',
|
76
|
-
:s3_endpoint => 's3.amazonaws.com',
|
77
|
-
:s3_multipart_threshold => 16 * 1024 * 1024,
|
78
|
-
:s3_multipart_min_part_size => 5 * 1024 * 1024,
|
79
|
-
:s3_multipart_max_parts => 10000,
|
80
|
-
:simple_db_endpoint => 'sdb.amazonaws.com',
|
81
|
-
:simple_db_consistent_reads => false,
|
82
|
-
:simple_email_service_endpoint => 'email.us-east-1.amazonaws.com',
|
83
|
-
:sns_endpoint => 'sns.us-east-1.amazonaws.com',
|
84
|
-
:sqs_endpoint => 'sqs.us-east-1.amazonaws.com',
|
85
|
-
:sts_endpoint => 'sts.amazonaws.com',
|
86
|
-
:stub_requests => false,
|
87
|
-
:proxy_uri => nil,
|
88
|
-
:use_ssl => true,
|
89
|
-
:user_agent_prefix => nil,
|
90
|
-
:ssl_verify_peer => true,
|
91
|
-
:ssl_ca_file => File.expand_path(File.dirname(__FILE__)+
|
92
|
-
"/../../ca-bundle.crt")
|
93
|
-
}
|
94
|
-
|
95
|
-
{
|
96
|
-
'AWS_ACCESS_KEY_ID' => :access_key_id,
|
97
|
-
'AWS_SECRET_ACCESS_KEY' => :secret_access_key,
|
98
|
-
'AMAZON_ACCESS_KEY_ID' => :access_key_id,
|
99
|
-
'AMAZON_SECRET_ACCESS_KEY' => :secret_access_key,
|
100
|
-
}.each_pair do |env_key, opt_key|
|
101
|
-
if ENV[env_key]
|
102
|
-
@options[opt_key] = ENV[env_key]
|
103
|
-
end
|
104
|
-
end
|
174
|
+
@created = options.delete(:__created__) || {}
|
105
175
|
|
106
|
-
options.
|
107
|
-
|
176
|
+
options.each_pair do |opt_name, value|
|
177
|
+
opt_name = opt_name.to_sym
|
178
|
+
if self.class.accepted_options.include?(opt_name)
|
179
|
+
supplied[opt_name] = value
|
180
|
+
end
|
108
181
|
end
|
109
182
|
|
110
183
|
end
|
111
184
|
|
112
|
-
# @return [Boolean] Returns true if web service requets should be
|
113
|
-
# made with HTTPS.
|
114
|
-
def use_ssl?
|
115
|
-
@options[:use_ssl]
|
116
|
-
end
|
117
|
-
alias_method :use_ssl, :use_ssl?
|
118
|
-
|
119
|
-
# @return [String] Your AWS account access key id credential.
|
120
|
-
def access_key_id
|
121
|
-
@options[:access_key_id]
|
122
|
-
end
|
123
|
-
|
124
|
-
# @return [String] Your AWS secret access key credential.
|
125
|
-
def secret_access_key
|
126
|
-
@options[:secret_access_key]
|
127
|
-
end
|
128
|
-
|
129
|
-
# @return [String] Your AWS session token credential.
|
130
|
-
# @see STS
|
131
|
-
def session_token
|
132
|
-
@options[:session_token]
|
133
|
-
end
|
134
|
-
|
135
185
|
# Used to create a new Configuration object with the given modifications.
|
136
186
|
# The current configuration object is not modified.
|
137
187
|
#
|
@@ -153,172 +203,155 @@ module AWS
|
|
153
203
|
# @return [Configuration] Copies the current configuration and returns
|
154
204
|
# a new one with modifications as provided in +:options+.
|
155
205
|
def with options = {}
|
156
|
-
overridden = @overridden + options.keys.map { |k| k.to_sym }
|
157
|
-
self.class.new(@options.merge(options).
|
158
|
-
merge(:__create_options__ => @create_options,
|
159
|
-
:__overridden__ => overridden))
|
160
|
-
end
|
161
206
|
|
162
|
-
|
163
|
-
|
164
|
-
@options[:max_retries]
|
165
|
-
end
|
207
|
+
# symbolize option keys
|
208
|
+
options = options.inject({}) {|h,kv| h[kv.first.to_sym] = kv.last; h }
|
166
209
|
|
167
|
-
|
168
|
-
# Management (IAM).
|
169
|
-
def iam_endpoint
|
170
|
-
@options[:iam_endpoint]
|
171
|
-
end
|
210
|
+
values = supplied.merge(options)
|
172
211
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
212
|
+
if supplied == values
|
213
|
+
self # nothing changed
|
214
|
+
else
|
215
|
+
self.class.new(values.merge(:__created__ => @created))
|
216
|
+
end
|
177
217
|
|
178
|
-
# @return [String] The default service endpoint for Amazon EC2.
|
179
|
-
def ec2_endpoint
|
180
|
-
@options[:ec2_endpoint]
|
181
218
|
end
|
182
219
|
|
183
|
-
# @return [
|
184
|
-
def
|
185
|
-
|
220
|
+
# @return [Hash] Returns a hash of all configuration values.
|
221
|
+
def to_h
|
222
|
+
self.class.accepted_options.inject({}) do |h,k|
|
223
|
+
h[k] = send(k)
|
224
|
+
h
|
225
|
+
end
|
186
226
|
end
|
187
227
|
|
188
|
-
# @return [
|
189
|
-
|
190
|
-
|
228
|
+
# @return [Boolean] Returns true if the two configuration objects have
|
229
|
+
# the same values.
|
230
|
+
def == other
|
231
|
+
other.is_a?(self.class) and self.supplied == other.supplied
|
191
232
|
end
|
192
233
|
|
193
|
-
|
194
|
-
def sns_endpoint
|
195
|
-
@options[:sns_endpoint]
|
196
|
-
end
|
234
|
+
alias_method :eql, :==
|
197
235
|
|
198
|
-
# @
|
199
|
-
def
|
200
|
-
|
236
|
+
# @private
|
237
|
+
def inspect
|
238
|
+
"<#{self.class.name}>"
|
201
239
|
end
|
202
240
|
|
203
|
-
|
204
|
-
def
|
205
|
-
@
|
241
|
+
protected
|
242
|
+
def supplied
|
243
|
+
@supplied ||= {}
|
206
244
|
end
|
207
245
|
|
208
|
-
|
209
|
-
# consistent reads.
|
210
|
-
def simple_db_consistent_reads?
|
211
|
-
@options[:simple_db_consistent_reads]
|
212
|
-
end
|
246
|
+
class << self
|
213
247
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
end
|
248
|
+
# @private
|
249
|
+
def accepted_options
|
250
|
+
@options ||= Set.new
|
251
|
+
end
|
219
252
|
|
220
|
-
|
221
|
-
|
222
|
-
@options[:http_handler]
|
223
|
-
end
|
253
|
+
# @private
|
254
|
+
def add_option name, default_value = nil, options = {}, &transform
|
224
255
|
|
225
|
-
|
226
|
-
def signer
|
227
|
-
return @options[:signer] if @options[:signer]
|
228
|
-
raise "Missing credentials" unless access_key_id and secret_access_key
|
229
|
-
@options[:signer] ||=
|
230
|
-
DefaultSigner.new(access_key_id, secret_access_key, session_token)
|
231
|
-
end
|
256
|
+
accepted_options << name
|
232
257
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
258
|
+
define_method(name) do
|
259
|
+
value = supplied.has_key?(name) ? supplied[name] : default_value
|
260
|
+
transform ? transform.call(value) : value
|
261
|
+
end
|
237
262
|
|
238
|
-
|
239
|
-
# all AWS requests to return stubbed (empty) responses without making a
|
240
|
-
# request to the actual service.
|
241
|
-
def stub_requests?
|
242
|
-
@options[:stub_requests]
|
243
|
-
end
|
263
|
+
alias_method("#{name}?", name) if options[:boolean]
|
244
264
|
|
245
|
-
|
246
|
-
# are uploaded to S3 in multiple parts.
|
247
|
-
def s3_multipart_threshold
|
248
|
-
@options[:s3_multipart_threshold]
|
249
|
-
end
|
265
|
+
end
|
250
266
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
@
|
255
|
-
|
267
|
+
# Configuration options that have dependencies are re-recreated
|
268
|
+
# anytime one of their dependendent configuration values are
|
269
|
+
# changed.
|
270
|
+
# @private
|
271
|
+
def add_option_with_needs name, needs, &create_block
|
272
|
+
|
273
|
+
accepted_options << name
|
256
274
|
|
257
|
-
|
258
|
-
# when uploading to S3.
|
259
|
-
def s3_multipart_max_parts
|
260
|
-
@options[:s3_multipart_max_parts]
|
261
|
-
end
|
275
|
+
define_method(name) do
|
262
276
|
|
263
|
-
|
264
|
-
# server certificate.
|
265
|
-
#
|
266
|
-
# @note This option should only be used for diagnostic purposes;
|
267
|
-
# leaving this option set to +false+ exposes your application to
|
268
|
-
# man-in-the-middle attacks and can pose a serious security
|
269
|
-
# risk.
|
270
|
-
def ssl_verify_peer?
|
271
|
-
@options[:ssl_verify_peer]
|
272
|
-
end
|
277
|
+
return supplied[name] if supplied.has_key?(name)
|
273
278
|
|
274
|
-
|
275
|
-
#
|
276
|
-
# If {#ssl_verify_peer?} is true (the default) this bundle will be
|
277
|
-
# used to validate the server certificate in each HTTPS request.
|
278
|
-
# The AWS SDK for Ruby ships with a CA cert bundle, which is the
|
279
|
-
# default value for this option.
|
280
|
-
def ssl_ca_file
|
281
|
-
@options[:ssl_ca_file]
|
282
|
-
end
|
279
|
+
needed = needs.collect{|need| send(need) }
|
283
280
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
281
|
+
unless @created.key?(name) and @created[name][:needed] == needed
|
282
|
+
@created[name] ||= {}
|
283
|
+
@created[name][:object] = create_block.call(self)
|
284
|
+
@created[name][:needed] = needed
|
285
|
+
end
|
286
|
+
|
287
|
+
@created[name][:object]
|
288
|
+
|
289
|
+
end
|
290
|
+
|
291
|
+
end
|
289
292
|
|
290
|
-
# @private
|
291
|
-
def inspect
|
292
|
-
"<#{self.class}>"
|
293
293
|
end
|
294
294
|
|
295
|
-
|
295
|
+
add_option :access_key_id,
|
296
|
+
ENV['AWS_ACCESS_KEY_ID'] || ENV['AMAZON_ACCESS_KEY_ID']
|
296
297
|
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
298
|
+
add_option :ec2_endpoint, 'ec2.amazonaws.com'
|
299
|
+
|
300
|
+
add_option :s3_endpoint, 's3.amazonaws.com'
|
301
|
+
|
302
|
+
add_option :http_handler, Http::HTTPartyHandler.new
|
303
|
+
|
304
|
+
add_option :iam_endpoint, 'iam.amazonaws.com'
|
305
|
+
|
306
|
+
add_option :logger
|
307
|
+
|
308
|
+
add_option :max_retries, 3
|
309
|
+
|
310
|
+
add_option :proxy_uri do |uri| uri ? URI.parse(uri.to_s) : nil end
|
311
|
+
|
312
|
+
add_option :s3_multipart_threshold, 16 * 1024 * 1024
|
313
|
+
|
314
|
+
add_option :s3_multipart_min_part_size, 5 * 1024 * 1024
|
315
|
+
|
316
|
+
add_option :s3_multipart_max_parts, 10000
|
317
|
+
|
318
|
+
add_option :secret_access_key,
|
319
|
+
ENV['AWS_SECRET_ACCESS_KEY'] || ENV['AMAZON_SECRET_ACCESS_KEY']
|
320
|
+
|
321
|
+
add_option :session_token
|
322
|
+
|
323
|
+
add_option_with_needs :signer,
|
324
|
+
[:access_key_id, :secret_access_key, :session_token] do |config|
|
325
|
+
|
326
|
+
DefaultSigner.new(
|
327
|
+
config.access_key_id,
|
328
|
+
config.secret_access_key,
|
329
|
+
config.session_token)
|
321
330
|
|
322
331
|
end
|
332
|
+
|
333
|
+
add_option :simple_db_endpoint, 'sdb.amazonaws.com'
|
334
|
+
|
335
|
+
add_option :simple_db_consistent_reads, false, :boolean => true
|
336
|
+
|
337
|
+
add_option :simple_email_service_endpoint, 'email.us-east-1.amazonaws.com'
|
338
|
+
|
339
|
+
add_option :sns_endpoint, 'sns.us-east-1.amazonaws.com'
|
340
|
+
|
341
|
+
add_option :sqs_endpoint, 'sqs.us-east-1.amazonaws.com'
|
342
|
+
|
343
|
+
add_option :ssl_verify_peer, true, :boolean => true
|
344
|
+
|
345
|
+
add_option :ssl_ca_file,
|
346
|
+
File.expand_path(File.dirname(__FILE__) + "/../../ca-bundle.crt")
|
347
|
+
|
348
|
+
add_option :sts_endpoint, 'sts.amazonaws.com'
|
349
|
+
|
350
|
+
add_option :stub_requests, false, :boolean => true
|
351
|
+
|
352
|
+
add_option :use_ssl, true, :boolean => true
|
353
|
+
|
354
|
+
add_option :user_agent_prefix
|
355
|
+
|
323
356
|
end
|
324
357
|
end
|
data/lib/aws/default_signer.rb
CHANGED
@@ -37,12 +37,14 @@ module AWS
|
|
37
37
|
# @param [String] session_token The Session Token used to sign
|
38
38
|
# requests. You can get credentials that include a session
|
39
39
|
# token using the {STS} class.
|
40
|
-
def initialize(access_key_id,
|
41
|
-
|
42
|
-
session_token = nil)
|
40
|
+
def initialize(access_key_id, secret_access_key, session_token = nil)
|
41
|
+
|
43
42
|
@access_key_id = access_key_id
|
44
43
|
@secret_access_key = secret_access_key
|
45
44
|
@session_token = session_token
|
45
|
+
|
46
|
+
raise "Missing credentials" unless access_key_id and secret_access_key
|
47
|
+
|
46
48
|
end
|
47
49
|
|
48
50
|
# Signs a string using the credentials stored in memory.
|
data/lib/aws/iam.rb
CHANGED
@@ -108,7 +108,7 @@ module AWS
|
|
108
108
|
# See {AccessKeyCollection} and {AccessKey} for more information about
|
109
109
|
# working with access keys.
|
110
110
|
#
|
111
|
-
# = Users &
|
111
|
+
# = Users & Groups
|
112
112
|
#
|
113
113
|
# Each AWS account can have multiple users. Users can be used to easily
|
114
114
|
# manage permissions. Users can also be organized into groups.
|
data/lib/aws/uri_escape.rb
CHANGED
@@ -33,7 +33,11 @@ module AWS
|
|
33
33
|
# @private
|
34
34
|
protected
|
35
35
|
def escape_path value
|
36
|
-
|
36
|
+
escaped = ""
|
37
|
+
value.scan(%r{(/?)([^/]+)(/?)}) do |(leading, part, trailing)|
|
38
|
+
escaped << leading + escape(part) + trailing
|
39
|
+
end
|
40
|
+
escaped
|
37
41
|
end
|
38
42
|
|
39
43
|
end
|
metadata
CHANGED
@@ -1,93 +1,67 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 1.1.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Amazon Web Services
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-08-16 00:00:00 -07:00
|
12
|
+
date: 2011-08-18 00:00:00.000000000 -07:00
|
19
13
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: uuidtools
|
23
|
-
|
24
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &2163583560 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
19
|
+
requirements:
|
27
20
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 2
|
32
|
-
- 1
|
33
|
-
version: "2.1"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.1'
|
34
23
|
type: :runtime
|
35
|
-
requirement: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: httparty
|
38
24
|
prerelease: false
|
39
|
-
version_requirements:
|
25
|
+
version_requirements: *2163583560
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: httparty
|
28
|
+
requirement: &2163582960 !ruby/object:Gem::Requirement
|
40
29
|
none: false
|
41
|
-
requirements:
|
30
|
+
requirements:
|
42
31
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
- 7
|
48
|
-
version: "0.7"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.7'
|
49
34
|
type: :runtime
|
50
|
-
requirement: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: nokogiri
|
53
35
|
prerelease: false
|
54
|
-
version_requirements:
|
36
|
+
version_requirements: *2163582960
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: nokogiri
|
39
|
+
requirement: &2163582380 !ruby/object:Gem::Requirement
|
55
40
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
hash: 15
|
60
|
-
segments:
|
61
|
-
- 1
|
62
|
-
- 4
|
63
|
-
- 4
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
64
44
|
version: 1.4.4
|
65
45
|
type: :runtime
|
66
|
-
requirement: *id003
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
name: json
|
69
46
|
prerelease: false
|
70
|
-
version_requirements:
|
47
|
+
version_requirements: *2163582380
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: json
|
50
|
+
requirement: &2163581800 !ruby/object:Gem::Requirement
|
71
51
|
none: false
|
72
|
-
requirements:
|
52
|
+
requirements:
|
73
53
|
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
|
76
|
-
segments:
|
77
|
-
- 1
|
78
|
-
- 4
|
79
|
-
version: "1.4"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.4'
|
80
56
|
type: :runtime
|
81
|
-
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *2163581800
|
82
59
|
description: AWS SDK for Ruby
|
83
60
|
email:
|
84
61
|
executables: []
|
85
|
-
|
86
62
|
extensions: []
|
87
|
-
|
88
63
|
extra_rdoc_files: []
|
89
|
-
|
90
|
-
files:
|
64
|
+
files:
|
91
65
|
- ca-bundle.crt
|
92
66
|
- rails/init.rb
|
93
67
|
- lib/aws/api_config.rb
|
@@ -101,7 +75,6 @@ files:
|
|
101
75
|
- lib/aws/client_logging.rb
|
102
76
|
- lib/aws/collections.rb
|
103
77
|
- lib/aws/common.rb
|
104
|
-
- lib/aws/configurable.rb
|
105
78
|
- lib/aws/configuration.rb
|
106
79
|
- lib/aws/configured_client_methods.rb
|
107
80
|
- lib/aws/configured_grammars.rb
|
@@ -339,37 +312,31 @@ files:
|
|
339
312
|
- LICENSE.txt
|
340
313
|
has_rdoc: true
|
341
314
|
homepage: http://aws.amazon.com/sdkforruby
|
342
|
-
licenses:
|
315
|
+
licenses:
|
343
316
|
- Apache 2.0
|
344
317
|
post_install_message:
|
345
318
|
rdoc_options: []
|
346
|
-
|
347
|
-
require_paths:
|
319
|
+
require_paths:
|
348
320
|
- lib
|
349
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
321
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
350
322
|
none: false
|
351
|
-
requirements:
|
352
|
-
- -
|
353
|
-
- !ruby/object:Gem::Version
|
354
|
-
|
355
|
-
segments:
|
323
|
+
requirements:
|
324
|
+
- - ! '>='
|
325
|
+
- !ruby/object:Gem::Version
|
326
|
+
version: '0'
|
327
|
+
segments:
|
356
328
|
- 0
|
357
|
-
|
358
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
329
|
+
hash: -2676721713860142099
|
330
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
359
331
|
none: false
|
360
|
-
requirements:
|
361
|
-
- -
|
362
|
-
- !ruby/object:Gem::Version
|
363
|
-
|
364
|
-
segments:
|
365
|
-
- 0
|
366
|
-
version: "0"
|
332
|
+
requirements:
|
333
|
+
- - ! '>='
|
334
|
+
- !ruby/object:Gem::Version
|
335
|
+
version: '0'
|
367
336
|
requirements: []
|
368
|
-
|
369
337
|
rubyforge_project:
|
370
|
-
rubygems_version: 1.
|
338
|
+
rubygems_version: 1.6.1
|
371
339
|
signing_key:
|
372
340
|
specification_version: 3
|
373
341
|
summary: AWS SDK for Ruby
|
374
342
|
test_files: []
|
375
|
-
|
data/lib/aws/configurable.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# Copyright 2011 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 'aws/configuration'
|
15
|
-
|
16
|
-
module AWS
|
17
|
-
|
18
|
-
# @private
|
19
|
-
module Configurable
|
20
|
-
|
21
|
-
module ClassMethods
|
22
|
-
|
23
|
-
def make_configurable(name, opts = {})
|
24
|
-
Configuration.add_parameter_type(self, name, opts)
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.included(m)
|
30
|
-
m.extend ClassMethods
|
31
|
-
super
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|