fog-aws 1.4.0 → 1.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6337216d400d2563de64b38f700c73f5c35c1b9d
4
- data.tar.gz: 014d339b4064fe6d22b6114817225778c3b131ee
3
+ metadata.gz: 3973a7b70a274c20de34e9d05a1a848c2d93fcef
4
+ data.tar.gz: 73a49e9277d918bc99701d78c9482d5c7d6b302f
5
5
  SHA512:
6
- metadata.gz: 52648d0ea0a5f618477d8db41edf397064796c475871b857a916650c1b7d3f295dd094f286a7b5cdc7c816e57379b4d1e3545e8b2b26bd8a67561e6d4275932e
7
- data.tar.gz: 36a0947508b7d40a7ff78b20763a84ece69d7b7b439fcc2e15d34743f99d934ed4f761d2d3971e08131f2b4e334071332096034915a197a01458895d0a7fad66
6
+ metadata.gz: 3701fda2e9477f984781026b92b19643c54be23780e9b404f7cd767a42013333c9924eb9d15a7c14e1c1015a90d50e675f384813da0a2c56fbb349bf865b300e
7
+ data.tar.gz: 55536ba768289f268e29150fd78d0cc01cbd434f0b51c8080839d14c179130c9f37dc67bb12e5a5f291d5c100a6f77914a8423c01f229a8ed31e7db4b510e233
@@ -2,7 +2,25 @@
2
2
 
3
3
  ## [Unreleased](https://github.com/fog/fog-aws/tree/HEAD)
4
4
 
