aws-sdk 1.1.3 → 1.1.4
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/ca-bundle.crt +2 -348
- data/lib/aws.rb +24 -49
- data/lib/aws/{common.rb → core.rb} +120 -9
- data/lib/aws/{api_config.rb → core/api_config.rb} +19 -20
- data/lib/aws/core/api_config_transform.rb +36 -0
- data/lib/aws/core/async_handle.rb +91 -0
- data/lib/aws/core/authorize_v2.rb +39 -0
- data/lib/aws/{authorize_v3.rb → core/authorize_v3.rb} +16 -15
- data/lib/aws/{api_config_transform.rb → core/authorize_with_session_token.rb} +9 -12
- data/lib/aws/core/autoloader.rb +64 -0
- data/lib/aws/core/cacheable.rb +78 -0
- data/lib/aws/core/client.rb +471 -0
- data/lib/aws/core/client_logging.rb +125 -0
- data/lib/aws/core/collections.rb +229 -0
- data/lib/aws/core/configuration.rb +358 -0
- data/lib/aws/core/configured_client_methods.rb +76 -0
- data/lib/aws/core/configured_grammars.rb +63 -0
- data/lib/aws/{configured_option_grammars.rb → core/configured_option_grammars.rb} +18 -20
- data/lib/aws/{configured_xml_grammars.rb → core/configured_xml_grammars.rb} +19 -21
- data/lib/aws/core/default_signer.rb +67 -0
- data/lib/aws/core/http/curb_handler.rb +129 -0
- data/lib/aws/core/http/handler.rb +77 -0
- data/lib/aws/core/http/httparty_handler.rb +113 -0
- data/lib/aws/core/http/net_http_handler.rb +124 -0
- data/lib/aws/core/http/request.rb +207 -0
- data/lib/aws/core/http/response.rb +73 -0
- data/lib/aws/{ignore_result_element.rb → core/ignore_result_element.rb} +14 -18
- data/lib/aws/core/indifferent_hash.rb +88 -0
- data/lib/aws/core/inflection.rb +47 -0
- data/lib/aws/core/lazy_error_classes.rb +62 -0
- data/lib/aws/{uri_escape.rb → core/meta_utils.rb} +24 -23
- data/lib/aws/core/model.rb +57 -0
- data/lib/aws/{authorize_with_session_token.rb → core/naming.rb} +9 -8
- data/lib/aws/core/option_grammar.rb +562 -0
- data/lib/aws/core/policy.rb +914 -0
- data/lib/aws/core/resource.rb +380 -0
- data/lib/aws/core/resource_cache.rb +40 -0
- data/lib/aws/core/response.rb +125 -0
- data/lib/aws/core/response_cache.rb +50 -0
- data/lib/aws/core/service_interface.rb +60 -0
- data/lib/aws/core/uri_escape.rb +46 -0
- data/lib/aws/core/xml_grammar.rb +926 -0
- data/lib/aws/ec2.rb +47 -16
- data/lib/aws/ec2/attachment.rb +0 -2
- data/lib/aws/ec2/attachment_collection.rb +1 -6
- data/lib/aws/ec2/availability_zone.rb +0 -2
- data/lib/aws/ec2/availability_zone_collection.rb +0 -3
- data/lib/aws/ec2/client.rb +6 -9
- data/lib/aws/ec2/client/xml.rb +3 -6
- data/lib/aws/ec2/collection.rb +1 -4
- data/lib/aws/ec2/config.rb +18 -0
- data/lib/aws/ec2/elastic_ip.rb +0 -2
- data/lib/aws/ec2/elastic_ip_collection.rb +0 -4
- data/lib/aws/ec2/errors.rb +1 -4
- data/lib/aws/ec2/has_permissions.rb +0 -2
- data/lib/aws/ec2/image.rb +0 -5
- data/lib/aws/ec2/image_collection.rb +0 -6
- data/lib/aws/ec2/instance.rb +23 -9
- data/lib/aws/ec2/instance_collection.rb +85 -22
- data/lib/aws/ec2/key_pair.rb +0 -2
- data/lib/aws/ec2/key_pair_collection.rb +1 -4
- data/lib/aws/ec2/permission_collection.rb +2 -5
- data/lib/aws/ec2/region.rb +0 -2
- data/lib/aws/ec2/region_collection.rb +0 -4
- data/lib/aws/ec2/request.rb +4 -9
- data/lib/aws/ec2/reserved_instances.rb +0 -3
- data/lib/aws/ec2/reserved_instances_collection.rb +0 -4
- data/lib/aws/ec2/reserved_instances_offering.rb +0 -3
- data/lib/aws/ec2/reserved_instances_offering_collection.rb +0 -4
- data/lib/aws/ec2/resource.rb +3 -5
- data/lib/aws/ec2/resource_tag_collection.rb +1 -6
- data/lib/aws/ec2/security_group.rb +204 -72
- data/lib/aws/ec2/security_group/egress_ip_permission_collection.rb +53 -0
- data/lib/aws/ec2/security_group/ip_permission.rb +92 -10
- data/lib/aws/ec2/security_group/ip_permission_collection.rb +14 -15
- data/lib/aws/ec2/security_group_collection.rb +11 -8
- data/lib/aws/ec2/snapshot.rb +0 -4
- data/lib/aws/ec2/snapshot_collection.rb +0 -4
- data/lib/aws/ec2/tag.rb +0 -3
- data/lib/aws/ec2/tag_collection.rb +1 -8
- data/lib/aws/ec2/tagged_item.rb +1 -3
- data/lib/aws/ec2/volume.rb +0 -6
- data/lib/aws/ec2/volume_collection.rb +0 -4
- data/lib/aws/errors.rb +0 -3
- data/lib/aws/iam.rb +33 -12
- data/lib/aws/iam/access_key.rb +0 -3
- data/lib/aws/iam/access_key_collection.rb +0 -3
- data/lib/aws/iam/account_alias_collection.rb +0 -2
- data/lib/aws/iam/client.rb +6 -8
- data/lib/aws/iam/client/xml.rb +4 -8
- data/lib/aws/iam/collection.rb +2 -5
- data/lib/aws/iam/config.rb +18 -0
- data/lib/aws/iam/errors.rb +2 -4
- data/lib/aws/iam/group.rb +0 -5
- data/lib/aws/iam/group_collection.rb +0 -3
- data/lib/aws/iam/group_policy_collection.rb +0 -2
- data/lib/aws/iam/group_user_collection.rb +1 -4
- data/lib/aws/iam/login_profile.rb +0 -2
- data/lib/aws/iam/mfa_device.rb +1 -3
- data/lib/aws/iam/mfa_device_collection.rb +0 -3
- data/lib/aws/iam/policy.rb +2 -4
- data/lib/aws/iam/policy_collection.rb +0 -3
- data/lib/aws/iam/request.rb +3 -7
- data/lib/aws/iam/resource.rb +1 -4
- data/lib/aws/iam/server_certificate.rb +0 -2
- data/lib/aws/iam/server_certificate_collection.rb +0 -3
- data/lib/aws/iam/signing_certificate.rb +0 -2
- data/lib/aws/iam/signing_certificate_collection.rb +0 -3
- data/lib/aws/iam/user.rb +0 -7
- data/lib/aws/iam/user_collection.rb +0 -3
- data/lib/aws/iam/user_group_collection.rb +0 -3
- data/lib/aws/iam/user_policy.rb +0 -2
- data/lib/aws/iam/user_policy_collection.rb +0 -3
- data/lib/aws/rails.rb +5 -4
- data/lib/aws/record.rb +4 -1
- data/lib/aws/record/base.rb +3 -2
- data/lib/aws/record/errors.rb +1 -3
- data/lib/aws/s3.rb +31 -6
- data/lib/aws/s3/access_control_list.rb +0 -2
- data/lib/aws/s3/acl_object.rb +10 -12
- data/lib/aws/s3/bucket.rb +1 -9
- data/lib/aws/s3/bucket_collection.rb +2 -5
- data/lib/aws/s3/bucket_version_collection.rb +1 -5
- data/lib/aws/s3/client.rb +34 -37
- data/lib/aws/s3/client/xml.rb +11 -14
- data/lib/aws/{resource_cache.rb → s3/config.rb} +6 -20
- data/lib/aws/s3/errors.rb +6 -7
- data/lib/aws/s3/multipart_upload.rb +1 -4
- data/lib/aws/s3/multipart_upload_collection.rb +1 -6
- data/lib/aws/s3/object_collection.rb +1 -5
- data/lib/aws/s3/object_metadata.rb +1 -3
- data/lib/aws/s3/object_upload_collection.rb +1 -7
- data/lib/aws/s3/object_version.rb +1 -4
- data/lib/aws/s3/object_version_collection.rb +1 -4
- data/lib/aws/s3/policy.rb +3 -5
- data/lib/aws/s3/prefix_and_delimiter_collection.rb +0 -2
- data/lib/aws/s3/prefixed_collection.rb +0 -2
- data/lib/aws/s3/presigned_post.rb +1 -3
- data/lib/aws/s3/request.rb +2 -5
- data/lib/aws/s3/s3_object.rb +1 -8
- data/lib/aws/s3/tree.rb +8 -6
- data/lib/aws/s3/tree/branch_node.rb +0 -3
- data/lib/aws/s3/tree/child_collection.rb +1 -5
- data/lib/aws/s3/tree/leaf_node.rb +0 -5
- data/lib/aws/s3/tree/parent.rb +1 -4
- data/lib/aws/s3/uploaded_part.rb +1 -3
- data/lib/aws/s3/uploaded_part_collection.rb +1 -5
- data/lib/aws/simple_db.rb +21 -6
- data/lib/aws/simple_db/attribute.rb +1 -6
- data/lib/aws/simple_db/attribute_collection.rb +1 -7
- data/lib/aws/simple_db/client.rb +7 -9
- data/lib/aws/simple_db/client/options.rb +2 -4
- data/lib/aws/simple_db/client/xml.rb +5 -10
- data/lib/aws/{naming.rb → simple_db/config.rb} +3 -14
- data/lib/aws/simple_db/delete_attributes.rb +0 -2
- data/lib/aws/simple_db/domain.rb +1 -6
- data/lib/aws/simple_db/domain_collection.rb +1 -4
- data/lib/aws/simple_db/domain_metadata.rb +1 -3
- data/lib/aws/simple_db/errors.rb +1 -4
- data/lib/aws/simple_db/item.rb +1 -7
- data/lib/aws/simple_db/item_collection.rb +22 -23
- data/lib/aws/simple_db/put_attributes.rb +0 -2
- data/lib/aws/simple_db/request.rb +3 -7
- data/lib/aws/simple_email_service.rb +11 -6
- data/lib/aws/simple_email_service/client.rb +7 -9
- data/lib/aws/simple_email_service/client/options.rb +3 -6
- data/lib/aws/simple_email_service/client/xml.rb +4 -8
- data/lib/aws/simple_email_service/config.rb +19 -0
- data/lib/aws/simple_email_service/email_address_collection.rb +1 -3
- data/lib/aws/simple_email_service/errors.rb +1 -4
- data/lib/aws/simple_email_service/quotas.rb +1 -3
- data/lib/aws/simple_email_service/request.rb +3 -7
- data/lib/aws/sns.rb +15 -8
- data/lib/aws/sns/client.rb +7 -8
- data/lib/aws/sns/client/options.rb +3 -6
- data/lib/aws/sns/client/xml.rb +4 -8
- data/lib/aws/sns/config.rb +18 -0
- data/lib/aws/sns/errors.rb +1 -4
- data/lib/aws/sns/policy.rb +3 -5
- data/lib/aws/sns/request.rb +4 -9
- data/lib/aws/sns/subscription.rb +1 -5
- data/lib/aws/sns/subscription_collection.rb +1 -5
- data/lib/aws/sns/topic.rb +1 -6
- data/lib/aws/sns/topic_collection.rb +1 -4
- data/lib/aws/sns/topic_subscription_collection.rb +1 -4
- data/lib/aws/sqs.rb +14 -5
- data/lib/aws/sqs/client.rb +6 -9
- data/lib/aws/sqs/client/xml.rb +4 -7
- data/lib/aws/sqs/config.rb +18 -0
- data/lib/aws/sqs/errors.rb +1 -4
- data/lib/aws/sqs/policy.rb +3 -5
- data/lib/aws/sqs/queue.rb +2 -7
- data/lib/aws/sqs/queue_collection.rb +4 -5
- data/lib/aws/sqs/received_message.rb +1 -3
- data/lib/aws/sqs/received_sns_message.rb +2 -2
- data/lib/aws/sqs/request.rb +4 -7
- data/lib/aws/sts.rb +12 -6
- data/lib/aws/sts/client.rb +6 -8
- data/lib/aws/sts/client/xml.rb +4 -8
- data/lib/aws/sts/config.rb +18 -0
- data/lib/aws/sts/errors.rb +1 -4
- data/lib/aws/sts/federated_session.rb +0 -2
- data/lib/aws/sts/policy.rb +3 -5
- data/lib/aws/sts/request.rb +3 -7
- metadata +60 -50
- data/lib/aws/async_handle.rb +0 -90
- data/lib/aws/authorize_v2.rb +0 -37
- data/lib/aws/base_client.rb +0 -488
- data/lib/aws/cacheable.rb +0 -79
- data/lib/aws/client_logging.rb +0 -122
- data/lib/aws/collections.rb +0 -230
- data/lib/aws/configuration.rb +0 -357
- data/lib/aws/configured_client_methods.rb +0 -81
- data/lib/aws/configured_grammars.rb +0 -65
- data/lib/aws/default_signer.rb +0 -65
- data/lib/aws/http/curb_handler.rb +0 -127
- data/lib/aws/http/handler.rb +0 -77
- data/lib/aws/http/httparty_handler.rb +0 -103
- data/lib/aws/http/request.rb +0 -165
- data/lib/aws/http/request_param.rb +0 -64
- data/lib/aws/http/response.rb +0 -72
- data/lib/aws/indifferent_hash.rb +0 -86
- data/lib/aws/inflection.rb +0 -46
- data/lib/aws/lazy_error_classes.rb +0 -64
- data/lib/aws/meta_utils.rb +0 -43
- data/lib/aws/model.rb +0 -57
- data/lib/aws/option_grammar.rb +0 -565
- data/lib/aws/policy.rb +0 -914
- data/lib/aws/resource.rb +0 -381
- data/lib/aws/response.rb +0 -125
- data/lib/aws/response_cache.rb +0 -50
- data/lib/aws/service_interface.rb +0 -60
- data/lib/aws/xml_grammar.rb +0 -925
|
@@ -11,15 +11,111 @@
|
|
|
11
11
|
# ANY KIND, either express or implied. See the License for the specific
|
|
12
12
|
# language governing permissions and limitations under the License.
|
|
13
13
|
|
|
14
|
-
require 'aws/
|
|
15
|
-
require 'aws/resource_cache'
|
|
16
|
-
require 'aws/response_cache'
|
|
14
|
+
require 'aws/core/autoloader'
|
|
17
15
|
|
|
18
|
-
#
|
|
16
|
+
# AWS is the root module for all of the Amazon Web Services. It is also
|
|
17
|
+
# where you can configure you access to AWS.
|
|
18
|
+
#
|
|
19
|
+
# = Supported Services
|
|
20
|
+
#
|
|
21
|
+
# The currently supported services are:
|
|
22
|
+
#
|
|
23
|
+
# * {EC2}
|
|
24
|
+
# * {S3}
|
|
25
|
+
# * {SimpleDB}
|
|
26
|
+
# * {SimpleEmailService}
|
|
27
|
+
# * {SNS}
|
|
28
|
+
# * {SQS}
|
|
29
|
+
# * {IAM}
|
|
30
|
+
#
|
|
31
|
+
# = AWS::Record
|
|
32
|
+
#
|
|
33
|
+
# In addition to the above services, bundled is an ORM based on AWS services
|
|
34
|
+
# See {AWS::Record} for more information.
|
|
35
|
+
#
|
|
36
|
+
# = Configuration
|
|
37
|
+
#
|
|
38
|
+
# You call {AWS.config} with a hash of options to configure your
|
|
39
|
+
# access to the Amazon Web Services.
|
|
40
|
+
#
|
|
41
|
+
# At a minimum you need to set your access credentials. See {AWS.config}
|
|
42
|
+
# for additional configuration options.
|
|
43
|
+
#
|
|
44
|
+
# AWS.config(
|
|
45
|
+
# :access_key_id => 'ACCESS_KEY_ID',
|
|
46
|
+
# :secret_access_key => 'SECRET_ACCESS_KEY')
|
|
47
|
+
#
|
|
48
|
+
# == Rails
|
|
49
|
+
#
|
|
50
|
+
# If you are loading AWS inside a Rails web application, it is recomended to
|
|
51
|
+
# place your configuration inside:
|
|
52
|
+
#
|
|
53
|
+
# config/initializers/aws.rb
|
|
54
|
+
#
|
|
19
55
|
module AWS
|
|
20
56
|
|
|
21
57
|
# Current version of the AWS SDK for Ruby
|
|
22
|
-
VERSION = "1.1.
|
|
58
|
+
VERSION = "1.1.4"
|
|
59
|
+
|
|
60
|
+
register_autoloads(self) do
|
|
61
|
+
autoload :Errors, 'errors'
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
module Core
|
|
65
|
+
|
|
66
|
+
AWS.register_autoloads(self) do
|
|
67
|
+
autoload :ApiConfig, 'api_config'
|
|
68
|
+
autoload :ApiConfigTransform, 'api_config_transform'
|
|
69
|
+
autoload :AsyncHandle, 'async_handle'
|
|
70
|
+
autoload :AuthorizeV2, 'authorize_v2'
|
|
71
|
+
autoload :AuthorizeV3, 'authorize_v3'
|
|
72
|
+
autoload :AuthorizeWithSessionToken, 'authorize_with_session_token'
|
|
73
|
+
autoload :Cacheable, 'cacheable'
|
|
74
|
+
autoload :Client, 'client'
|
|
75
|
+
autoload :ClientLogging, 'client_logging'
|
|
76
|
+
autoload :Collections, 'collections'
|
|
77
|
+
autoload :Configuration, 'configuration'
|
|
78
|
+
autoload :ConfiguredClientMethods, 'configured_client_methods'
|
|
79
|
+
autoload :ConfiguredGrammars, 'configured_grammars'
|
|
80
|
+
autoload :ConfiguredOptionGrammars, 'configured_option_grammars'
|
|
81
|
+
autoload :ConfiguredXmlGrammars, 'configured_xml_grammars'
|
|
82
|
+
autoload :DefaultSigner, 'default_signer'
|
|
83
|
+
autoload :IgnoreResultElement, 'ignore_result_element'
|
|
84
|
+
autoload :IndifferentHash, 'indifferent_hash'
|
|
85
|
+
autoload :Inflection, 'inflection'
|
|
86
|
+
autoload :LazyErrorClasses, 'lazy_error_classes'
|
|
87
|
+
autoload :MetaUtils, 'meta_utils'
|
|
88
|
+
autoload :Model, 'model'
|
|
89
|
+
autoload :Naming, 'naming'
|
|
90
|
+
autoload :OptionGrammar, 'option_grammar'
|
|
91
|
+
autoload :Policy, 'policy'
|
|
92
|
+
autoload :Resource, 'resource'
|
|
93
|
+
autoload :ResourceCache, 'resource_cache'
|
|
94
|
+
autoload :Response, 'response'
|
|
95
|
+
autoload :ResponseCache, 'response_cache'
|
|
96
|
+
autoload :ServiceInterface, 'service_interface'
|
|
97
|
+
autoload :UriEscape, 'uri_escape'
|
|
98
|
+
autoload :XmlGrammar, 'xml_grammar'
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
module Http
|
|
102
|
+
AWS.register_autoloads(self) do
|
|
103
|
+
autoload :Handler, 'handler'
|
|
104
|
+
autoload :NetHttpHandler, 'net_http_handler'
|
|
105
|
+
autoload :HTTPartyHandler, 'httparty_handler' # non-standard inflection
|
|
106
|
+
autoload :Request, 'request'
|
|
107
|
+
autoload :Response, 'response'
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# the http party handler should still be accessible from its old namespace
|
|
114
|
+
module Http
|
|
115
|
+
AWS.register_autoloads(self, 'aws/core/http') do
|
|
116
|
+
autoload :HTTPartyHandler, 'httparty_handler'
|
|
117
|
+
end
|
|
118
|
+
end
|
|
23
119
|
|
|
24
120
|
class << self
|
|
25
121
|
|
|
@@ -147,9 +243,9 @@ module AWS
|
|
|
147
243
|
# append to all requets against AWS services. This should be set
|
|
148
244
|
# for clients and applications built ontop of the aws-sdk gem.
|
|
149
245
|
#
|
|
150
|
-
# @return [Configuration] Returns the new configuration.
|
|
246
|
+
# @return [Core::Configuration] Returns the new configuration.
|
|
151
247
|
def config options = {}
|
|
152
|
-
@@config ||= Configuration.new
|
|
248
|
+
@@config ||= Core::Configuration.new
|
|
153
249
|
@@config = @@config.with(options) unless options.empty?
|
|
154
250
|
@@config
|
|
155
251
|
end
|
|
@@ -255,7 +351,7 @@ module AWS
|
|
|
255
351
|
def resource_cache
|
|
256
352
|
if memoizing?
|
|
257
353
|
Thread.current[:aws_memoization][:resource_cache] ||=
|
|
258
|
-
ResourceCache.new
|
|
354
|
+
Core::ResourceCache.new
|
|
259
355
|
end
|
|
260
356
|
end
|
|
261
357
|
|
|
@@ -263,10 +359,25 @@ module AWS
|
|
|
263
359
|
def response_cache
|
|
264
360
|
if memoizing?
|
|
265
361
|
Thread.current[:aws_memoization][:response_cache] ||=
|
|
266
|
-
ResponseCache.new
|
|
362
|
+
Core::ResponseCache.new
|
|
267
363
|
end
|
|
268
364
|
end
|
|
269
365
|
|
|
366
|
+
def add_service name, ruby_name, default_endpoint
|
|
367
|
+
|
|
368
|
+
create_block = lambda do |config|
|
|
369
|
+
AWS.const_get(name)::Client.new(:config => config)
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
needs = [:signer, :http_handler, :"#{ruby_name}_endpoint"]
|
|
373
|
+
|
|
374
|
+
Core::Configuraiton.add_option :"#{ruby_name}_endpoint", default_endpoint
|
|
375
|
+
|
|
376
|
+
Core::Configuraiton.add_option_with_needs(
|
|
377
|
+
:"#{ruby_name}_client", needs, &create_block)
|
|
378
|
+
|
|
379
|
+
end
|
|
380
|
+
|
|
270
381
|
# Causes all requests to return empty responses without making any
|
|
271
382
|
# requests against the live services. This does not attempt to
|
|
272
383
|
# mock the services.
|
|
@@ -11,35 +11,34 @@
|
|
|
11
11
|
# ANY KIND, either express or implied. See the License for the specific
|
|
12
12
|
# language governing permissions and limitations under the License.
|
|
13
13
|
|
|
14
|
-
require 'aws/naming'
|
|
15
|
-
|
|
16
|
-
require 'pathname'
|
|
17
14
|
require 'yaml'
|
|
15
|
+
require 'pathname'
|
|
18
16
|
|
|
19
17
|
module AWS
|
|
18
|
+
module Core
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
# @private
|
|
21
|
+
module ApiConfig
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
include Naming
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
protected
|
|
26
|
+
def api_config
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
config_file = $:.map do |load_path|
|
|
29
|
+
if config_dir = Pathname.new(load_path) +
|
|
30
|
+
"aws" + "api_config" and
|
|
31
|
+
config_dir.directory?
|
|
32
|
+
config_dir.children.select do |child|
|
|
33
|
+
child.basename.to_s =~ /^#{service_name}/
|
|
34
|
+
end.sort.last
|
|
35
|
+
end
|
|
36
|
+
end.compact.sort.last
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
YAML.load(config_file.read)
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
end
|
|
42
41
|
|
|
42
|
+
end
|
|
43
43
|
end
|
|
44
|
-
|
|
45
44
|
end
|
|
@@ -0,0 +1,36 @@
|
|
|
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 'yaml'
|
|
15
|
+
|
|
16
|
+
module AWS
|
|
17
|
+
module Core
|
|
18
|
+
|
|
19
|
+
# @private
|
|
20
|
+
class ApiConfigTransform
|
|
21
|
+
|
|
22
|
+
def self.rename_input_list_to_membered_list api_config
|
|
23
|
+
api_config[:operations].each_pair do |name,customizations|
|
|
24
|
+
|
|
25
|
+
input = api_config[:operations][name][:input]
|
|
26
|
+
fixed_input = input.to_yaml.gsub(/:list:/, ':membered_list:')
|
|
27
|
+
|
|
28
|
+
api_config[:operations][name][:input] = YAML.load(fixed_input)
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
api_config
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
module AWS
|
|
15
|
+
module Core
|
|
16
|
+
|
|
17
|
+
# Mixin that provides a generic callback facility for asynchronous
|
|
18
|
+
# tasks that can either succeed or fail.
|
|
19
|
+
# @private
|
|
20
|
+
module AsyncHandle
|
|
21
|
+
|
|
22
|
+
# Called to signal success and fire off the success and complete callbacks.
|
|
23
|
+
def signal_success
|
|
24
|
+
__send_signal(:success)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Called to signal failure and fire off the failure and complete callbacks.
|
|
28
|
+
def signal_failure
|
|
29
|
+
__send_signal(:failure)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Registers a callback to be called on successful completion of
|
|
33
|
+
# the task.
|
|
34
|
+
#
|
|
35
|
+
# handle.on_success { puts "It worked!" }
|
|
36
|
+
#
|
|
37
|
+
# If this is called when the task has already completed
|
|
38
|
+
# successfully, it will call the callback immediately.
|
|
39
|
+
def on_success(&blk)
|
|
40
|
+
if @_async_status == :success
|
|
41
|
+
blk.call
|
|
42
|
+
else
|
|
43
|
+
(@_async_callbacks ||= []) << { :success => blk }
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Registers a callback to be called when the task fails.
|
|
48
|
+
#
|
|
49
|
+
# handle.on_failure { puts "It didn't work!" }
|
|
50
|
+
#
|
|
51
|
+
# If this is called when the task has already failed, it will
|
|
52
|
+
# call the callback immediately.
|
|
53
|
+
def on_failure(&blk)
|
|
54
|
+
if @_async_status == :failure
|
|
55
|
+
blk.call
|
|
56
|
+
else
|
|
57
|
+
(@_async_callbacks ||= []) << { :failure => blk }
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Registers a callback to be called when the task is complete,
|
|
62
|
+
# regardless of its status. Yields the status to the block.
|
|
63
|
+
#
|
|
64
|
+
# handle.on_complete do |status|
|
|
65
|
+
# puts "It #{status == :success ? 'did' : 'did not'} work!"
|
|
66
|
+
# end
|
|
67
|
+
#
|
|
68
|
+
# If this is called when the task has already completed, it will
|
|
69
|
+
# call the callback immediately.
|
|
70
|
+
def on_complete(&blk)
|
|
71
|
+
if !@_async_status.nil?
|
|
72
|
+
blk.call(@_async_status)
|
|
73
|
+
else
|
|
74
|
+
(@_async_callbacks ||= []) << {
|
|
75
|
+
:failure => lambda { blk.call(:failure) },
|
|
76
|
+
:success => lambda { blk.call(:success) }
|
|
77
|
+
}
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
private
|
|
82
|
+
def __send_signal(kind)
|
|
83
|
+
@_async_status = kind
|
|
84
|
+
@_async_callbacks.map do |cb|
|
|
85
|
+
cb[kind]
|
|
86
|
+
end.compact.each { |blk| blk.call } if @_async_callbacks
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
module AWS
|
|
15
|
+
module Core
|
|
16
|
+
|
|
17
|
+
# Mixed into clients that use v2 authorization.
|
|
18
|
+
# @private
|
|
19
|
+
module AuthorizeV2
|
|
20
|
+
|
|
21
|
+
def string_to_sign
|
|
22
|
+
parts = [http_method,
|
|
23
|
+
host,
|
|
24
|
+
path,
|
|
25
|
+
params.sort.collect { |p| p.encoded }.join('&')]
|
|
26
|
+
parts.join("\n")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def add_authorization! signer
|
|
30
|
+
self.access_key_id = signer.access_key_id
|
|
31
|
+
add_param('AWSAccessKeyId', access_key_id)
|
|
32
|
+
add_param('SignatureVersion', '2')
|
|
33
|
+
add_param('SignatureMethod', 'HmacSHA256')
|
|
34
|
+
add_param('Signature', signer.sign(string_to_sign))
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -11,27 +11,28 @@
|
|
|
11
11
|
# ANY KIND, either express or implied. See the License for the specific
|
|
12
12
|
# language governing permissions and limitations under the License.
|
|
13
13
|
|
|
14
|
-
require 'base64'
|
|
15
14
|
require 'time'
|
|
16
15
|
|
|
17
16
|
module AWS
|
|
17
|
+
module Core
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
# Mixed into clients that use v3 authorization.
|
|
20
|
+
# @private
|
|
21
|
+
module AuthorizeV3
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
def string_to_sign
|
|
24
|
+
headers['date'] ||= Time.now.rfc822
|
|
25
|
+
end
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
def add_authorization! signer
|
|
28
|
+
self.access_key_id = signer.access_key_id
|
|
29
|
+
parts = []
|
|
30
|
+
parts << "AWS3-HTTPS AWSAccessKeyId=#{access_key_id}"
|
|
31
|
+
parts << "Algorithm=HmacSHA256"
|
|
32
|
+
parts << "Signature=#{signer.sign(string_to_sign)}"
|
|
33
|
+
headers['x-amzn-authorization'] = parts.join(',')
|
|
34
|
+
end
|
|
35
35
|
|
|
36
|
+
end
|
|
36
37
|
end
|
|
37
38
|
end
|
|
@@ -12,21 +12,18 @@
|
|
|
12
12
|
# language governing permissions and limitations under the License.
|
|
13
13
|
|
|
14
14
|
module AWS
|
|
15
|
+
module Core
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def self.rename_input_list_to_membered_list api_config
|
|
20
|
-
api_config[:operations].each_pair do |name,customizations|
|
|
21
|
-
|
|
22
|
-
input = api_config[:operations][name][:input]
|
|
23
|
-
fixed_input = input.to_yaml.gsub(/:list:/, ':membered_list:')
|
|
24
|
-
|
|
25
|
-
api_config[:operations][name][:input] = YAML.load(fixed_input)
|
|
17
|
+
# @private
|
|
18
|
+
module AuthorizeWithSessionToken
|
|
26
19
|
|
|
20
|
+
def add_authorization! signer
|
|
21
|
+
if signer.respond_to?(:session_token) and token = signer.session_token
|
|
22
|
+
add_param("SecurityToken", token)
|
|
23
|
+
end
|
|
24
|
+
super
|
|
27
25
|
end
|
|
28
|
-
api_config
|
|
29
|
-
end
|
|
30
26
|
|
|
27
|
+
end
|
|
31
28
|
end
|
|
32
29
|
end
|