aws-sdk 1.7.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +4 -4
- data/lib/aws-sdk.rb +60 -1
- data/lib/aws.rb +1 -50
- data/lib/aws/api_config/CloudFront-2012-05-05.yml +864 -899
- data/lib/aws/api_config/DataPipeline-2012-10-29.yml +422 -0
- data/lib/aws/api_config/EC2-2012-07-20.yml +0 -2
- data/lib/aws/api_config/Glacier-2012-06-01.yml +622 -0
- data/lib/aws/api_config/ImportExport-2010-06-01.yml +109 -0
- data/lib/aws/api_config/{SQS-2011-10-01.yml → SQS-2012-11-05.yml} +3 -1
- data/lib/aws/api_config/StorageGateway-2012-06-30.yml +748 -0
- data/lib/aws/cloud_front.rb +71 -0
- data/lib/aws/cloud_front/client.rb +1307 -0
- data/lib/aws/cloud_front/config.rb +18 -0
- data/lib/aws/cloud_front/errors.rb +22 -0
- data/lib/aws/cloud_front/request.rb +44 -0
- data/lib/aws/core.rb +19 -1
- data/lib/aws/core/client.rb +7 -0
- data/lib/aws/core/collection.rb +1 -1
- data/lib/aws/core/configuration.rb +12 -0
- data/lib/aws/core/data.rb +13 -8
- data/lib/aws/core/json_client.rb +3 -4
- data/lib/aws/core/json_parser.rb +76 -0
- data/lib/aws/core/json_request_builder.rb +4 -3
- data/lib/aws/core/json_response_parser.rb +1 -3
- data/lib/aws/core/managed_file.rb +32 -0
- data/lib/aws/core/options/json_serializer.rb +82 -0
- data/lib/aws/core/options/validator.rb +5 -1
- data/lib/aws/core/options/xml_serializer.rb +18 -4
- data/lib/aws/core/{rest_client.rb → rest_json_client.rb} +5 -6
- data/lib/aws/core/rest_request_builder.rb +59 -35
- data/lib/aws/core/rest_response_parser.rb +13 -4
- data/lib/aws/core/rest_xml_client.rb +47 -0
- data/lib/aws/core/signature/version_4.rb +22 -8
- data/lib/aws/data_pipeline.rb +30 -0
- data/lib/aws/data_pipeline/client.rb +392 -0
- data/lib/aws/data_pipeline/config.rb +18 -0
- data/lib/aws/data_pipeline/errors.rb +20 -0
- data/lib/aws/data_pipeline/request.rb +26 -0
- data/lib/aws/ec2/instance_collection.rb +11 -3
- data/lib/aws/ec2/security_group.rb +5 -5
- data/lib/aws/ec2/security_group/{egress_ip_permission_collection.rb → ip_permission_collection.rb} +33 -14
- data/lib/aws/glacier.rb +50 -0
- data/lib/aws/glacier/archive.rb +54 -0
- data/lib/aws/glacier/archive_collection.rb +141 -0
- data/lib/aws/glacier/client.rb +286 -0
- data/lib/aws/glacier/config.rb +19 -0
- data/lib/aws/glacier/errors.rb +22 -0
- data/lib/aws/glacier/request.rb +34 -0
- data/lib/aws/glacier/resource.rb +30 -0
- data/lib/aws/glacier/vault.rb +137 -0
- data/lib/aws/glacier/vault_collection.rb +75 -0
- data/lib/aws/glacier/vault_notification_configuration.rb +27 -0
- data/lib/aws/import_export.rb +71 -0
- data/lib/aws/import_export/client.rb +109 -0
- data/lib/aws/import_export/config.rb +19 -0
- data/lib/aws/import_export/errors.rb +22 -0
- data/lib/aws/import_export/request.rb +23 -0
- data/lib/aws/route_53/client.rb +1 -1
- data/lib/aws/s3/bucket_lifecycle_configuration.rb +160 -63
- data/lib/aws/s3/client.rb +43 -0
- data/lib/aws/s3/client/xml.rb +6 -0
- data/lib/aws/s3/cors_rule_collection.rb +1 -1
- data/lib/aws/s3/data_options.rb +1 -3
- data/lib/aws/s3/request.rb +1 -1
- data/lib/aws/s3/s3_object.rb +52 -10
- data/lib/aws/sqs/client.rb +9 -3
- data/lib/aws/sqs/queue.rb +44 -5
- data/lib/aws/storage_gateway.rb +71 -0
- data/lib/aws/storage_gateway/client.rb +472 -0
- data/lib/aws/storage_gateway/config.rb +18 -0
- data/lib/aws/storage_gateway/errors.rb +22 -0
- data/lib/aws/storage_gateway/request.rb +28 -0
- data/lib/aws/version.rb +1 -1
- metadata +45 -10
- data/lib/aws/ec2/security_group/ingress_ip_permission_collection.rb +0 -61
@@ -0,0 +1,18 @@
|
|
1
|
+
# Copyright 2011-2012 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
|
+
AWS::Core::Configuration.module_eval do
|
15
|
+
|
16
|
+
add_service 'CloudFront', 'cloud_front', 'cloudfront.amazonaws.com'
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright 2011-2012 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
|
+
module AWS
|
15
|
+
class CloudFront
|
16
|
+
module Errors
|
17
|
+
|
18
|
+
extend Core::LazyErrorClasses
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright 2011-2012 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 'time'
|
15
|
+
|
16
|
+
module AWS
|
17
|
+
class CloudFront
|
18
|
+
|
19
|
+
# @private
|
20
|
+
class Request < Core::Http::Request
|
21
|
+
|
22
|
+
def add_authorization! credentials
|
23
|
+
|
24
|
+
self.access_key_id = credentials.access_key_id
|
25
|
+
|
26
|
+
auth = "AWS #{access_key_id}:#{signature(credentials)}"
|
27
|
+
headers['authorization'] = auth
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
protected
|
32
|
+
|
33
|
+
def signature credentials
|
34
|
+
Core::Signer.sign(credentials.secret_access_key, string_to_sign, 'sha1')
|
35
|
+
end
|
36
|
+
|
37
|
+
def string_to_sign
|
38
|
+
headers['date'] ||= Time.now.rfc822
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
data/lib/aws/core.rb
CHANGED
@@ -31,6 +31,7 @@ require 'aws/core/autoloader'
|
|
31
31
|
# * {AWS::ElasticBeanstalk}
|
32
32
|
# * {AWS::ELB}
|
33
33
|
# * {AWS::EMR}
|
34
|
+
# * {AWS::Glacier}
|
34
35
|
# * {AWS::IAM}
|
35
36
|
# * {AWS::RDS}
|
36
37
|
# * {AWS::Route53}
|
@@ -90,6 +91,7 @@ module AWS
|
|
90
91
|
autoload :Data, 'data'
|
91
92
|
autoload :IndifferentHash, 'indifferent_hash'
|
92
93
|
autoload :Inflection, 'inflection'
|
94
|
+
autoload :JSONParser, 'json_parser'
|
93
95
|
|
94
96
|
autoload :JSONClient, 'json_client'
|
95
97
|
autoload :JSONRequestBuilder, 'json_request_builder'
|
@@ -98,6 +100,7 @@ module AWS
|
|
98
100
|
autoload :LazyErrorClasses, 'lazy_error_classes'
|
99
101
|
autoload :LogFormatter, 'log_formatter'
|
100
102
|
autoload :MetaUtils, 'meta_utils'
|
103
|
+
autoload :ManagedFile, 'managed_file'
|
101
104
|
autoload :Model, 'model'
|
102
105
|
autoload :Naming, 'naming'
|
103
106
|
autoload :OptionGrammar, 'option_grammar'
|
@@ -113,7 +116,9 @@ module AWS
|
|
113
116
|
autoload :Response, 'response'
|
114
117
|
autoload :ResponseCache, 'response_cache'
|
115
118
|
|
116
|
-
autoload :RESTClient, '
|
119
|
+
autoload :RESTClient, 'rest_xml_client'
|
120
|
+
autoload :RESTJSONClient, 'rest_json_client'
|
121
|
+
autoload :RESTXMLClient, 'rest_xml_client'
|
117
122
|
autoload :RESTRequestBuilder, 'rest_request_builder'
|
118
123
|
autoload :RESTResponseParser, 'rest_response_parser'
|
119
124
|
|
@@ -125,6 +130,7 @@ module AWS
|
|
125
130
|
|
126
131
|
module Options
|
127
132
|
AWS.register_autoloads(self) do
|
133
|
+
autoload :JSONSerializer, 'json_serializer'
|
128
134
|
autoload :XMLSerializer, 'xml_serializer'
|
129
135
|
autoload :Validator, 'validator'
|
130
136
|
end
|
@@ -225,6 +231,9 @@ module AWS
|
|
225
231
|
# @option options [String] :cloud_formation_endpoint ('cloudformation.us-east-1.amazonaws.com')
|
226
232
|
# The service endpoint for AWS CloudFormation.
|
227
233
|
#
|
234
|
+
# @option options [String] :cloud_front_endpoint ('cloudfront.amazonaws.com')
|
235
|
+
# The service endpoint for Amazon CloudFront.
|
236
|
+
#
|
228
237
|
# @option options [String] :cloud_search ('cloudsearch.us-east-1.amazonaws.com')
|
229
238
|
# The service endpoint for Amazon CloudSearch.
|
230
239
|
#
|
@@ -255,6 +264,9 @@ module AWS
|
|
255
264
|
# @option options [String] :elb_endpoint ('elasticloadbalancing.us-east-1.amazonaws.com')
|
256
265
|
# The service endpoint for Elastic Load Balancing.
|
257
266
|
#
|
267
|
+
# @option options [String] :glacier_endpoint ('glacier.us-east-1.amazonaws.com')
|
268
|
+
# The service endpoint for Amazon Glacier.
|
269
|
+
#
|
258
270
|
# @option options [Object] :http_handler (AWS::Core::Http::NetHttpHandler)
|
259
271
|
# The http handler that sends requests to AWS.
|
260
272
|
#
|
@@ -278,6 +290,9 @@ module AWS
|
|
278
290
|
# @option options [String] :iam_endpoint ('iam.amazonaws.com') The
|
279
291
|
# service endpoint for AWS Idenity Access Management (IAM).
|
280
292
|
#
|
293
|
+
# @option options [String] :import_export_endpoint ('importexport.amazonaws.com')
|
294
|
+
# The service endpoint for AWS Import/Export.
|
295
|
+
#
|
281
296
|
# @option options [Logger,nil] :logger (nil) A logger to send
|
282
297
|
# log messages to. Here is an example that logs to standard out.
|
283
298
|
#
|
@@ -422,6 +437,9 @@ module AWS
|
|
422
437
|
# @option options [String] :sqs_endpoint ('sqs.us-east-1.amazonaws.com') The
|
423
438
|
# service endpoint for Amazon SQS.
|
424
439
|
#
|
440
|
+
# @option options [String] :storage_gateway_endpoint ('storagegateway.us-east-1.amazonaws.com')
|
441
|
+
# The service endpoint for AWS Storage Gateway.
|
442
|
+
#
|
425
443
|
# @option options [String] :sts_endpoint ('sts.amazonaws.com') The
|
426
444
|
# service endpoint for AWS Security Token Service.
|
427
445
|
#
|
data/lib/aws/core/client.rb
CHANGED
data/lib/aws/core/collection.rb
CHANGED
@@ -69,6 +69,9 @@ module AWS
|
|
69
69
|
# @attr_reader [String] cloud_formation_endpoint ('cloudformation.us-east-1.amazonaws.com')
|
70
70
|
# The service endpoint for AWS CloudFormation.
|
71
71
|
#
|
72
|
+
# @attr_reader [String] cloud_front_endpoint ('cloudfront.amazonaws.com')
|
73
|
+
# The service endpoint for Amazon CloudFront.
|
74
|
+
#
|
72
75
|
# @attr_reader [String] cloud_search ('cloudsearch.us-east-1.amazonaws.com')
|
73
76
|
# The service endpoint for Amazon CloudSearch.
|
74
77
|
#
|
@@ -99,6 +102,9 @@ module AWS
|
|
99
102
|
# @attr_reader [String] elb_endpoint ('elasticloadbalancing.us-east-1.amazonaws.com')
|
100
103
|
# The service endpoint for Elastic Load Balancing.
|
101
104
|
#
|
105
|
+
# @attr_reader [String] glacier_endpoint ('glacier.us-east-1.amazonaws.com')
|
106
|
+
# The service endpoint for Amazon Glacier.
|
107
|
+
#
|
102
108
|
# @attr_reader [Object] http_handler The http handler that sends requests
|
103
109
|
# to AWS. Defaults to an HTTP handler built on net/http.
|
104
110
|
#
|
@@ -121,6 +127,9 @@ module AWS
|
|
121
127
|
# @attr_reader [String] iam_endpoint ('iam.amazonaws.com')
|
122
128
|
# The service endpoint for AWS Idenity Access Management (IAM).
|
123
129
|
#
|
130
|
+
# @attr_reader [String] import_export_endpoint ('importexport.amazonaws.com')
|
131
|
+
# The service endpoint for AWS Import/Export.
|
132
|
+
#
|
124
133
|
# @attr_reader [Logger,nil] logger (nil) The logging interface.
|
125
134
|
#
|
126
135
|
# @attr_reader [Symbol] log_level (:info) The log level.
|
@@ -239,6 +248,9 @@ module AWS
|
|
239
248
|
# @attr_reader [String] sqs_endpoint ('sqs.us-east-1.amazonaws.com')
|
240
249
|
# The service endpoint for Amazon SQS.
|
241
250
|
#
|
251
|
+
# @attr_reader [String] :storage_gateway_endpoint ('storagegateway.us-east-1.amazonaws.com')
|
252
|
+
# The service endpoint for AWS Storage Gateway.
|
253
|
+
#
|
242
254
|
# @attr_reader [String] sts_endpoint ('sts.amazonaws.com')
|
243
255
|
# The service endpoint for AWS Security Token Service.
|
244
256
|
#
|
data/lib/aws/core/data.rb
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
module AWS
|
15
15
|
module Core
|
16
|
-
|
16
|
+
|
17
17
|
# Data is a light wrapper around a Ruby hash that provides
|
18
18
|
# method missing access to the hash contents.
|
19
19
|
#
|
@@ -66,7 +66,7 @@ module AWS
|
|
66
66
|
|
67
67
|
# @private
|
68
68
|
def id
|
69
|
-
self[:id] || self.id
|
69
|
+
self[:id] || self.id
|
70
70
|
end
|
71
71
|
|
72
72
|
def [] index_or_key
|
@@ -84,6 +84,11 @@ module AWS
|
|
84
84
|
end
|
85
85
|
alias_method :==, :eql?
|
86
86
|
|
87
|
+
def dup
|
88
|
+
Data.cast(@data.dup)
|
89
|
+
end
|
90
|
+
alias_method :clone, :dup
|
91
|
+
|
87
92
|
protected
|
88
93
|
|
89
94
|
def method_missing *args, &block
|
@@ -106,7 +111,7 @@ module AWS
|
|
106
111
|
include MethodMissingProxy
|
107
112
|
|
108
113
|
def method_missing method_name, *args, &block
|
109
|
-
if
|
114
|
+
if
|
110
115
|
args.empty? and !block_given? and
|
111
116
|
key = _remove_question_mark(method_name) and
|
112
117
|
@data.has_key?(key)
|
@@ -116,7 +121,7 @@ module AWS
|
|
116
121
|
super
|
117
122
|
end
|
118
123
|
end
|
119
|
-
|
124
|
+
|
120
125
|
# @param [Hash] data The ruby hash of data you need wrapped.
|
121
126
|
def initialize data
|
122
127
|
@data = data
|
@@ -174,14 +179,14 @@ module AWS
|
|
174
179
|
end
|
175
180
|
|
176
181
|
class << self
|
177
|
-
|
182
|
+
|
178
183
|
# Given a hash, this method returns a {Data} object. Given
|
179
184
|
# an Array, this method returns a {Data::List} object. Everything
|
180
185
|
# else is returned as is.
|
181
186
|
#
|
182
187
|
# @param [Object] value The value to conditionally wrap.
|
183
188
|
#
|
184
|
-
# @return [Data,Data::List,Object] Wraps hashes and lists with
|
189
|
+
# @return [Data,Data::List,Object] Wraps hashes and lists with
|
185
190
|
# Data and List objects, all other objects are returned as
|
186
191
|
# is.
|
187
192
|
#
|
@@ -198,7 +203,7 @@ module AWS
|
|
198
203
|
class List
|
199
204
|
|
200
205
|
include MethodMissingProxy
|
201
|
-
|
206
|
+
|
202
207
|
# @param [Array] array
|
203
208
|
def initialize array
|
204
209
|
@data = array
|
@@ -217,7 +222,7 @@ module AWS
|
|
217
222
|
end
|
218
223
|
alias_method :to_a, :to_ary
|
219
224
|
|
220
|
-
# #inject works on Core::Data::List in in 1.8.7 and 1.9.3, but not
|
225
|
+
# #inject works on Core::Data::List in in 1.8.7 and 1.9.3, but not
|
221
226
|
# in 1.9.2 unless we define it like so.
|
222
227
|
# @private
|
223
228
|
def inject *args, &block
|
data/lib/aws/core/json_client.rb
CHANGED
@@ -18,7 +18,7 @@ module AWS
|
|
18
18
|
protected
|
19
19
|
|
20
20
|
def self.request_builder_for api_config, operation
|
21
|
-
JSONRequestBuilder.new(api_config
|
21
|
+
JSONRequestBuilder.new(api_config, operation)
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.response_parser_for api_config, operation
|
@@ -30,10 +30,9 @@ module AWS
|
|
30
30
|
response.http_response.status >= 300 and
|
31
31
|
body = response.http_response.body and
|
32
32
|
json = (::JSON.load(body) rescue nil) and
|
33
|
-
type = json["__type"]
|
34
|
-
matches = type.match(/\#(.*)$/)
|
33
|
+
type = json["__type"]
|
35
34
|
then
|
36
|
-
code =
|
35
|
+
code = type.split('#').last
|
37
36
|
if code == 'RequestEntityTooLarge'
|
38
37
|
message = 'Request body must be less than 1 MB'
|
39
38
|
else
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# Copyright 2011-2012 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 'json'
|
15
|
+
require 'time'
|
16
|
+
require 'bigdecimal'
|
17
|
+
require 'base64'
|
18
|
+
|
19
|
+
module AWS
|
20
|
+
module Core
|
21
|
+
|
22
|
+
# @private
|
23
|
+
class JSONParser
|
24
|
+
|
25
|
+
def initialize rules
|
26
|
+
@rules = rules
|
27
|
+
end
|
28
|
+
|
29
|
+
attr_reader :rules
|
30
|
+
|
31
|
+
def parse body
|
32
|
+
body = "{}" if [nil, ''].include?(body)
|
33
|
+
translate(JSON.load(body))
|
34
|
+
end
|
35
|
+
|
36
|
+
protected
|
37
|
+
|
38
|
+
# @param [Hash] values
|
39
|
+
# @param [Hash] rules
|
40
|
+
# @return [Hash]
|
41
|
+
def translate values, rules = @rules
|
42
|
+
rules.inject({}) do |data,(key,rule)|
|
43
|
+
if values.key?(key)
|
44
|
+
data.merge(rule[:sym] || key => translate_value(values[key], rule))
|
45
|
+
else
|
46
|
+
data
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def translate_hash values, rules
|
52
|
+
translate(values, rules[:members])
|
53
|
+
end
|
54
|
+
|
55
|
+
def translate_map values, rules
|
56
|
+
values.inject({}) do |data,(key,value)|
|
57
|
+
data.merge(key => translate_value(value, rules[:members]))
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def translate_value value, rule
|
62
|
+
case
|
63
|
+
when value.is_a?(Array) then value.map{|v| translate_value(v, rule) }
|
64
|
+
when rule[:type] == :hash then translate_hash(value, rule)
|
65
|
+
when rule[:type] == :map then translate_map(value, rule)
|
66
|
+
when rule[:type] == :blob then Base64.decode64(value)
|
67
|
+
when rule[:type] == :time then Time.at(value)
|
68
|
+
when rule[:type] == :big_decimal then BigDecimal.new(value)
|
69
|
+
else value
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
@@ -17,13 +17,14 @@ module AWS
|
|
17
17
|
# @private
|
18
18
|
class JSONRequestBuilder
|
19
19
|
|
20
|
-
def initialize
|
21
|
-
@x_amz_target = target_prefix + operation[:name]
|
20
|
+
def initialize api, operation
|
21
|
+
@x_amz_target = api[:target_prefix] + operation[:name]
|
22
|
+
@content_type = "application/x-amz-json-#{api[:json_version] || 1.0}"
|
22
23
|
@grammar = OptionGrammar.customize(operation[:inputs])
|
23
24
|
end
|
24
25
|
|
25
26
|
def populate_request request, options
|
26
|
-
request.headers["content-type"] =
|
27
|
+
request.headers["content-type"] = @content_type
|
27
28
|
request.headers["x-amz-target"] = @x_amz_target
|
28
29
|
request.body = @grammar.to_json(options)
|
29
30
|
end
|
@@ -44,8 +44,7 @@ module AWS
|
|
44
44
|
def translate values, rules = @rules
|
45
45
|
rules.inject({}) do |data,(key,rule)|
|
46
46
|
if values.key?(key)
|
47
|
-
|
48
|
-
data.merge(key => translate_value(values[key], rule))
|
47
|
+
data.merge(rule[:sym] || key => translate_value(values[key], rule))
|
49
48
|
else
|
50
49
|
data
|
51
50
|
end
|
@@ -65,7 +64,6 @@ module AWS
|
|
65
64
|
def translate_value value, rule
|
66
65
|
case
|
67
66
|
when value.is_a?(Array) then value.map{|v| translate_value(v, rule) }
|
68
|
-
#when rule[:list] then value.map{|v| translate_value(v, rule) }
|
69
67
|
when rule[:type] == :hash then translate_hash(value, rule)
|
70
68
|
when rule[:type] == :map then translate_map(value, rule)
|
71
69
|
when rule[:type] == :blob then Base64.decode64(value)
|