aws-sdk 1.4.1 → 1.5.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/.yardopts +0 -1
- data/lib/aws/api_config/AutoScaling-2011-01-01.yml +772 -544
- data/lib/aws/api_config/CloudFormation-2010-05-15.yml +284 -185
- data/lib/aws/api_config/DynamoDB-2011-12-05.yml +458 -738
- data/lib/aws/api_config/EC2-2011-12-15.yml +3502 -2653
- data/lib/aws/api_config/ELB-2011-08-15.yml +484 -352
- data/lib/aws/api_config/IAM-2010-05-08.yml +899 -711
- data/lib/aws/api_config/SNS-2010-03-31.yml +235 -167
- data/lib/aws/api_config/SQS-2011-10-01.yml +290 -251
- data/lib/aws/api_config/STS-2011-06-15.yml +35 -41
- data/lib/aws/api_config/SimpleDB-2009-04-15.yml +290 -263
- data/lib/aws/api_config/SimpleEmailService-2010-12-01.yml +144 -130
- data/lib/aws/api_config/SimpleWorkflow-2012-01-25.yml +697 -1139
- data/lib/aws/auto_scaling/activity_collection.rb +1 -1
- data/lib/aws/auto_scaling/client.rb +724 -9
- data/lib/aws/auto_scaling/errors.rb +1 -5
- data/lib/aws/auto_scaling/group.rb +1 -1
- data/lib/aws/auto_scaling/group_collection.rb +1 -1
- data/lib/aws/auto_scaling/instance_collection.rb +1 -1
- data/lib/aws/auto_scaling/launch_configuration.rb +1 -1
- data/lib/aws/auto_scaling/launch_configuration_collection.rb +1 -1
- data/lib/aws/auto_scaling/notification_configuration_collection.rb +1 -1
- data/lib/aws/auto_scaling/request.rb +1 -2
- data/lib/aws/auto_scaling/scaling_policy_collection.rb +1 -1
- data/lib/aws/auto_scaling/scheduled_action_collection.rb +3 -3
- data/lib/aws/auto_scaling/tag_collection.rb +1 -1
- data/lib/aws/cloud_formation.rb +1 -18
- data/lib/aws/cloud_formation/client.rb +314 -8
- data/lib/aws/cloud_formation/errors.rb +1 -5
- data/lib/aws/cloud_formation/request.rb +1 -2
- data/lib/aws/cloud_formation/stack.rb +4 -3
- data/lib/aws/cloud_formation/stack_collection.rb +2 -2
- data/lib/aws/cloud_formation/stack_resource_collection.rb +1 -1
- data/lib/aws/cloud_formation/stack_resource_summary_collection.rb +2 -2
- data/lib/aws/cloud_formation/stack_summary_collection.rb +1 -1
- data/lib/aws/core.rb +29 -14
- data/lib/aws/core/async_handle.rb +11 -12
- data/lib/aws/core/client.rb +112 -102
- data/lib/aws/core/client/query_json.rb +110 -0
- data/lib/aws/core/client/query_xml.rb +122 -0
- data/lib/aws/core/data.rb +242 -0
- data/lib/aws/core/http/request.rb +7 -4
- data/lib/aws/core/lazy_error_classes.rb +60 -38
- data/lib/aws/core/option_grammar.rb +1 -0
- data/lib/aws/core/policy.rb +2 -1
- data/lib/aws/core/resource.rb +38 -33
- data/lib/aws/core/response.rb +109 -44
- data/lib/aws/core/signature/version_2.rb +42 -0
- data/lib/aws/core/signature/version_3.rb +73 -0
- data/lib/aws/core/signature/version_3_http.rb +72 -0
- data/lib/aws/core/signature/version_4.rb +138 -0
- data/lib/aws/core/uri_escape.rb +6 -9
- data/lib/aws/core/xml/frame.rb +242 -0
- data/lib/aws/core/xml/frame_stack.rb +85 -0
- data/lib/aws/core/xml/grammar.rb +299 -0
- data/lib/aws/core/xml/parser.rb +70 -0
- data/lib/aws/core/xml/root_frame.rb +65 -0
- data/lib/aws/core/{configured_xml_grammars.rb → xml/sax_handlers/libxml.rb} +22 -20
- data/lib/aws/core/xml/sax_handlers/nokogiri.rb +55 -0
- data/lib/aws/core/{authorize_with_session_token.rb → xml/sax_handlers/ox.rb} +19 -7
- data/lib/aws/core/{configured_option_grammars.rb → xml/sax_handlers/rexml.rb} +22 -23
- data/lib/aws/core/xml/stub.rb +123 -0
- data/lib/aws/dynamo_db/batch_get.rb +1 -1
- data/lib/aws/dynamo_db/client.rb +796 -14
- data/lib/aws/dynamo_db/errors.rb +1 -38
- data/lib/aws/dynamo_db/item_collection.rb +29 -28
- data/lib/aws/dynamo_db/request.rb +3 -53
- data/lib/aws/dynamo_db/table.rb +6 -2
- data/lib/aws/ec2/attachment.rb +1 -1
- data/lib/aws/ec2/client.rb +3954 -9
- data/lib/aws/ec2/dhcp_options.rb +3 -3
- data/lib/aws/ec2/errors.rb +10 -4
- data/lib/aws/ec2/instance.rb +7 -6
- data/lib/aws/ec2/instance_collection.rb +2 -2
- data/lib/aws/ec2/key_pair_collection.rb +3 -3
- data/lib/aws/ec2/network_acl.rb +4 -2
- data/lib/aws/ec2/network_acl/entry.rb +10 -10
- data/lib/aws/ec2/network_interface.rb +2 -3
- data/lib/aws/ec2/network_interface/attachment.rb +8 -8
- data/lib/aws/ec2/permission_collection.rb +3 -3
- data/lib/aws/ec2/request.rb +1 -3
- data/lib/aws/ec2/resource_tag_collection.rb +4 -8
- data/lib/aws/ec2/route_table.rb +3 -2
- data/lib/aws/ec2/route_table/route.rb +7 -7
- data/lib/aws/ec2/security_group.rb +2 -2
- data/lib/aws/ec2/security_group/egress_ip_permission_collection.rb +16 -5
- data/lib/aws/ec2/security_group/ingress_ip_permission_collection.rb +4 -3
- data/lib/aws/ec2/security_group/ip_permission.rb +1 -2
- data/lib/aws/ec2/snapshot_collection.rb +6 -3
- data/lib/aws/ec2/subnet.rb +1 -1
- data/lib/aws/ec2/volume.rb +1 -3
- data/lib/aws/ec2/volume_collection.rb +2 -0
- data/lib/aws/elb/availability_zone_collection.rb +2 -2
- data/lib/aws/elb/backend_server_policy_collection.rb +1 -1
- data/lib/aws/elb/client.rb +513 -9
- data/lib/aws/elb/errors.rb +2 -6
- data/lib/aws/elb/instance_collection.rb +2 -2
- data/lib/aws/elb/request.rb +1 -1
- data/lib/aws/errors.rb +61 -74
- data/lib/aws/iam.rb +2 -3
- data/lib/aws/iam/client.rb +1178 -10
- data/lib/aws/iam/collection.rb +2 -1
- data/lib/aws/iam/errors.rb +1 -6
- data/lib/aws/iam/group.rb +8 -9
- data/lib/aws/iam/request.rb +1 -1
- data/lib/aws/iam/server_certificate_collection.rb +8 -5
- data/lib/aws/iam/signing_certificate.rb +1 -1
- data/lib/aws/iam/user.rb +2 -2
- data/lib/aws/iam/user_policy.rb +3 -2
- data/lib/aws/rails.rb +1 -2
- data/lib/aws/record.rb +3 -3
- data/lib/aws/record/abstract_base.rb +0 -3
- data/lib/aws/record/attributes.rb +7 -7
- data/lib/aws/record/model.rb +19 -19
- data/lib/aws/record/model/finder_methods.rb +7 -7
- data/lib/aws/s3/bucket.rb +7 -2
- data/lib/aws/s3/client.rb +391 -398
- data/lib/aws/s3/client/xml.rb +44 -71
- data/lib/aws/s3/data_options.rb +3 -2
- data/lib/aws/s3/errors.rb +8 -11
- data/lib/aws/s3/multipart_upload_collection.rb +1 -3
- data/lib/aws/s3/object_collection.rb +2 -1
- data/lib/aws/s3/object_metadata.rb +2 -2
- data/lib/aws/s3/paginated_collection.rb +2 -2
- data/lib/aws/s3/prefix_and_delimiter_collection.rb +1 -1
- data/lib/aws/s3/presigned_post.rb +18 -17
- data/lib/aws/s3/request.rb +4 -3
- data/lib/aws/s3/s3_object.rb +8 -10
- data/lib/aws/simple_db/attribute.rb +2 -2
- data/lib/aws/simple_db/attribute_collection.rb +14 -4
- data/lib/aws/simple_db/client.rb +313 -14
- data/lib/aws/simple_db/domain.rb +1 -1
- data/lib/aws/simple_db/domain_collection.rb +4 -4
- data/lib/aws/simple_db/domain_metadata.rb +1 -1
- data/lib/aws/simple_db/errors.rb +14 -2
- data/lib/aws/simple_db/expect_condition_option.rb +1 -1
- data/lib/aws/simple_db/item.rb +1 -1
- data/lib/aws/simple_db/item_collection.rb +9 -9
- data/lib/aws/simple_db/item_data.rb +9 -6
- data/lib/aws/simple_db/request.rb +1 -1
- data/lib/aws/simple_email_service.rb +8 -7
- data/lib/aws/simple_email_service/client.rb +174 -9
- data/lib/aws/simple_email_service/email_address_collection.rb +0 -1
- data/lib/aws/simple_email_service/errors.rb +1 -5
- data/lib/aws/simple_email_service/quotas.rb +8 -6
- data/lib/aws/simple_email_service/request.rb +7 -1
- data/lib/aws/simple_workflow/client.rb +1383 -6
- data/lib/aws/simple_workflow/decision_task.rb +1 -3
- data/lib/aws/simple_workflow/errors.rb +1 -38
- data/lib/aws/simple_workflow/history_event_collection.rb +2 -2
- data/lib/aws/simple_workflow/request.rb +5 -49
- data/lib/aws/simple_workflow/type.rb +1 -1
- data/lib/aws/simple_workflow/type_collection.rb +4 -3
- data/lib/aws/simple_workflow/workflow_execution_collection.rb +2 -2
- data/lib/aws/sns/client.rb +345 -9
- data/lib/aws/sns/errors.rb +1 -5
- data/lib/aws/sns/request.rb +1 -2
- data/lib/aws/sns/subscription_collection.rb +2 -2
- data/lib/aws/sns/topic.rb +15 -14
- data/lib/aws/sns/topic_collection.rb +1 -1
- data/lib/aws/sqs/client.rb +334 -9
- data/lib/aws/sqs/errors.rb +1 -6
- data/lib/aws/sqs/queue.rb +20 -21
- data/lib/aws/sqs/queue_collection.rb +3 -3
- data/lib/aws/sqs/request.rb +2 -2
- data/lib/aws/sts.rb +8 -10
- data/lib/aws/sts/client.rb +67 -10
- data/lib/aws/sts/errors.rb +1 -5
- data/lib/aws/sts/request.rb +1 -1
- data/lib/user.rb +49 -0
- metadata +21 -28
- data/lib/aws/auto_scaling/client/xml.rb +0 -32
- data/lib/aws/cloud_formation/client/xml.rb +0 -32
- data/lib/aws/core/api_config.rb +0 -44
- data/lib/aws/core/authorize_v2.rb +0 -39
- data/lib/aws/core/authorize_v3.rb +0 -38
- data/lib/aws/core/authorize_v4.rb +0 -149
- data/lib/aws/core/configured_client_methods.rb +0 -76
- data/lib/aws/core/configured_grammars.rb +0 -63
- data/lib/aws/core/configured_json_client_methods.rb +0 -74
- data/lib/aws/core/ignore_result_element.rb +0 -34
- data/lib/aws/core/json_client.rb +0 -41
- data/lib/aws/core/xml_grammar.rb +0 -957
- data/lib/aws/ec2/client/xml.rb +0 -175
- data/lib/aws/elb/client/xml.rb +0 -33
- data/lib/aws/elb/listener_spec.rb +0 -14
- data/lib/aws/iam/client/xml.rb +0 -34
- data/lib/aws/simple_db/client/options.rb +0 -32
- data/lib/aws/simple_db/client/xml.rb +0 -63
- data/lib/aws/simple_email_service/client/xml.rb +0 -34
- data/lib/aws/sns/client/xml.rb +0 -34
- data/lib/aws/sqs/client/xml.rb +0 -33
- data/lib/aws/sts/client/xml.rb +0 -34
|
@@ -1,32 +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
|
-
class AutoScaling
|
|
16
|
-
class Client < Core::Client
|
|
17
|
-
module XML
|
|
18
|
-
|
|
19
|
-
include Core::ConfiguredXmlGrammars
|
|
20
|
-
|
|
21
|
-
extend Core::IgnoreResultElement
|
|
22
|
-
|
|
23
|
-
BaseError = Core::XmlGrammar.customize do
|
|
24
|
-
element("Error") { ignore }
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
define_configured_grammars
|
|
28
|
-
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,32 +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
|
-
class CloudFormation
|
|
16
|
-
class Client < Core::Client
|
|
17
|
-
# @private
|
|
18
|
-
module XML
|
|
19
|
-
|
|
20
|
-
include Core::ConfiguredXmlGrammars
|
|
21
|
-
extend Core::IgnoreResultElement
|
|
22
|
-
|
|
23
|
-
BaseError = Core::XmlGrammar.customize do
|
|
24
|
-
element("Error") { ignore }
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
define_configured_grammars
|
|
28
|
-
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
data/lib/aws/core/api_config.rb
DELETED
|
@@ -1,44 +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
|
-
require 'yaml'
|
|
15
|
-
require 'pathname'
|
|
16
|
-
|
|
17
|
-
module AWS
|
|
18
|
-
module Core
|
|
19
|
-
|
|
20
|
-
# @private
|
|
21
|
-
module ApiConfig
|
|
22
|
-
|
|
23
|
-
include Naming
|
|
24
|
-
|
|
25
|
-
protected
|
|
26
|
-
def api_config
|
|
27
|
-
|
|
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
|
|
37
|
-
|
|
38
|
-
YAML.load(config_file.read)
|
|
39
|
-
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,39 +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
|
-
|
|
17
|
-
# Mixed into clients that use signature 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
|
|
@@ -1,38 +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
|
-
require 'time'
|
|
15
|
-
|
|
16
|
-
module AWS
|
|
17
|
-
module Core
|
|
18
|
-
|
|
19
|
-
# Mixed into clients that use signature v3 authorization.
|
|
20
|
-
# @private
|
|
21
|
-
module AuthorizeV3
|
|
22
|
-
|
|
23
|
-
def string_to_sign
|
|
24
|
-
headers['date'] ||= Time.now.rfc822
|
|
25
|
-
end
|
|
26
|
-
|
|
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
|
-
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,149 +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
|
-
# - docs don't match in task 2 between the sample and the detailed
|
|
15
|
-
# instructions, is the canonical request hex/hashed or just hexed?
|
|
16
|
-
# - the hashing method is never defined, is it a md5 hash?
|
|
17
|
-
# - the documentation does not discuss how to add the authorization
|
|
18
|
-
# to your get or post request, 2 simple examples are provided, but with
|
|
19
|
-
# no information about how to join the parts in the post request
|
|
20
|
-
# (not clear about spaces vs newlines, etc)
|
|
21
|
-
# - document does not displ
|
|
22
|
-
|
|
23
|
-
require 'time'
|
|
24
|
-
require 'openssl'
|
|
25
|
-
require 'digest'
|
|
26
|
-
|
|
27
|
-
# bug resigning
|
|
28
|
-
|
|
29
|
-
module AWS
|
|
30
|
-
module Core
|
|
31
|
-
|
|
32
|
-
# Mixed into clients that use signature v4 authorization.
|
|
33
|
-
module AuthorizeV4
|
|
34
|
-
|
|
35
|
-
def add_authorization! signer
|
|
36
|
-
self.access_key_id = signer.access_key_id
|
|
37
|
-
datetime = Time.now.utc.strftime("%Y%m%dT%H%M%SZ")
|
|
38
|
-
headers['content-type'] ||= 'application/x-www-form-urlencoded'
|
|
39
|
-
headers['host'] = host
|
|
40
|
-
headers['x-amz-date'] = datetime
|
|
41
|
-
headers['x-amz-security-token'] = signer.session_token if signer.session_token
|
|
42
|
-
headers['authorization'] = authorization(signer, datetime)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
protected
|
|
46
|
-
|
|
47
|
-
def authorization signer, datetime
|
|
48
|
-
parts = []
|
|
49
|
-
parts << "AWS4-HMAC-SHA256 Credential=#{access_key_id}/#{credential_string(datetime)}"
|
|
50
|
-
parts << "SignedHeaders=#{signed_headers}"
|
|
51
|
-
parts << "Signature=#{hex16(signature(signer, datetime))}"
|
|
52
|
-
parts.join(', ')
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def signature signer, datetime
|
|
56
|
-
k_secret = signer.secret_access_key
|
|
57
|
-
k_date = hmac("AWS4" + k_secret, datetime[0,8])
|
|
58
|
-
k_region = hmac(k_date, region)
|
|
59
|
-
k_service = hmac(k_region, service)
|
|
60
|
-
k_credentials = hmac(k_service, 'aws4_request')
|
|
61
|
-
hmac(k_credentials, string_to_sign(datetime))
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def string_to_sign datetime
|
|
65
|
-
parts = []
|
|
66
|
-
parts << 'AWS4-HMAC-SHA256'
|
|
67
|
-
parts << datetime
|
|
68
|
-
parts << credential_string(datetime)
|
|
69
|
-
parts << hex16(hash(canonical_request))
|
|
70
|
-
parts.join("\n")
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def credential_string datetime
|
|
74
|
-
parts = []
|
|
75
|
-
parts << datetime[0,8]
|
|
76
|
-
parts << region
|
|
77
|
-
parts << service
|
|
78
|
-
parts << 'aws4_request'
|
|
79
|
-
parts.join("/")
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def canonical_request
|
|
83
|
-
parts = []
|
|
84
|
-
parts << action_name
|
|
85
|
-
parts << canonical_uri
|
|
86
|
-
parts << canonical_querystring
|
|
87
|
-
parts << canonical_headers + "\n"
|
|
88
|
-
parts << signed_headers
|
|
89
|
-
parts << hex16(hash(payload))
|
|
90
|
-
parts.join("\n")
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def service
|
|
94
|
-
# this method is implemented in the request class for each service
|
|
95
|
-
raise NotImplementedError
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def action_name
|
|
99
|
-
http_method.to_s.upcase
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def canonical_uri
|
|
103
|
-
path
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
def payload
|
|
107
|
-
body || ''
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def canonical_querystring
|
|
111
|
-
http_method.to_s.upcase == 'GET' ? url_encoded_params : ''
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
def signed_headers
|
|
115
|
-
to_sign = headers.keys.map{|k| k.to_s.downcase }
|
|
116
|
-
to_sign.delete('authorization')
|
|
117
|
-
to_sign.sort.join(";")
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
def canonical_headers
|
|
121
|
-
headers = []
|
|
122
|
-
self.headers.each_pair do |k,v|
|
|
123
|
-
header = [k.to_s.downcase, v]
|
|
124
|
-
headers << header unless header.first == 'authorization'
|
|
125
|
-
end
|
|
126
|
-
headers = headers.sort_by(&:first)
|
|
127
|
-
headers.map{|k,v| "#{k}:#{canonical_header_values(v)}" }.join("\n")
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
def canonical_header_values values
|
|
131
|
-
values = [values] unless values.is_a?(Array)
|
|
132
|
-
values.map(&:to_s).map(&:strip).join(',')
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
def hex16 string
|
|
136
|
-
string.unpack('H*').first
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
def hmac key, string
|
|
140
|
-
OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), key, string)
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
def hash string
|
|
144
|
-
Digest::SHA256.digest(string)
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
end
|
|
@@ -1,76 +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
|
-
|
|
17
|
-
# @private
|
|
18
|
-
module ConfiguredClientMethods
|
|
19
|
-
|
|
20
|
-
# @private
|
|
21
|
-
module ClassMethods
|
|
22
|
-
|
|
23
|
-
include ApiConfig
|
|
24
|
-
|
|
25
|
-
def configure_client
|
|
26
|
-
|
|
27
|
-
super
|
|
28
|
-
|
|
29
|
-
unless self::XML.include?(ConfiguredXmlGrammars)
|
|
30
|
-
self::XML.module_eval do
|
|
31
|
-
include(ConfiguredXmlGrammars)
|
|
32
|
-
define_configured_grammars
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
unless self::Options.include?(ConfiguredOptionGrammars)
|
|
37
|
-
self::Options.module_eval do
|
|
38
|
-
include(ConfiguredOptionGrammars)
|
|
39
|
-
define_configured_grammars
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
api_config[:operations].each do |name, customizations|
|
|
44
|
-
option_grammar = self::Options.operation_grammar(name)
|
|
45
|
-
add_client_request_method(Inflection.ruby_name(name).to_sym,
|
|
46
|
-
:xml_grammar =>
|
|
47
|
-
self::XML.operation_grammar(name)) do
|
|
48
|
-
configure_request do |request, options|
|
|
49
|
-
request.add_param("Action", name)
|
|
50
|
-
option_grammar.request_params(options).each do |param|
|
|
51
|
-
request.add_param(param)
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def operation_xml_grammar(name)
|
|
60
|
-
customized_name = "Customized#{name}"
|
|
61
|
-
if self::XML.const_defined?(customized_name)
|
|
62
|
-
self::XML.const_get(customized_name)
|
|
63
|
-
else
|
|
64
|
-
self::XML.const_get(name)
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def self.included(mod)
|
|
71
|
-
mod.extend(ClassMethods)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|
|
@@ -1,63 +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
|
-
|
|
17
|
-
# @private
|
|
18
|
-
module ConfiguredGrammars
|
|
19
|
-
|
|
20
|
-
# @private
|
|
21
|
-
module ClassMethods
|
|
22
|
-
|
|
23
|
-
include ApiConfig
|
|
24
|
-
|
|
25
|
-
def base_grammar
|
|
26
|
-
raise NotImplementedError
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def operation_grammar(name)
|
|
30
|
-
customized_name = "Customized#{name}"
|
|
31
|
-
if const_defined?(customized_name)
|
|
32
|
-
const_get(customized_name)
|
|
33
|
-
else
|
|
34
|
-
const_get(name)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def input_or_output
|
|
39
|
-
raise NotImplementedError
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def process_customizations(name, customizations)
|
|
43
|
-
customizations
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def define_configured_grammars
|
|
47
|
-
api_config[:operations].each do |name, data|
|
|
48
|
-
customizations = process_customizations(name,
|
|
49
|
-
data[input_or_output])
|
|
50
|
-
const_set(name,
|
|
51
|
-
base_grammar.customize(customizations))
|
|
52
|
-
# BaseResponse.customize([{
|
|
53
|
-
# "#{name}Result" =>
|
|
54
|
-
# [:ignore, *data[:output]]
|
|
55
|
-
# }]))
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|