aws-sdk-core 2.0.0.rc13 → 2.0.0.rc14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -7
- data/apis/s3-2006-03-01.api.json +27 -16
- data/bin/aws.rb +0 -1
- data/endpoints.json +7 -3
- data/lib/aws.rb +57 -40
- data/lib/aws/endpoint_provider.rb +5 -21
- data/lib/aws/plugins/global_configuration.rb +2 -5
- data/lib/aws/plugins/regional_endpoint.rb +1 -4
- data/lib/aws/plugins/request_signer.rb +8 -2
- data/lib/aws/plugins/response_paging.rb +1 -1
- data/lib/aws/plugins/s3_sse_cpk.rb +25 -4
- data/lib/aws/service.rb +1 -19
- data/lib/aws/service_builder.rb +56 -0
- data/lib/aws/version.rb +1 -1
- data/lib/aws/xml/builder.rb +3 -7
- data/{vendor/seahorse/lib → lib}/seahorse.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/base.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/block_io.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/configuration.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/handler.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/handler_builder.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/handler_list.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/handler_list_entry.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/http/error.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/http/headers.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/http/request.rb +1 -1
- data/{vendor/seahorse/lib → lib}/seahorse/client/http/response.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/logging/formatter.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/logging/handler.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/managed_file.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/net_http/connection_pool.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/net_http/handler.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/net_http/patches.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/param_converter.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/param_validator.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/plugin.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/plugin_list.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/plugins/api.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/plugins/content_length.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/plugins/endpoint.rb +23 -14
- data/{vendor/seahorse/lib → lib}/seahorse/client/plugins/json_simple.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/plugins/logging.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/plugins/net_http.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/plugins/operation_methods.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/plugins/param_conversion.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/plugins/param_validation.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/plugins/raise_response_errors.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/plugins/restful_bindings.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/request.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/request_context.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/response.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/client/xml/builder.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/model/api.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/model/operation.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/model/shape_map.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/model/shapes.rb +2 -2
- data/{vendor/seahorse/lib → lib}/seahorse/util.rb +0 -0
- data/{vendor/seahorse/lib → lib}/seahorse/version.rb +0 -0
- metadata +48 -49
- data/lib/aws/client_factory.rb +0 -251
data/lib/aws/client_factory.rb
DELETED
@@ -1,251 +0,0 @@
|
|
1
|
-
require 'multi_json'
|
2
|
-
require 'thread'
|
3
|
-
|
4
|
-
module Aws
|
5
|
-
class ClientFactory
|
6
|
-
|
7
|
-
@@const_set_mutex = Mutex.new
|
8
|
-
|
9
|
-
class << self
|
10
|
-
|
11
|
-
# Constructs and returns versioned API client. Defaults to the
|
12
|
-
# newest/latest API version.
|
13
|
-
#
|
14
|
-
# Aws::DynamoDB.new
|
15
|
-
# #=> #<Aws::DynamoDB::V20120810>
|
16
|
-
#
|
17
|
-
# ## Specify API Version
|
18
|
-
#
|
19
|
-
# You can specify the API version and get a different client.
|
20
|
-
#
|
21
|
-
# Aws::DynamoDB.new(api_version: '2011-12-05')
|
22
|
-
# #=> #<Aws::DynamoDB::V20111205>
|
23
|
-
#
|
24
|
-
# ## Locking API Versions
|
25
|
-
#
|
26
|
-
# You can lock the API version for a service via {Aws.config}:
|
27
|
-
#
|
28
|
-
# Aws.config[:dynamodb] = { api_version: '2011-12-05' }
|
29
|
-
# Aws::DynamoDB.new
|
30
|
-
# #=> #<Aws::DynamoDB::V20111205>
|
31
|
-
#
|
32
|
-
# ## Global Version Lock
|
33
|
-
#
|
34
|
-
# It is possible to provide a single 'YYYY-MM-DD' date to lock the
|
35
|
-
# API version for every service. This is useful to ensure that
|
36
|
-
# future API updates do not break existing usage.
|
37
|
-
#
|
38
|
-
# When using the single lock, the API version that was current
|
39
|
-
# at the given date will be used.
|
40
|
-
#
|
41
|
-
# For example, Aws::DynamoDB has two API versions, 2011-12-05 and
|
42
|
-
# 2012-10-01. If the lock date is in between these two dates, the
|
43
|
-
# older will be used.
|
44
|
-
#
|
45
|
-
# Aws.config[:api_version] = '2012-01-01'
|
46
|
-
# Aws::DynamoDB.new
|
47
|
-
# #=> #<Aws::DynamoDB::V20111205>
|
48
|
-
#
|
49
|
-
# @return [Seahorse::Client::Base] Returns a versioned client.
|
50
|
-
def new(options = {})
|
51
|
-
options = options.dup
|
52
|
-
api_version = options.delete(:api_version) || default_api_version
|
53
|
-
versioned_client_class(api_version).new(options)
|
54
|
-
end
|
55
|
-
|
56
|
-
# Registers a new API version for this client factory. You need to
|
57
|
-
# provide the API version in `YYYY-MM-DD` format and an API.
|
58
|
-
#
|
59
|
-
# Aws::S3.add_version('2013-01-02', 'api' => '/path/to/api.json')
|
60
|
-
#
|
61
|
-
# You can also provide paths to the paginator, waiter, and resource
|
62
|
-
# definitions.
|
63
|
-
#
|
64
|
-
# @param [String<YYYY-MM-DD>] api_version
|
65
|
-
# @param [Hash] definitions
|
66
|
-
# @option definitions [required,String] 'api'
|
67
|
-
# @option definitions [String] 'paginators'
|
68
|
-
# @option definitions [String] 'waiters'
|
69
|
-
# @option definitions [String] 'resources'
|
70
|
-
# @return [void]
|
71
|
-
# @see .api_versions
|
72
|
-
# @see .default_api_version
|
73
|
-
# @see .latest_api_version
|
74
|
-
# @see .versioned_clients
|
75
|
-
def add_version(api_version, definitions)
|
76
|
-
versions[api_version] = definitions
|
77
|
-
end
|
78
|
-
|
79
|
-
# @return [Array<String>] Returns a list of supported API versions
|
80
|
-
# in a `YYYY-MM-DD` format.
|
81
|
-
# @see .add_version
|
82
|
-
# @see .latest_api_version
|
83
|
-
# @see .default_api_version
|
84
|
-
# @see .default_client_class
|
85
|
-
# @see .versioned_clients
|
86
|
-
def api_versions
|
87
|
-
versions.keys.sort
|
88
|
-
end
|
89
|
-
|
90
|
-
# @return [String<YYYY-MM-DD>] Returns the most current API version.
|
91
|
-
# @see .add_version
|
92
|
-
# @see .api_versions
|
93
|
-
# @see .default_api_version
|
94
|
-
# @see .default_client_class
|
95
|
-
# @see .versioned_clients
|
96
|
-
def latest_api_version
|
97
|
-
api_versions.last
|
98
|
-
end
|
99
|
-
|
100
|
-
# @return [String<YYYY-MM-DD>] Returns the default API version. This
|
101
|
-
# is the version of the client that will be constructed if there
|
102
|
-
# is other configured or specified API version.
|
103
|
-
# @see .add_version
|
104
|
-
# @see .api_versions
|
105
|
-
# @see .default_client_class
|
106
|
-
# @see .latest_api_version
|
107
|
-
# @see .versioned_clients
|
108
|
-
def default_api_version
|
109
|
-
svc_locked_version || aws_locked_version || latest_api_version
|
110
|
-
end
|
111
|
-
|
112
|
-
# Returns an array of versioned client classes for this service.
|
113
|
-
#
|
114
|
-
# Aws::DynamoDB.versioned_clients
|
115
|
-
# #=> [Aws::DynamoDB::V20111205, Aws::DynamoDB::V20120810]
|
116
|
-
#
|
117
|
-
# @return [Array<Class>] Returns an array of the versioned client
|
118
|
-
# classes for this service.
|
119
|
-
# @see .add_version
|
120
|
-
# @see .api_versions
|
121
|
-
# @see .default_api_version
|
122
|
-
# @see .default_client_class
|
123
|
-
# @see .latest_api_version
|
124
|
-
def versioned_clients
|
125
|
-
api_versions.map { |api_version| versioned_client_class(api_version) }
|
126
|
-
end
|
127
|
-
|
128
|
-
# @return [Class<Seahorse::Client::Base>]
|
129
|
-
# @see .add_version
|
130
|
-
# @see .api_versions
|
131
|
-
# @see .default_api_version
|
132
|
-
# @see .latest_api_version
|
133
|
-
# @see .versioned_clients
|
134
|
-
def default_client_class
|
135
|
-
versioned_client_class(default_api_version)
|
136
|
-
end
|
137
|
-
|
138
|
-
# Adds a plugin to each versioned client class.
|
139
|
-
# @param [Plugin] plugin
|
140
|
-
# @return [void]
|
141
|
-
# @see .remove_plugin
|
142
|
-
def add_plugin(plugin)
|
143
|
-
versioned_clients.each do |client_class|
|
144
|
-
client_class.add_plugin(plugin)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
# Removes a plugin from each versioned client class.
|
149
|
-
# @param [Plugin] plugin
|
150
|
-
# @return [void]
|
151
|
-
# @see .add_plugin
|
152
|
-
def remove_plugin(plugin)
|
153
|
-
versioned_clients.each do |client_class|
|
154
|
-
client_class.remove_plugin(plugin)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
# @api private
|
159
|
-
def define(identifier, versions = {})
|
160
|
-
Class.new(self).tap do |client_class|
|
161
|
-
client_class.const_set(:IDENTIFIER, identifier)
|
162
|
-
versions.each do |date, definitions|
|
163
|
-
client_class.add_version(date, definitions)
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
# @api private
|
169
|
-
def const_missing(const)
|
170
|
-
if const =~ /^V\d{8}$/
|
171
|
-
@@const_set_mutex.synchronize do
|
172
|
-
if const_defined?(const)
|
173
|
-
const_get(const)
|
174
|
-
else
|
175
|
-
const_set(const, build_versioned_client_class(api_version(const)))
|
176
|
-
end
|
177
|
-
end
|
178
|
-
else
|
179
|
-
super
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
private
|
184
|
-
|
185
|
-
def build_versioned_client_class(version)
|
186
|
-
if definitions = versions[version]
|
187
|
-
api = build_api(definitions['api'])
|
188
|
-
apply_paging(api, definitions['paginators'])
|
189
|
-
client_class = Seahorse::Client::Base.define(api: api)
|
190
|
-
client_class.const_set(:IDENTIFIER, self::IDENTIFIER)
|
191
|
-
Api::ServiceCustomizations.apply(client_class)
|
192
|
-
client_class
|
193
|
-
else
|
194
|
-
msg = "API #{version} not defined for #{name}"
|
195
|
-
raise Errors::NoSuchApiVersionError, msg
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
def apply_paging(api, paging)
|
200
|
-
paging = case paging
|
201
|
-
when nil then Paging::NullProvider.new
|
202
|
-
when Paging::Provider then paging
|
203
|
-
when Hash then PagingProvider.new(paging)
|
204
|
-
when String
|
205
|
-
path = File.expand_path(paging, GEM_ROOT)
|
206
|
-
Paging::Provider.new(MultiJson.load(File.read(path)))
|
207
|
-
else raise "unhandled paging format `#{paging}'"
|
208
|
-
end
|
209
|
-
api.definition['metadata']['paging'] = paging
|
210
|
-
end
|
211
|
-
|
212
|
-
def svc_locked_version
|
213
|
-
(Aws.config[self::IDENTIFIER] || {})[:api_version]
|
214
|
-
end
|
215
|
-
|
216
|
-
def aws_locked_version
|
217
|
-
if api_version = Aws.config[:api_version]
|
218
|
-
api_versions.select { |v| v <= api_version }.last || api_version
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
def versioned_client_class(api_version)
|
223
|
-
const_get("V#{api_version.gsub('-', '')}")
|
224
|
-
end
|
225
|
-
|
226
|
-
def versions
|
227
|
-
@versions ||= {}
|
228
|
-
end
|
229
|
-
|
230
|
-
def build_api(api)
|
231
|
-
case api
|
232
|
-
when String then load_api(api)
|
233
|
-
when Hash then Seahorse::Model::Api.new(api)
|
234
|
-
when Seahorse::Model::Api then api
|
235
|
-
else raise "unhandled api format `#{api.class.name}'"
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
def api_version(constant)
|
240
|
-
constant.to_s.match(/V(\d{4})(\d{2})(\d{2})/)[1..3].join('-')
|
241
|
-
end
|
242
|
-
|
243
|
-
def load_api(path)
|
244
|
-
path = File.expand_path(path, GEM_ROOT)
|
245
|
-
api = MultiJson.load(File.read(path), max_nesting: false)
|
246
|
-
Seahorse::Model::Api.new(api)
|
247
|
-
end
|
248
|
-
|
249
|
-
end
|
250
|
-
end
|
251
|
-
end
|