fog-aws 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -1
  3. data/lib/fog/aws/compute.rb +6 -0
  4. data/lib/fog/aws/models/compute/flavors.rb +60 -0
  5. data/lib/fog/aws/models/compute/volume.rb +41 -22
  6. data/lib/fog/aws/models/compute/vpc.rb +34 -0
  7. data/lib/fog/aws/models/rds/security_group.rb +4 -2
  8. data/lib/fog/aws/models/storage/file.rb +1 -1
  9. data/lib/fog/aws/parsers/compute/describe_volumes_modifications.rb +30 -0
  10. data/lib/fog/aws/parsers/compute/describe_vpc_classic_link.rb +3 -1
  11. data/lib/fog/aws/parsers/compute/describe_vpc_classic_link_dns_support.rb +26 -0
  12. data/lib/fog/aws/parsers/compute/modify_volume.rb +26 -0
  13. data/lib/fog/aws/rds.rb +1 -1
  14. data/lib/fog/aws/requests/compute/attach_classic_link_vpc.rb +3 -3
  15. data/lib/fog/aws/requests/compute/create_vpc.rb +10 -9
  16. data/lib/fog/aws/requests/compute/describe_volumes_modifications.rb +93 -0
  17. data/lib/fog/aws/requests/compute/describe_vpc_classic_link.rb +2 -1
  18. data/lib/fog/aws/requests/compute/describe_vpc_classic_link_dns_support.rb +53 -0
  19. data/lib/fog/aws/requests/compute/detach_classic_link_vpc.rb +1 -3
  20. data/lib/fog/aws/requests/compute/disable_vpc_classic_link_dns_support.rb +45 -0
  21. data/lib/fog/aws/requests/compute/enable_vpc_classic_link_dns_support.rb +45 -0
  22. data/lib/fog/aws/requests/compute/modify_volume.rb +88 -0
  23. data/lib/fog/aws/requests/rds/authorize_db_security_group_ingress.rb +10 -5
  24. data/lib/fog/aws/requests/rds/create_db_subnet_group.rb +3 -4
  25. data/lib/fog/aws/requests/rds/delete_db_subnet_group.rb +2 -0
  26. data/lib/fog/aws/requests/rds/revoke_db_security_group_ingress.rb +9 -4
  27. data/lib/fog/aws/version.rb +1 -1
  28. data/tests/models/compute/volume_tests.rb +16 -1
  29. data/tests/models/compute/vpc_tests.rb +23 -1
  30. data/tests/models/rds/security_group_tests.rb +30 -6
  31. data/tests/requests/compute/volume_tests.rb +42 -2
  32. data/tests/requests/compute/vpc_tests.rb +41 -5
  33. metadata +10 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e768fc1ff288fe562ed0dd7c933c719dcdc33f4
4
- data.tar.gz: 526f5ba1b58f9ba023ef1567b5a9cd79334f7212
3
+ metadata.gz: 507acde666f266cc70e6346a9274bcf1e1bff19c
4
+ data.tar.gz: 105bb905004f27b5336ff4f17feb006164feef21
5
5
  SHA512:
6
- metadata.gz: 71f1af91375c2b20e8de2ca347fb5c1ae7e62f2606b5cab88813a89c3a5cdaeb41da1d30000caf47eb8e2d2e8ffe2b405a893944d23016bc5a8e085842e74a3c
7
- data.tar.gz: 23faf3f32d79b4da048189a3e1a3261c62e30425091cc3964f467af4d3f0b12a835951a0ba56a03f18df2191086e2e94b8868616db4a39d44e5aa3e00d95f590
6
+ metadata.gz: 6403c1fc64c5cc9396f4671118897c6be37aa49e88b09f8e96cdbe9f5ef68f18e087ec52a03755d53f04c4991f4616f6064e386bff3cdaa0d5dd084e7537d43e
7
+ data.tar.gz: d5e45bdab2ee7dca720cc549ba6dd0202f1d9d60d98c3b2e178e36fb6910c72ac069a6197c2cf6167b8741067bc2d41280ace84430f0c2c59afe3580d1cb7f15
@@ -2,7 +2,22 @@
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.2.0...HEAD)
5
+ [Full Changelog](https://github.com/fog/fog-aws/compare/v1.2.1...HEAD)
6
+
7
+ **Closed issues:**
8
+
9
+ - Do we need to list all files before creating one? [\#357](https://github.com/fog/fog-aws/issues/357)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Authorize vpc to rds sg [\#356](https://github.com/fog/fog-aws/pull/356) ([ehowe](https://github.com/ehowe))
14
+ - classic link enhancements [\#355](https://github.com/fog/fog-aws/pull/355) ([ehowe](https://github.com/ehowe))
15
+ - Add new i3 class instances. [\#353](https://github.com/fog/fog-aws/pull/353) ([rogersd](https://github.com/rogersd))
16
+ - Add check for self.etag before running gsub [\#351](https://github.com/fog/fog-aws/pull/351) ([dmcorboy](https://github.com/dmcorboy))
17
+ - Modify volume [\#350](https://github.com/fog/fog-aws/pull/350) ([ehowe](https://github.com/ehowe))
18
+
19
+ ## [v1.2.1](https://github.com/fog/fog-aws/tree/v1.2.1) (2017-02-27)
20
+ [Full Changelog](https://github.com/fog/fog-aws/compare/v1.2.0...v1.2.1)
6
21
 
7
22
  **Closed issues:**
8
23
 
@@ -120,18 +120,22 @@ module Fog
120
120
  request :describe_subnets
121
121
  request :describe_tags
122
122
  request :describe_volumes
123
+ request :describe_volumes_modifications
123
124
  request :describe_volume_status
124
125
  request :describe_vpcs
125
126
  request :describe_vpc_attribute
126
127
  request :describe_vpc_classic_link
128
+ request :describe_vpc_classic_link_dns_support
127
129
  request :detach_network_interface
128
130
  request :detach_internet_gateway
129
131
  request :detach_volume
130
132
  request :detach_classic_link_vpc
131
133
  request :disable_vpc_classic_link
134
+ request :disable_vpc_classic_link_dns_support
132
135
  request :disassociate_address
133
136
  request :disassociate_route_table
134
137
  request :enable_vpc_classic_link
138
+ request :enable_vpc_classic_link_dns_support
135
139
  request :get_console_output
136
140
  request :get_password_data
137
141
  request :import_key_pair
@@ -140,6 +144,7 @@ module Fog
140
144
  request :modify_network_interface_attribute
141
145
  request :modify_snapshot_attribute
142
146
  request :modify_subnet_attribute
147
+ request :modify_volume
143
148
  request :modify_volume_attribute
144
149
  request :modify_vpc_attribute
145
150
  request :move_address_to_vpc
@@ -290,6 +295,7 @@ module Fog
290
295
  }
291
296
  ],
292
297
  :spot_requests => {},
298
+ :volume_modifications => {}
293
299
  }
294
300
  end
295
301
  end
@@ -424,6 +424,66 @@ module Fog
424
424
  :ebs_optimized_available => false,
425
425
  :instance_store_volumes => 8
426
426
  },
427
+ {
428
+ :id => 'i3.large',
429
+ :name => 'I3 Large',
430
+ :bits => 64,
431
+ :cores => 2,
432
+ :disk => 475,
433
+ :ram => 15616,
434
+ :ebs_optimized_available => true,
435
+ :instance_store_volumes => 1
436
+ },
437
+ {
438
+ :id => 'i3.xlarge',
439
+ :name => 'I3 Extra Large',
440
+ :bits => 64,
441
+ :cores => 4,
442
+ :disk => 950,
443
+ :ram => 31232,
444
+ :ebs_optimized_available => true,
445
+ :instance_store_volumes => 1
446
+ },
447
+ {
448
+ :id => 'i3.2xlarge',
449
+ :name => 'I3 Double Extra Large',
450
+ :bits => 64,
451
+ :cores => 8,
452
+ :disk => 1900,
453
+ :ram => 62464,
454
+ :ebs_optimized_available => true,
455
+ :instance_store_volumes => 1
456
+ },
457
+ {
458
+ :id => 'i3.4xlarge',
459
+ :name => 'I3 Quadruple Extra Large',
460
+ :bits => 64,
461
+ :cores => 16,
462
+ :disk => 3800,
463
+ :ram => 124928,
464
+ :ebs_optimized_available => true,
465
+ :instance_store_volumes => 2
466
+ },
467
+ {
468
+ :id => 'i3.8xlarge',
469
+ :name => 'I3 Eight Extra Large',
470
+ :bits => 64,
471
+ :cores => 32,
472
+ :disk => 7600,
473
+ :ram => 249856,
474
+ :ebs_optimized_available => true,
475
+ :instance_store_volumes => 4
476
+ },
477
+ {
478
+ :id => 'i3.16xlarge',
479
+ :name => 'I3 Sixteen Extra Large',
480
+ :bits => 64,
481
+ :cores => 32,
482
+ :disk => 15200,
483
+ :ram => 499712,
484
+ :ebs_optimized_available => true,
485
+ :instance_store_volumes => 8
486
+ },
427
487
  {
428
488
  :id => "r3.large",
429
489
  :name => "R3 Large",
@@ -36,31 +36,50 @@ module Fog
36
36
  state == 'available'
37
37
  end
38
38
 
39
- def save
40
- raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
41
- requires :availability_zone
42
- requires_one :size, :snapshot_id
43
-
44
- if type == 'io1'
45
- requires :iops
46
- end
47
-
48
- data = service.create_volume(availability_zone, size, create_params).body
49
- merge_attributes(data)
39
+ def modification_in_progress?
40
+ modifications.any? { |m| m['modificationState'] != 'completed' }
41
+ end
50
42
 
51
- if tags = self.tags
52
- # expect eventual consistency
53
- Fog.wait_for { self.reload rescue nil }
54
- service.create_tags(
55
- self.identity,
56
- tags
57
- )
58
- end
43
+ def modifications
44
+ requires :identity
45
+ service.describe_volumes_modifications('volume-id' => self.identity).body['volumeModificationSet']
46
+ end
59
47
 
60
- if @server
61
- self.server = @server
48
+ def save
49
+ if identity
50
+ update_params = {
51
+ 'Size' => self.size,
52
+ 'Iops' => self.iops,
53
+ 'VolumeType' => self.type
54
+ }
55
+
56
+ service.modify_volume(self.identity, update_params)
57
+ true
58
+ else
59
+ requires :availability_zone
60
+ requires_one :size, :snapshot_id
61
+
62
+ if type == 'io1'
63
+ requires :iops
64
+ end
65
+
66
+ data = service.create_volume(availability_zone, size, create_params).body
67
+ merge_attributes(data)
68
+
69
+ if tags = self.tags
70
+ # expect eventual consistency
71
+ Fog.wait_for { self.reload rescue nil }
72
+ service.create_tags(
73
+ self.identity,
74
+ tags
75
+ )
76
+ end
77
+
78
+ if @server
79
+ self.server = @server
80
+ end
81
+ true
62
82
  end
63
- true
64
83
  end
65
84
 
66
85
  def server
@@ -47,6 +47,40 @@ module Fog
47
47
  true
48
48
  end
49
49
 
50
+ def classic_link_enabled?
51
+ requires :identity
52
+ service.describe_vpc_classic_link(:vpc_ids => [self.identity]).body['vpcSet'].first['classicLinkEnabled']
53
+ rescue
54
+ nil
55
+ end
56
+
57
+ def enable_classic_link
58
+ requires :identity
59
+ service.enable_vpc_classic_link(self.identity).body['return']
60
+ end
61
+
62
+ def disable_classic_link
63
+ requires :identity
64
+ service.disable_vpc_classic_link(self.identity).body['return']
65
+ end
66
+
67
+ def classic_link_dns_enabled?
68
+ requires :identity
69
+ service.describe_vpc_classic_link_dns_support(:vpc_ids => [self.identity]).body['vpcs'].first['classicLinkDnsSupported']
70
+ rescue
71
+ nil
72
+ end
73
+
74
+ def enable_classic_link_dns
75
+ requires :identity
76
+ service.enable_vpc_classic_link_dns_support(self.identity).body['return']
77
+ end
78
+
79
+ def disable_classic_link_dns
80
+ requires :identity
81
+ service.disable_vpc_classic_link_dns_support(self.identity).body['return']
82
+ end
83
+
50
84
  # Create a vpc
51
85
  #
52
86
  # >> g = AWS.vpcs.new(:cidr_block => "10.1.2.0/24")
@@ -29,8 +29,9 @@ module Fog
29
29
 
30
30
  # group_owner_id defaults to the current owner_id
31
31
  def authorize_ec2_security_group(group_name, group_owner_id=owner_id)
32
+ key = group_name.match(/^sg-/) ? 'EC2SecurityGroupId' : 'EC2SecurityGroupName'
32
33
  authorize_ingress({
33
- 'EC2SecurityGroupName' => group_name,
34
+ key => group_name,
34
35
  'EC2SecurityGroupOwnerId' => group_owner_id
35
36
  })
36
37
  end
@@ -56,8 +57,9 @@ module Fog
56
57
 
57
58
  # group_owner_id defaults to the current owner_id
58
59
  def revoke_ec2_security_group(group_name, group_owner_id=owner_id)
60
+ key = group_name.match(/^sg-/) ? 'EC2SecurityGroupId' : 'EC2SecurityGroupName'
59
61
  revoke_ingress({
60
- 'EC2SecurityGroupName' => group_name,
62
+ key => group_name,
61
63
  'EC2SecurityGroupOwnerId' => group_owner_id
62
64
  })
63
65
  end
@@ -219,7 +219,7 @@ module Fog
219
219
  data = service.put_object(directory.key, key, body, options)
220
220
  merge_attributes(data.headers.reject {|key, value| ['Content-Length', 'Content-Type'].include?(key)})
221
221
  end
222
- self.etag.gsub!('"','')
222
+ self.etag.gsub!('"','') if self.etag
223
223
  self.content_length = Fog::Storage.get_body_size(body)
224
224
  self.content_type ||= Fog::Storage.get_content_type(body)
225
225
  true
@@ -0,0 +1,30 @@
1
+ module Fog
2
+ module Parsers
3
+ module Compute
4
+ module AWS
5
+ class DescribeVolumesModifications < Fog::Parsers::Base
6
+ def reset
7
+ @response = { 'volumeModificationSet' => [] }
8
+ @modification = {}
9
+ end
10
+
11
+ def end_element(name)
12
+ case name
13
+ when 'modificationState', 'originalVolumeType', 'statusMessage', 'targetVolumeType', 'volumeId'
14
+ @modification[name] = value
15
+ when 'startTime', 'endTime'
16
+ @modification[name] = Time.parse(value)
17
+ when 'originalIops', 'originalSize', 'progress', 'targetIops', 'targetSize'
18
+ @modification[name] = value.to_i
19
+ when 'requestId'
20
+ @response[name] = value
21
+ when 'item'
22
+ @response['volumeModificationSet'] << @modification.dup
23
+ @modification = {}
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -30,8 +30,10 @@ module Fog
30
30
  end
31
31
  else
32
32
  case name
33
- when 'vpcId', 'classicLinkEnabled'
33
+ when 'vpcId'
34
34
  @vpc[name] = value
35
+ when 'classicLinkEnabled'
36
+ @vpc[name] = value == 'true'
35
37
  when 'item'
36
38
  @response['vpcSet'] << @vpc
37
39
  @vpc = { 'tagSet' => {} }
@@ -0,0 +1,26 @@
1
+ module Fog
2
+ module Parsers
3
+ module Compute
4
+ module AWS
5
+ class DescribeVpcClassicLinkDnsSupport < Fog::Parsers::Base
6
+ def reset
7
+ @vpc = {}
8
+ @response = { 'vpcs' => [] }
9
+ end
10
+
11
+ def end_element(name)
12
+ case name
13
+ when 'vpcId'
14
+ @vpc[name] = value
15
+ when 'classicLinkDnsSupported'
16
+ @vpc[name] = value == 'true'
17
+ when 'item'
18
+ @response['vpcs'] << @vpc
19
+ @vpc = {}
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Fog
2
+ module Parsers
3
+ module Compute
4
+ module AWS
5
+ class ModifyVolume < Fog::Parsers::Base
6
+ def reset
7
+ @response = {'volumeModification' => {}}
8
+ end
9
+
10
+ def end_element(name)
11
+ case name
12
+ when 'modificationState', 'originalVolumeType', 'statusMessage', 'targetVolumeType', 'volumeId'
13
+ @response['volumeModification'][name] = value
14
+ when 'startTime', 'endTime'
15
+ @response['volumeModification'][name] = Time.parse(value)
16
+ when 'originalIops', 'originalSize', 'progress', 'targetIops', 'targetSize'
17
+ @response['volumeModification'][name] = value.to_i
18
+ when 'requestId'
19
+ @response[name] = value
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -164,7 +164,7 @@ module Fog
164
164
  @data = nil
165
165
  end
166
166
 
167
- attr_accessor :region
167
+ attr_accessor :region, :aws_access_key_id
168
168
 
169
169
  def initialize(options={})
170
170
  @use_iam_profile = options[:use_iam_profile]
@@ -26,7 +26,7 @@ module Fog
26
26
  'DryRun' => dry_run,
27
27
  :parser => Fog::Parsers::Compute::AWS::Basic.new
28
28
  }.merge(Fog::AWS.indexed_param('SecurityGroupId', security_group_ids)))
29
-
29
+
30
30
  end
31
31
  end
32
32
 
@@ -50,11 +50,11 @@ module Fog
50
50
  'return' => true
51
51
  }
52
52
  unless dry_run
53
- instance['classicLinkSecurityGroups'] = security_group_ids
53
+ instance['classicLinkSecurityGroups'] = security_group_ids
54
54
  instance['classicLinkVpcId'] = vpc_id
55
55
  end
56
56
  response
57
- elsif !instance
57
+ elsif !instance
58
58
  raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_id}' does not exist.")