5
- [Full Changelog](https://github.com/fog/fog-aws/compare/v1.3.0...HEAD)
5
+ [Full Changelog](https://github.com/fog/fog-aws/compare/v1.4.0...HEAD)
6
+
7
+ **Closed issues:**
8
+
9
+ - retrieval of ipv6 vpc [\#379](https://github.com/fog/fog-aws/issues/379)
10
+ - Timeout when trying to bootstrap or ssh spot request instances [\#372](https://github.com/fog/fog-aws/issues/372)
11
+ - Why default VPC does not require Elastic IP to connect in internet [\#338](https://github.com/fog/fog-aws/issues/338)
12
+ - Chunked images response causing Nokogiri::XML::SyntaxError [\#273](https://github.com/fog/fog-aws/issues/273)
13
+
14
+ **Merged pull requests:**
15
+
16
+ - Allow specifying kms key id to use [\#382](https://github.com/fog/fog-aws/pull/382) ([fcheung](https://github.com/fcheung))
17
+ - added support to retrieve and create vpc with ipv6 cidr block [\#381](https://github.com/fog/fog-aws/pull/381) ([chanakyacool](https://github.com/chanakyacool))
18
+ - Add MaxResults filter to describe reserved instances offerings [\#376](https://github.com/fog/fog-aws/pull/376) ([KevinLoiseau](https://github.com/KevinLoiseau))
19
+ - Fix Fog::Compute::AWS::Images\#all [\#375](https://github.com/fog/fog-aws/pull/375) ([eddiej](https://github.com/eddiej))
20
+ - Fix AWS credential mocking [\#374](https://github.com/fog/fog-aws/pull/374) ([v-yarotsky](https://github.com/v-yarotsky))
21
+
22
+ ## [v1.4.0](https://github.com/fog/fog-aws/tree/v1.4.0) (2017-06-14)
23
+ [Full Changelog](https://github.com/fog/fog-aws/compare/v1.3.0...v1.4.0)
6
24
 
7
25
  **Closed issues:**
8
26
 
@@ -197,7 +215,7 @@
197
215
  **Merged pull requests:**
198
216
 
199
217
  - Parse EbsOptimized parameter in launch configuration description [\#259](https://github.com/fog/fog-aws/pull/259) ([djudd](https://github.com/djudd))
200
- - Allow case-insensitive record comparison [\#258](https://github.com/fog/fog-aws/pull/258) ([mpick92](https://github.com/mpick92))
218
+ - Allow case-insensitive record comparison [\#258](https://github.com/fog/fog-aws/pull/258) ([matthewpick](https://github.com/matthewpick))
201
219
  - Fix for empty ETag values [\#257](https://github.com/fog/fog-aws/pull/257) ([baryshev](https://github.com/baryshev))
202
220
  - do not make requests if mocked. [\#252](https://github.com/fog/fog-aws/pull/252) ([shaiguitar](https://github.com/shaiguitar))
203
221
  - Parse CloudWatch alarm actions as arrays instead of strings [\#245](https://github.com/fog/fog-aws/pull/245) ([eherot](https://github.com/eherot))
@@ -11,7 +11,7 @@ module Fog
11
11
  module ServiceMethods
12
12
  def fetch_credentials(options)
13
13
  if options[:use_iam_profile] && Fog.mocking?
14
- Fog::Compute::AWS::Mock.data[:iam_role_based_creds]
14
+ return Fog::Compute::AWS::Mock.data[:iam_role_based_creds]
15
15
  end
16
16
  if options[:use_iam_profile]
17
17
  begin
@@ -10,6 +10,8 @@ module Fog
10
10
  attribute :tags, :aliases => 'tagSet'
11
11
  attribute :tenancy, :aliases => 'instanceTenancy'
12
12
  attribute :is_default, :aliases => 'isDefault'
13
+ attribute :ipv_6_cidr_block_association_set, :aliases => 'ipv6CidrBlockAssociationSet'
14
+ attribute :amazon_provided_ipv_6_cidr_block, :aliases => 'amazonProvidedIpv6CidrBlock'
13
15
 
14
16
  def subnets
15
17
  service.subnets(:filters => {'vpcId' => self.identity}).all
@@ -18,6 +20,7 @@ module Fog
18
20
  def initialize(attributes={})
19
21
  self.dhcp_options_id ||= "default"
20
22
  self.tenancy ||= "default"
23
+ self.amazon_provided_ipv_6_cidr_block ||=false
21
24
  super
22
25
  end
23
26
 
@@ -94,8 +97,7 @@ module Fog
94
97
 
95
98
  def save
96
99
  requires :cidr_block
97
-
98
- data = service.create_vpc(cidr_block).body['vpcSet'].first
100
+ data = service.create_vpc(cidr_block, { 'AmazonProvidedIpv6CidrBlock' => amazon_provided_ipv_6_cidr_block }).body['vpcSet'].first
99
101
  new_attributes = data.reject {|key,value| key == 'requestId'}
100
102
  new_attributes = data.reject {|key,value| key == 'requestId' || key == 'tagSet' }
101
103
  merge_attributes(new_attributes)
@@ -24,6 +24,7 @@ module Fog
24
24
  attribute :encryption, :aliases => 'x-amz-server-side-encryption'
25
25
  attribute :encryption_key, :aliases => 'x-amz-server-side-encryption-customer-key'
26
26
  attribute :version, :aliases => 'x-amz-version-id'
27
+ attribute :kms_key_id, :aliases => 'x-amz-server-side-encryption-aws-kms-key-id'
27
28
 
28
29
  # @note Chunk size to use for multipart uploads.
29
30
  # Use small chunk sizes to minimize memory. E.g. 5242880 = 5mb
@@ -294,7 +295,7 @@ module Fog
294
295
  if encryption && encryption_key
295
296
  encryption_customer_key_headers
296
297
  elsif encryption
297
- { 'x-amz-server-side-encryption' => encryption }
298
+ { 'x-amz-server-side-encryption' => encryption, 'x-amz-server-side-encryption-aws-kms-key-id' => kms_key_id }.reject {|_, value| value.nil?}
298
299
  else
299
300
  {}
300
301
  end
@@ -75,7 +75,7 @@ module Fog
75
75
  @image[name] = false
76
76
  end
77
77
  when 'creationDate'
78
- @image[name] = Time.parse(value)
78
+ @image[name] = Time.parse(value) if value && !value.empty?
79
79
  when 'item'
80
80
  @response['imagesSet'] << @image
81
81
  @image = { 'blockDeviceMapping' => [], 'productCodes' => [], 'stateReason' => {}, 'tagSet' => {} }
@@ -19,7 +19,7 @@ module Fog
19
19
  when 'item'
20
20
  @response['reservedInstancesOfferingsSet'] << @reserved_instances_offering unless @reserved_instances_offering.empty?
21
21
  @reserved_instances_offering = {}
22
- when 'requestId'
22
+ when 'requestId', 'nextToken'
23
23
  @response[name] = value
24
24
  end
25
25
  end
@@ -4,7 +4,7 @@ module Fog
4
4
  module AWS
5
5
  class DescribeVpcs < Fog::Parsers::Base
6
6
  def reset
7
- @vpc = { 'tagSet' => {} }
7
+ @vpc = { 'tagSet' => {}, 'ipv6CidrBlockAssociationSet' => {} }
8
8
  @response = { 'vpcSet' => [] }
9
9
  @tag = {}
10
10
  end
@@ -14,6 +14,8 @@ module Fog
14
14
  case name
15
15
  when 'tagSet'
16
16
  @in_tag_set = true
17
+ when 'ipv6CidrBlockAssociationSet'
18
+ @in_ipv6_set = true
17
19
  end
18
20
  end
19
21
 
@@ -28,15 +30,25 @@ module Fog
28
30
  when 'tagSet'
29
31
  @in_tag_set = false
30
32
  end
33
+ elsif @in_ipv6_set
34
+ case name
35
+ when 'ipv6CidrBlock', 'associationId'
36
+ @vpc['ipv6CidrBlockAssociationSet'][name] = value
37
+ when 'ipv6CidrBlockState'
38
+ @vpc['ipv6CidrBlockAssociationSet'][name] = {'State' => value.squish}
39
+ when 'ipv6CidrBlockAssociationSet'
40
+ @vpc['amazonProvidedIpv6CidrBlock'] = !value.blank?
41
+ @in_ipv6_set = false
42
+ end
31
43
  else
32
44
  case name
33
45
  when 'vpcId', 'state', 'cidrBlock', 'dhcpOptionsId', 'instanceTenancy'
34
46
  @vpc[name] = value
35
47
  when 'isDefault'
36
- @vpc['isDefault'] = value == 'true'
48
+ @vpc['isDefault'] = value == 'true'
37
49
  when 'item'
38
50
  @response['vpcSet'] << @vpc
39
- @vpc = { 'tagSet' => {} }
51
+ @vpc = { 'tagSet' => {}, 'ipv6CidrBlockAssociationSet' => {} }
40
52
  when 'requestId'
41
53
  @response[name] = value
42
54
  end
@@ -16,6 +16,8 @@ module Fog
16
16
  # * 'ProductDescription'<~String> - description of offering, in ['Linux/UNIX', 'Linux/UNIX (Amazon VPC)', 'Windows', 'Windows (Amazon VPC)']
17
17
  # * 'MaxDuration'<~Integer> - maximum duration (in seconds) of offering
18
18
  # * 'MinDuration'<~Integer> - minimum duration (in seconds) of offering
19
+ # * 'MaxResults'<~Integer> - The maximum number of results to return for the request in a single page
20
+ # * 'NextToken'<~String> - The token to retrieve the next page of results
19
21
  #
20
22
  # ==== Returns
21
23
  # * response<~Excon::Response>:
@@ -31,11 +33,12 @@ module Fog
31
33
  # * 'productDescription'<~String> - description of offering
32
34
  # * 'reservedInstancesOfferingId'<~String> - id of offering
33
35
  # * 'usagePrice'<~Float> - usage price of offering, per hour
36
+ # * 'NextToken'<~String> - The token to retrieve the next page of results
34
37
  #
35
38
  # {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeReservedInstancesOfferings.html]
36
39
  def describe_reserved_instances_offerings(filters = {})
37
40
  options = {}
38
- for key in ['AvailabilityZone', 'InstanceType', 'InstanceTenancy', 'OfferingType', 'ProductDescription', 'MaxDuration', 'MinDuration']
41
+ for key in %w(AvailabilityZone InstanceType InstanceTenancy OfferingType ProductDescription MaxDuration MinDuration MaxResults NextToken)
39
42
  if filters.is_a?(Hash) && filters.key?(key)
40
43
  options[key] = filters.delete(key)
41
44
  end
@@ -69,7 +72,8 @@ module Fog
69
72
 
70
73
  response.body = {
71
74
  'reservedInstancesOfferingsSet' => self.data[:reserved_instances_offerings],
72
- 'requestId' => Fog::AWS::Mock.request_id
75
+ 'requestId' => Fog::AWS::Mock.request_id,
76
+ 'nextToken' => (0...64).map { ('a'..'z').to_a[rand(26)] }.join
73
77
  }
74
78
 
75
79
  response
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module AWS
3
- VERSION = "1.4.0"
3
+ VERSION = "1.4.1"
4
4
  end
5
5
  end
@@ -2,10 +2,9 @@ Shindo.tests('AWS | credentials', ['aws']) do
2
2
  old_mock_value = Excon.defaults[:mock]
3
3
  fog_was_mocked = Fog.mocking?
4
4
  Excon.stubs.clear
5
- Fog.mock!
5
+ Fog.unmock!
6
6
  begin
7
7
  Excon.defaults[:mock] = true
8
- default_credentials = Fog::Compute::AWS.fetch_credentials({})
9
8
  Excon.stub({:method => :get, :path => "/latest/meta-data/iam/security-credentials/"}, {:status => 200, :body => 'arole'})
10
9
  Excon.stub({:method => :get, :path => "/latest/meta-data/placement/availability-zone/"}, {:status => 200, :body => 'us-west-1a'})
11
10
 
@@ -17,7 +16,6 @@ Shindo.tests('AWS | credentials', ['aws']) do
17
16
  'Expiration' => expires_at.xmlschema
18
17
  }
19
18
 
20
- Fog::Compute::AWS::Mock.data[:iam_role_based_creds] = credentials
21
19
  Excon.stub({:method => :get, :path => "/latest/meta-data/iam/security-credentials/arole"}, {:status => 200, :body => Fog::JSON.encode(credentials)})
22
20
 
23
21
  tests("#fetch_credentials") do
@@ -60,16 +58,29 @@ Shindo.tests('AWS | credentials', ['aws']) do
60
58
  end
61
59
  Fog::Time.now = Time.now
62
60
 
61
+ default_credentials = Fog::Compute::AWS.fetch_credentials({})
63
62
  tests("#fetch_credentials when the url 404s") do
64
63
  Excon.stub({:method => :get, :path => "/latest/meta-data/iam/security-credentials/"}, {:status => 404, :body => 'not bound'})
65
64
  Excon.stub({:method => :get, :path => "/latest/meta-data/placement/availability-zone/"}, {:status => 400, :body => 'not found'})
66
65
  returns(default_credentials) {Fog::Compute::AWS.fetch_credentials(:use_iam_profile => true)}
67
66
  end
68
67
 
68
+ mocked_credentials = {
69
+ :aws_access_key_id => "access-key-id",
70
+ :aws_secret_access_key => "secret-access-key",
71
+ :aws_session_token => "session-token",
72
+ :aws_credentials_expire_at => Time.at(Time.now.to_i + 500).xmlschema
73
+ }
74
+ tests("#fetch_credentials when mocking") do
75
+ Fog.mock!
76
+ Fog::Compute::AWS::Mock.data[:iam_role_based_creds] = mocked_credentials
77
+ returns(mocked_credentials) {Fog::Compute::AWS.fetch_credentials(:use_iam_profile => true)}
78
+ end
79
+
69
80
  ensure
70
81
  ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"] = nil
71
82
  Excon.stubs.clear
72
83
  Excon.defaults[:mock] = old_mock_value
73
- Fog.unmock! if !fog_was_mocked
84
+ Fog.mock! if fog_was_mocked
74
85
  end
75
86
  end
@@ -0,0 +1,33 @@
1
+ require 'fog/xml'
2
+ require 'fog/aws/parsers/compute/describe_images'
3
+
4
+ DESCRIBE_IMAGES_RESULT = <<-EOF
5
+ <DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
6
+ <requestId>180a8433-ade0-4a6c-b35b-107897579572</requestId>
7
+ <imagesSet>
8
+ <item>
9
+ <imageId>aki-02486376</imageId>
10
+ <imageLocation>ec2-public-images-eu/vmlinuz-2.6.21-2.fc8xen-ec2-v1.0.i386.aki.manifest.xml</imageLocation>
11
+ <imageState>available</imageState>
12
+ <imageOwnerId>206029621532</imageOwnerId>
13
+ <creationDate/>
14
+ <isPublic>true</isPublic>
15
+ <architecture>i386</architecture>
16
+ <imageType>kernel</imageType>
17
+ <imageOwnerAlias>amazon</imageOwnerAlias>
18
+ <rootDeviceType>instance-store</rootDeviceType>
19
+ <blockDeviceMapping/>
20
+ <virtualizationType>paravirtual</virtualizationType>
21
+ <hypervisor>xen</hypervisor>
22
+ </item>
23
+ </imagesSet>
24
+ </DescribeImagesResponse>
25
+ EOF
26
+
27
+ Shindo.tests('Compute::AWS | parsers | describe_images', ['compute', 'aws', 'parser']) do
28
+ tests('parses the xml').formats(AWS::Compute::Formats::DESCRIBE_IMAGES) do
29
+ parser = Nokogiri::XML::SAX::Parser.new(Fog::Parsers::Compute::AWS::DescribeImages.new)
30
+ parser.parse(DESCRIBE_IMAGES_RESULT)
31
+ parser.document.response
32
+ end
33
+ end
@@ -2,9 +2,26 @@ class AWS
2
2
  module Compute
3
3
  module Formats
4
4
  BASIC = {
5
- 'requestId' => String,
6
- 'return' => ::Fog::Boolean
5
+ 'requestId' => String
7
6
  }
7
+
8
+ DESCRIBE_IMAGES = BASIC.merge({
9
+ "imagesSet" => [{
10
+ "imageId" => String,
11
+ "imageLocation" => String,
12
+ "imageState" => String,
13
+ "imageOwnerId" => String,
14
+ "creationDate" => Fog::Nullable::String,
15
+ "isPublic" => Fog::Nullable::Boolean,
16
+ "architecture" => String,
17
+ "imageType" => String,
18
+ "imageOwnerAlias" => String,
19
+ "rootDeviceType" => String,
20
+ "blockDeviceMapping" => Array,
21
+ "virtualizationType" => String,
22
+ "hypervisor" => String
23
+ }]
24
+ })
8
25
  end
9
26
  end
10
27
  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: 1.4.0
4
+ version: 1.4.1
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: 2017-06-14 00:00:00.000000000 Z
12
+ date: 2017-08-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -1533,6 +1533,7 @@ files:
1533
1533
  - tests/models/storage/version_tests.rb
1534
1534
  - tests/models/storage/versions_tests.rb
1535
1535
  - tests/models/support/trusted_advisor_tests.rb
1536
+ - tests/parsers/compute/describe_images_tests.rb
1536
1537
  - tests/parsers/elb/describe_load_balancers.rb
1537
1538
  - tests/requests/auto_scaling/auto_scaling_tests.rb
1538
1539
  - tests/requests/auto_scaling/describe_types_tests.rb
@@ -1699,7 +1700,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1699
1700
  version: '0'
1700
1701
  requirements: []
1701
1702
  rubyforge_project:
1702
- rubygems_version: 2.6.12
1703
+ rubygems_version: 2.6.11
1703
1704
  signing_key:
1704
1705
  specification_version: 4
1705
1706
  summary: Module for the 'fog' gem to support Amazon Web Services.