aws-sdk 1.5.8 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/aws.rb +2 -0
- data/lib/aws/api_config/Route53-2012-02-29.yml +348 -0
- data/lib/aws/auto_scaling/client.rb +362 -588
- data/lib/aws/cloud_formation/client.rb +155 -224
- data/lib/aws/cloud_watch/client.rb +156 -229
- data/lib/aws/core.rb +67 -52
- data/lib/aws/core/client.rb +81 -82
- data/lib/aws/core/collection/with_limit_and_next_token.rb +2 -2
- data/lib/aws/core/configuration.rb +75 -72
- data/lib/aws/core/http/net_http_handler.rb +3 -3
- data/lib/aws/core/http/request.rb +107 -138
- data/lib/aws/core/inflection.rb +3 -3
- data/lib/aws/core/json_client.rb +106 -0
- data/lib/aws/core/option_grammar.rb +10 -1
- data/lib/aws/core/options/validator.rb +140 -0
- data/lib/aws/core/options/xml_serializer.rb +98 -0
- data/lib/aws/core/query_client.rb +131 -0
- data/lib/aws/core/rest_client.rb +90 -0
- data/lib/aws/core/rest_client/input_handler.rb +145 -0
- data/lib/aws/core/rest_client/output_handler.rb +43 -0
- data/lib/aws/core/signature/version_2.rb +7 -7
- data/lib/aws/core/signature/version_3.rb +5 -1
- data/lib/aws/core/signature/version_3_https.rb +51 -0
- data/lib/aws/core/signature/version_4.rb +5 -22
- data/lib/aws/core/signer.rb +1 -1
- data/lib/aws/core/uri_escape.rb +2 -0
- data/lib/aws/core/xml/frame.rb +8 -8
- data/lib/aws/core/xml/grammar.rb +8 -3
- data/lib/aws/dynamo_db/client.rb +600 -662
- data/lib/aws/ec2/client.rb +2688 -3492
- data/lib/aws/ec2/request.rb +0 -1
- data/lib/aws/elb/client.rb +280 -407
- data/lib/aws/emr/client.rb +7 -7
- data/lib/aws/iam/client.rb +822 -1268
- data/lib/aws/route_53.rb +71 -0
- data/lib/aws/route_53/client.rb +272 -0
- data/lib/aws/route_53/config.rb +18 -0
- data/lib/aws/route_53/errors.rb +22 -0
- data/lib/aws/route_53/request.rb +23 -0
- data/lib/aws/s3/object_version_collection.rb +6 -6
- data/lib/aws/s3/paginated_collection.rb +1 -1
- data/lib/aws/s3/request.rb +10 -5
- data/lib/aws/simple_db/client.rb +184 -234
- data/lib/aws/simple_email_service/client.rb +147 -238
- data/lib/aws/simple_workflow/client.rb +997 -1191
- data/lib/aws/sns/client.rb +176 -264
- data/lib/aws/sqs/client.rb +162 -253
- data/lib/aws/sqs/queue.rb +1 -1
- data/lib/aws/sqs/request.rb +4 -0
- data/lib/aws/sts/client.rb +57 -66
- metadata +95 -71
- data/lib/aws/core/client/query_json.rb +0 -112
- data/lib/aws/core/client/query_xml.rb +0 -122
@@ -1,122 +0,0 @@
|
|
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
|
-
module Core
|
16
|
-
class Client
|
17
|
-
|
18
|
-
# When a client class extends this module, its API configuration
|
19
|
-
# is parsed. For each operation in the API configuration, one
|
20
|
-
# client method is added.
|
21
|
-
#
|
22
|
-
# Clients extending QueryXML all have in common their method
|
23
|
-
# of serializing request (input) paramters and parsing response
|
24
|
-
# (output) XML.
|
25
|
-
#
|
26
|
-
module QueryXML
|
27
|
-
|
28
|
-
# @private
|
29
|
-
def self.extended base
|
30
|
-
base.send(:include, ErrorParser)
|
31
|
-
base.send(:define_parsers)
|
32
|
-
end
|
33
|
-
|
34
|
-
# @return [Hash<Symbol,OptionGrammar>] Returns a hash option
|
35
|
-
# parsers. Hash keys are client method names and hash
|
36
|
-
# values are {OptionGrammar} objects.
|
37
|
-
# @private
|
38
|
-
def option_parsers
|
39
|
-
@option_parsers ||= {}
|
40
|
-
end
|
41
|
-
|
42
|
-
# @return [Hash<Symbol,XML::Parser>] Returns a hash of xml
|
43
|
-
# parsers. Hash keys are client method names and hash
|
44
|
-
# values are {XML::Parser} objects.
|
45
|
-
# @private
|
46
|
-
def xml_parsers
|
47
|
-
@xml_parsers ||= {}
|
48
|
-
end
|
49
|
-
|
50
|
-
protected
|
51
|
-
|
52
|
-
# Enumerates through the operations specified in the API
|
53
|
-
# configuration (yaml configuration file found in lib/api_config/)
|
54
|
-
# and defines one request method per operation.
|
55
|
-
def define_parsers
|
56
|
-
api_config[:operations].each do |op|
|
57
|
-
|
58
|
-
method_name = op[:method]
|
59
|
-
|
60
|
-
option_parsers[method_name] = OptionGrammar.customize(op[:inputs])
|
61
|
-
xml_parsers[method_name] = XML::Parser.new(op[:outputs])
|
62
|
-
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def define_client_method method_name, operation_name
|
67
|
-
add_client_request_method(method_name) do
|
68
|
-
|
69
|
-
configure_request do |request, options|
|
70
|
-
|
71
|
-
now = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ')
|
72
|
-
|
73
|
-
request.headers['Content-Type'] =
|
74
|
-
'application/x-www-form-urlencoded; charset=utf-8'
|
75
|
-
|
76
|
-
request.http_method = 'POST'
|
77
|
-
request.add_param 'Timestamp', now
|
78
|
-
request.add_param 'Version', self.class::API_VERSION
|
79
|
-
request.add_param 'Action', operation_name
|
80
|
-
|
81
|
-
parser = self.class.option_parsers[method_name]
|
82
|
-
parser.request_params(options).each do |param|
|
83
|
-
request.add_param(param)
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
87
|
-
|
88
|
-
process_response do |response|
|
89
|
-
parser = self.class.xml_parsers[method_name]
|
90
|
-
response.data = parser.parse(response.http_response.body)
|
91
|
-
end
|
92
|
-
|
93
|
-
simulate_response do |response|
|
94
|
-
parser = self.class.xml_parsers[method_name]
|
95
|
-
response.data = parser.simulate
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
module ErrorParser
|
102
|
-
|
103
|
-
protected
|
104
|
-
|
105
|
-
def extract_error_details response
|
106
|
-
if
|
107
|
-
response.http_response.status >= 300 and
|
108
|
-
body = response.http_response.body and
|
109
|
-
error = errors_module::GRAMMAR.parse(body) and
|
110
|
-
error[:code]
|
111
|
-
then
|
112
|
-
[error[:code], error[:message]]
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
end
|
117
|
-
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|