59
59
  elsif !vpc
60
60
  raise Fog::Compute::AWS::NotFound.new("The VPC '#{vpc_id}' does not exist.")
@@ -43,15 +43,16 @@ module Fog
43
43
  response.status = 200
44
44
  vpc_id = Fog::AWS::Mock.vpc_id
45
45
  vpc = {
46
- 'vpcId' => vpc_id,
47
- 'state' => 'pending',
48
- 'cidrBlock' => cidrBlock,
49
- 'dhcpOptionsId' => Fog::AWS::Mock.request_id,
50
- 'tagSet' => {},
51
- 'enableDnsSupport' => true,
52
- 'enableDnsHostnames' => false,
53
- 'mapPublicIpOnLaunch'=> false,
54
- 'classicLinkEnabled' => false
46
+ 'vpcId' => vpc_id,
47
+ 'state' => 'pending',
48
+ 'cidrBlock' => cidrBlock,
49
+ 'dhcpOptionsId' => Fog::AWS::Mock.request_id,
50
+ 'tagSet' => {},
51
+ 'enableDnsSupport' => true,
52
+ 'enableDnsHostnames' => false,
53
+ 'mapPublicIpOnLaunch' => false,
54
+ 'classicLinkEnabled' => false,
55
+ 'classicLinkDnsSupport' => false
55
56
  }
56
57
  self.data[:vpcs].push(vpc)
57
58