fog-aws 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -12
- data/fog-aws.gemspec +1 -1
- data/lib/fog/aws/compute.rb +2 -0
- data/lib/fog/aws/models/compute/address.rb +1 -0
- data/lib/fog/aws/models/compute/flavors.rb +440 -0
- data/lib/fog/aws/models/rds/cluster.rb +9 -1
- data/lib/fog/aws/models/rds/server.rb +3 -3
- data/lib/fog/aws/models/storage/directory.rb +35 -0
- data/lib/fog/aws/parsers/compute/describe_addresses.rb +30 -9
- data/lib/fog/aws/parsers/compute/describe_image_attribute.rb +122 -0
- data/lib/fog/aws/parsers/compute/describe_security_groups.rb +1 -1
- data/lib/fog/aws/requests/compute/describe_image_attribute.rb +74 -0
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +12 -1
- data/lib/fog/aws/requests/compute/modify_instance_placement.rb +33 -0
- data/lib/fog/aws/requests/dns/change_resource_record_sets.rb +1 -1
- data/lib/fog/aws/requests/dynamodb/update_item.rb +6 -5
- data/lib/fog/aws/requests/storage/get_bucket_location.rb +2 -3
- data/lib/fog/aws/requests/storage/get_service.rb +2 -2
- data/lib/fog/aws/requests/storage/put_object.rb +5 -3
- data/lib/fog/aws/storage.rb +9 -2
- data/lib/fog/aws/version.rb +1 -1
- data/tests/credentials_tests.rb +38 -37
- data/tests/helper.rb +2 -2
- data/tests/helpers/collection_helper.rb +3 -4
- data/tests/helpers/compute/flavors_helper.rb +1 -5
- data/tests/helpers/compute/server_helper.rb +1 -3
- data/tests/helpers/compute/servers_helper.rb +0 -2
- data/tests/helpers/dns_helper.rb +32 -31
- data/tests/helpers/formats_helper.rb +58 -56
- data/tests/helpers/formats_helper_tests.rb +22 -25
- data/tests/helpers/mock_helper.rb +96 -96
- data/tests/helpers/model_helper.rb +4 -5
- data/tests/helpers/responds_to_helper.rb +1 -1
- data/tests/helpers/schema_validator_tests.rb +21 -24
- data/tests/helpers/succeeds_helper.rb +1 -1
- data/tests/parsers/compute/describe_images_tests.rb +1 -1
- data/tests/parsers/elb/describe_load_balancers.rb +1 -1
- data/tests/requests/compute/image_tests.rb +9 -0
- data/tests/requests/sts/assume_role_with_web_identity_tests.rb +2 -0
- data/tests/signaturev4_tests.rb +21 -22
- data/tests/signed_params_tests.rb +7 -7
- data/tests/storage_tests.rb +1 -1
- metadata +8 -6
@@ -24,7 +24,7 @@ DESCRIBE_IMAGES_RESULT = <<-EOF
|
|
24
24
|
</DescribeImagesResponse>
|
25
25
|
EOF
|
26
26
|
|
27
|
-
Shindo.tests('AWS::Compute | parsers | describe_images', [
|
27
|
+
Shindo.tests('AWS::Compute | parsers | describe_images', %w[compute aws parser]) do
|
28
28
|
tests('parses the xml').formats(AWS::Compute::Formats::DESCRIBE_IMAGES) do
|
29
29
|
parser = Nokogiri::XML::SAX::Parser.new(Fog::Parsers::AWS::Compute::DescribeImages.new)
|
30
30
|
parser.parse(DESCRIBE_IMAGES_RESULT)
|
@@ -56,7 +56,7 @@ xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/">
|
|
56
56
|
</DescribeLoadBalancersResponse>
|
57
57
|
EOF
|
58
58
|
|
59
|
-
Shindo.tests('AWS::ELB | parsers | describe_load_balancers', [
|
59
|
+
Shindo.tests('AWS::ELB | parsers | describe_load_balancers', %w[aws elb parser]) do
|
60
60
|
tests('parses the xml').formats(AWS::ELB::Formats::DESCRIBE_LOAD_BALANCERS) do
|
61
61
|
parser = Nokogiri::XML::SAX::Parser.new(Fog::Parsers::AWS::ELB::DescribeLoadBalancers.new)
|
62
62
|
parser.parse(DESCRIBE_LOAD_BALANCERS_RESULT)
|
@@ -37,6 +37,11 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
|
|
37
37
|
'return' => Fog::Boolean,
|
38
38
|
'requestId' => String
|
39
39
|
}
|
40
|
+
@describe_image_attribute_format = {
|
41
|
+
'requestId' => String,
|
42
|
+
'imageId' => String,
|
43
|
+
'launchPermission' => [Fog::Nullable::String]
|
44
|
+
}
|
40
45
|
@create_image_format = {
|
41
46
|
'requestId' => String,
|
42
47
|
'imageId' => String
|
@@ -113,6 +118,10 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
|
|
113
118
|
Fog::Compute[:aws].modify_image_attribute(@image_id, { 'Add.UserId' => [@other_account.data[:owner_id]] }).body
|
114
119
|
end
|
115
120
|
|
121
|
+
tests("#describe_image_attribute('#{@image_id}', 'launchPermission'])").formats(@describe_image_attribute_format) do
|
122
|
+
Fog::Compute[:aws].describe_image_attribute(@image_id, 'launchPermission' ).body
|
123
|
+
end
|
124
|
+
|
116
125
|
tests("other_account#describe_images('image-id' => '#{@image_id}')").returns([@image_id]) do
|
117
126
|
@other_account.describe_images('image-id' => @image_id).body['imagesSet'].map {|i| i['imageId'] }
|
118
127
|
end
|
@@ -23,4 +23,6 @@ Shindo.tests('AWS::STS | assume role with web identity', ['aws']) do
|
|
23
23
|
tests("#assume_role_with_web_identity('#{@role['Arn']}', '#{@token}', 'fog')").formats(@response_format) do
|
24
24
|
@sts.assume_role_with_web_identity(@role['Arn'], @token, 'fog', :iam => @iam).body
|
25
25
|
end
|
26
|
+
|
27
|
+
@iam.roles.get('sts').destroy
|
26
28
|
end
|
data/tests/signaturev4_tests.rb
CHANGED
@@ -1,81 +1,80 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
Shindo.tests('AWS | signaturev4', ['aws']) do
|
4
|
-
|
5
|
-
@now = Fog::Time.utc(2011,9,9,23,36,0)
|
4
|
+
@now = Fog::Time.utc(2011, 9, 9, 23, 36, 0)
|
6
5
|
|
7
6
|
# These testcases are from http://docs.amazonwebservices.com/general/latest/gr/signature-v4-test-suite.html
|
8
|
-
@signer = Fog::AWS::SignatureV4.new('AKIDEXAMPLE', 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', 'us-east-1','host')
|
7
|
+
@signer = Fog::AWS::SignatureV4.new('AKIDEXAMPLE', 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', 'us-east-1', 'host')
|
9
8
|
|
10
9
|
tests('get-vanilla') do
|
11
|
-
returns(@signer.sign({:
|
10
|
+
returns(@signer.sign({ headers: { 'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT' }, method: :get, path: '/' }, @now)) do
|
12
11
|
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470'
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
15
|
tests('get-headers-mixed-case-headers') do
|
17
|
-
returns(@signer.sign({:
|
16
|
+
returns(@signer.sign({ headers: { 'HOST' => 'host.foo.com', 'date' => 'Mon, 09 Sep 2011 23:36:00 GMT' }, method: :get, path: '/' }, @now)) do
|
18
17
|
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470'
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
22
21
|
tests('get-vanilla-query-order-key with symbol keys') do
|
23
|
-
returns(@signer.sign({:
|
22
|
+
returns(@signer.sign({ query: { a: 'foo', b: 'foo' }, headers: { Host: 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT'}, method: :get, path: '/' }, @now)) do
|
24
23
|
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b'
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
27
|
tests('get-vanilla-query-order-key') do
|
29
|
-
returns(@signer.sign({:
|
28
|
+
returns(@signer.sign({ query: { a: 'foo', b: 'foo' }, headers: { Host: 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT'}, :method => :get, :path => '/'}, @now)) do
|
30
29
|
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b'
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
34
33
|
tests('get-unreserved') do
|
35
|
-
returns(@signer.sign({:
|
34
|
+
returns(@signer.sign({ headers: { 'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT' }, method: :get, path: '/-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' }, @now)) do
|
36
35
|
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=830cc36d03f0f84e6ee4953fbe701c1c8b71a0372c63af9255aa364dd183281e'
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
39
|
tests('post-x-www-form-urlencoded-parameter') do
|
41
|
-
returns(@signer.sign({:
|
42
|
-
:
|
40
|
+
returns(@signer.sign({ headers: { 'Content-type' => 'application/x-www-form-urlencoded; charset=utf8', 'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT' }, method: :post, path: '/',
|
41
|
+
body: 'foo=bar' }, @now)) do
|
43
42
|
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=content-type;date;host, Signature=b105eb10c6d318d2294de9d49dd8b031b55e3c3fe139f2e637da70511e9e7b71'
|
44
43
|
end
|
45
44
|
end
|
46
45
|
|
47
46
|
tests('get with relative path') do
|
48
|
-
returns(@signer.sign({:
|
47
|
+
returns(@signer.sign({ query: {}, headers: { 'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT' }, method: :get, path: '/foo/bar/../..' }, @now)) do
|
49
48
|
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470'
|
50
49
|
end
|
51
50
|
end
|
52
51
|
|
53
52
|
tests('get with pointless .') do
|
54
|
-
returns(@signer.sign({:
|
53
|
+
returns(@signer.sign({ query: {}, headers: { 'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT' }, method: :get, path: '/./foo' }, @now)) do
|
55
54
|
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=910e4d6c9abafaf87898e1eb4c929135782ea25bb0279703146455745391e63a'
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|
59
58
|
tests('get with repeated / ') do
|
60
|
-
returns(@signer.sign({:
|
59
|
+
returns(@signer.sign({ query: {}, headers: { 'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT' }, method: :get, path: '//' }, @now)) do
|
61
60
|
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470'
|
62
61
|
end
|
63
62
|
end
|
64
63
|
|
65
64
|
tests('get with repeated // inside path') do
|
66
|
-
returns(@signer.sign({:
|
65
|
+
returns(@signer.sign({ query: {}, headers: { 'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT' }, method: :get, path: '/foo//bar//baz' }, @now)) do
|
67
66
|
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b250c85c72c5d7c33f67759c7a1ad79ea381cf62105290cecd530af2771575d4'
|
68
67
|
end
|
69
68
|
end
|
70
69
|
|
71
70
|
tests('get with repeated trailing / ') do
|
72
|
-
returns(@signer.sign({:
|
71
|
+
returns(@signer.sign({ query: {}, headers: { 'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT' }, method: :get, path: '//foo//' }, @now)) do
|
73
72
|
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b00392262853cfe3201e47ccf945601079e9b8a7f51ee4c3d9ee4f187aa9bf19'
|
74
73
|
end
|
75
74
|
end
|
76
75
|
|
77
|
-
tests('get signature as components') do
|
78
|
-
returns(@signer.signature_parameters({:
|
76
|
+
tests('get signature as components') do
|
77
|
+
returns(@signer.signature_parameters({ query: { 'a' => 'foo', 'b' => 'foo' }, headers: { 'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT' }, method: :get, path: '/'}, @now)) do
|
79
78
|
{
|
80
79
|
'X-Amz-Algorithm' => 'AWS4-HMAC-SHA256',
|
81
80
|
'X-Amz-Credential' => 'AKIDEXAMPLE/20110909/us-east-1/host/aws4_request',
|
@@ -85,8 +84,8 @@ Shindo.tests('AWS | signaturev4', ['aws']) do
|
|
85
84
|
end
|
86
85
|
end
|
87
86
|
|
88
|
-
tests(
|
89
|
-
returns(@signer.signature_parameters({:
|
87
|
+
tests('inject body sha') do
|
88
|
+
returns(@signer.signature_parameters({ query: { 'a' => 'foo', 'b' => 'foo' }, headers: { 'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT' }, method: :get, path: '/' }, @now, 'STREAMING-AWS4-HMAC-SHA256-PAYLOAD')) do
|
90
89
|
{
|
91
90
|
'X-Amz-Algorithm' => 'AWS4-HMAC-SHA256',
|
92
91
|
'X-Amz-Credential' => 'AKIDEXAMPLE/20110909/us-east-1/host/aws4_request',
|
@@ -96,9 +95,9 @@ Shindo.tests('AWS | signaturev4', ['aws']) do
|
|
96
95
|
end
|
97
96
|
end
|
98
97
|
|
99
|
-
tests(
|
100
|
-
signer=Fog::AWS::SignatureV4.new('AKIDEXAMPLE', 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', 'us-east-1','s3')
|
101
|
-
returns(signer.sign({:
|
98
|
+
tests('s3 signer does not normalize path') do
|
99
|
+
signer = Fog::AWS::SignatureV4.new('AKIDEXAMPLE', 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', 'us-east-1', 's3')
|
100
|
+
returns(signer.sign({ query: {}, headers: { 'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT' }, method: :get, path: '//foo/../bar/./' }, @now)) do
|
102
101
|
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/s3/aws4_request, SignedHeaders=date;host, Signature=72407ad06b8e5750360f42e8aad9f33a0be363bcfeecdcae0aea58c99709fb4a'
|
103
102
|
end
|
104
103
|
end
|
@@ -1,17 +1,17 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
Shindo.tests('AWS | signed_params', ['aws']) do
|
4
|
-
returns(
|
4
|
+
returns(Fog::AWS.escape("'Stöp!' said Fred_-~./")) { '%27St%C3%B6p%21%27%20said%20Fred_-~.%2F' }
|
5
5
|
|
6
6
|
tests('Unicode characters should be escaped') do
|
7
|
-
unicode = [
|
8
|
-
escaped =
|
9
|
-
returns(
|
7
|
+
unicode = ['00E9'.to_i(16)].pack('U*')
|
8
|
+
escaped = '%C3%A9'
|
9
|
+
returns(escaped) { Fog::AWS.escape(unicode) }
|
10
10
|
end
|
11
11
|
|
12
12
|
tests('Unicode characters with combining marks should be escaped') do
|
13
|
-
unicode = [
|
14
|
-
escaped =
|
15
|
-
returns(
|
13
|
+
unicode = ['0065'.to_i(16), '0301'.to_i(16)].pack('U*')
|
14
|
+
escaped = 'e%CC%81'
|
15
|
+
returns(escaped) { Fog::AWS.escape(unicode) }
|
16
16
|
end
|
17
17
|
end
|
data/tests/storage_tests.rb
CHANGED
@@ -2,6 +2,6 @@
|
|
2
2
|
|
3
3
|
Shindo.tests('AWS Storage | escape', ['aws']) do
|
4
4
|
tests('Keys can contain a hierarchical prefix which should not be escaped') do
|
5
|
-
returns(
|
5
|
+
returns(Fog::AWS::Storage.new.send(:escape, 'key/with/prefix')) { 'key/with/prefix' }
|
6
6
|
end
|
7
7
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Lane
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '2.0'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '2.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -434,6 +434,7 @@ files:
|
|
434
434
|
- lib/fog/aws/parsers/compute/describe_availability_zones.rb
|
435
435
|
- lib/fog/aws/parsers/compute/describe_classic_link_instances.rb
|
436
436
|
- lib/fog/aws/parsers/compute/describe_dhcp_options.rb
|
437
|
+
- lib/fog/aws/parsers/compute/describe_image_attribute.rb
|
437
438
|
- lib/fog/aws/parsers/compute/describe_images.rb
|
438
439
|
- lib/fog/aws/parsers/compute/describe_instance_attribute.rb
|
439
440
|
- lib/fog/aws/parsers/compute/describe_instance_status.rb
|
@@ -907,6 +908,7 @@ files:
|
|
907
908
|
- lib/fog/aws/requests/compute/describe_availability_zones.rb
|
908
909
|
- lib/fog/aws/requests/compute/describe_classic_link_instances.rb
|
909
910
|
- lib/fog/aws/requests/compute/describe_dhcp_options.rb
|
911
|
+
- lib/fog/aws/requests/compute/describe_image_attribute.rb
|
910
912
|
- lib/fog/aws/requests/compute/describe_images.rb
|
911
913
|
- lib/fog/aws/requests/compute/describe_instance_attribute.rb
|
912
914
|
- lib/fog/aws/requests/compute/describe_instance_status.rb
|
@@ -950,6 +952,7 @@ files:
|
|
950
952
|
- lib/fog/aws/requests/compute/import_key_pair.rb
|
951
953
|
- lib/fog/aws/requests/compute/modify_image_attribute.rb
|
952
954
|
- lib/fog/aws/requests/compute/modify_instance_attribute.rb
|
955
|
+
- lib/fog/aws/requests/compute/modify_instance_placement.rb
|
953
956
|
- lib/fog/aws/requests/compute/modify_network_interface_attribute.rb
|
954
957
|
- lib/fog/aws/requests/compute/modify_snapshot_attribute.rb
|
955
958
|
- lib/fog/aws/requests/compute/modify_subnet_attribute.rb
|
@@ -1701,8 +1704,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1701
1704
|
- !ruby/object:Gem::Version
|
1702
1705
|
version: '0'
|
1703
1706
|
requirements: []
|
1704
|
-
|
1705
|
-
rubygems_version: 2.7.6
|
1707
|
+
rubygems_version: 3.0.2
|
1706
1708
|
signing_key:
|
1707
1709
|
specification_version: 4
|
1708
1710
|
summary: Module for the 'fog' gem to support Amazon Web Services.
|