fog-aws 1.4.1 → 2.0.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.
- checksums.yaml +4 -4
- data/.travis.yml +9 -8
- data/CHANGELOG.md +40 -2
- data/CONTRIBUTING.md +6 -6
- data/CONTRIBUTORS.md +104 -1
- data/LICENSE.md +1 -1
- data/fog-aws.gemspec +4 -2
- data/lib/fog/aws.rb +1 -0
- data/lib/fog/aws/compute.rb +86 -2
- data/lib/fog/aws/credential_fetcher.rb +4 -2
- data/lib/fog/aws/mock.rb +8 -0
- data/lib/fog/aws/models/compute/flavors.rb +40 -0
- data/lib/fog/aws/models/compute/subnet.rb +1 -0
- data/lib/fog/aws/models/compute/vpc.rb +11 -2
- data/lib/fog/aws/models/iam/access_keys.rb +0 -2
- data/lib/fog/aws/models/rds/instance_option.rb +6 -0
- data/lib/fog/aws/parsers/compute/create_subnet.rb +2 -0
- data/lib/fog/aws/parsers/compute/describe_subnets.rb +1 -1
- data/lib/fog/aws/parsers/compute/describe_vpcs.rb +71 -37
- data/lib/fog/aws/parsers/iam/list_access_keys.rb +1 -1
- data/lib/fog/aws/parsers/rds/describe_orderable_db_instance_options.rb +4 -3
- data/lib/fog/aws/requests/auto_scaling/detach_instances.rb +3 -4
- data/lib/fog/aws/requests/compute/authorize_security_group_egress.rb +8 -6
- data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +25 -21
- data/lib/fog/aws/requests/compute/copy_snapshot.rb +22 -9
- data/lib/fog/aws/requests/compute/create_network_interface.rb +2 -2
- data/lib/fog/aws/requests/compute/create_route_table.rb +1 -1
- data/lib/fog/aws/requests/compute/create_security_group.rb +24 -19
- data/lib/fog/aws/requests/compute/create_subnet.rb +14 -10
- data/lib/fog/aws/requests/compute/create_vpc.rb +38 -10
- data/lib/fog/aws/requests/compute/delete_security_group.rb +9 -9
- data/lib/fog/aws/requests/compute/describe_network_interface_attribute.rb +16 -14
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +30 -6
- data/lib/fog/aws/requests/compute/describe_subnets.rb +12 -11
- data/lib/fog/aws/requests/compute/modify_network_interface_attribute.rb +3 -3
- data/lib/fog/aws/requests/compute/revoke_security_group_egress.rb +19 -25
- data/lib/fog/aws/requests/compute/revoke_security_group_ingress.rb +18 -25
- data/lib/fog/aws/requests/compute/run_instances.rb +1 -1
- data/lib/fog/aws/requests/efs/create_mount_target.rb +8 -4
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +6 -37
- data/lib/fog/aws/requests/kinesis/put_record.rb +1 -2
- data/lib/fog/aws/requests/kinesis/put_records.rb +1 -2
- data/lib/fog/aws/requests/lambda/invoke.rb +1 -1
- data/lib/fog/aws/requests/rds/describe_orderable_db_instance_options.rb +12 -6
- data/lib/fog/aws/requests/storage/put_object.rb +0 -1
- data/lib/fog/aws/service_mapper.rb +129 -0
- data/lib/fog/aws/version.rb +1 -1
- data/tests/helpers/collection_helper.rb +0 -6
- data/tests/models/efs/mount_target_tests.rb +3 -1
- data/tests/models/elasticache/subnet_groups_tests.rb +0 -1
- data/tests/models/storage/file_tests.rb +0 -4
- data/tests/models/storage/url_tests.rb +1 -20
- data/tests/models/storage/versions_tests.rb +0 -5
- data/tests/requests/compute/network_interface_tests.rb +2 -13
- data/tests/requests/compute/subnet_tests.rb +3 -1
- data/tests/requests/compute/vpc_tests.rb +8 -6
- data/tests/requests/dns/dns_tests.rb +0 -4
- data/tests/requests/efs/file_system_tests.rb +1 -1
- data/tests/requests/iam/managed_policy_tests.rb +0 -1
- data/tests/requests/iam/versioned_managed_policy_tests.rb +3 -12
- data/tests/requests/lambda/helper.rb +2 -2
- data/tests/requests/rds/helper.rb +7 -2
- data/tests/requests/rds/instance_option_tests.rb +7 -1
- data/tests/requests/storage/object_tests.rb +2 -11
- metadata +9 -10
- data/gemfiles/Gemfile-ruby-1.8.7 +0 -6
- data/gemfiles/Gemfile-ruby-1.9 +0 -7
@@ -10,6 +10,7 @@ module Fog
|
|
10
10
|
attribute :availability_zone, :aliases => 'availabilityZone'
|
11
11
|
attribute :tag_set, :aliases => 'tagSet'
|
12
12
|
attribute :map_public_ip_on_launch, :aliases => 'mapPublicIpOnLaunch'
|
13
|
+
attribute :default_for_az, :aliases => 'defaultForAz'
|
13
14
|
|
14
15
|
def ready?
|
15
16
|
requires :state
|
@@ -10,8 +10,17 @@ module Fog
|
|
10
10
|
attribute :tags, :aliases => 'tagSet'
|
11
11
|
attribute :tenancy, :aliases => 'instanceTenancy'
|
12
12
|
attribute :is_default, :aliases => 'isDefault'
|
13
|
-
|
14
|
-
attribute :
|
13
|
+
|
14
|
+
attribute :cidr_block_association_set, :aliases => 'cidrBlockAssociationSet'
|
15
|
+
|
16
|
+
attribute :ipv6_cidr_block_association_set, :aliases => 'ipv6CidrBlockAssociationSet'
|
17
|
+
attribute :amazon_provided_ipv6_cidr_block, :aliases => 'amazonProvidedIpv6CidrBlock'
|
18
|
+
|
19
|
+
# Backward compatibility. Please use ipv6_cidr_block_association_set
|
20
|
+
alias_method :ipv_6_cidr_block_association_set, :ipv6_cidr_block_association_set
|
21
|
+
alias_method :ipv_6_cidr_block_association_set=, :ipv6_cidr_block_association_set=
|
22
|
+
alias_method :amazon_provided_ipv_6_cidr_block, :amazon_provided_ipv6_cidr_block
|
23
|
+
alias_method :amazon_provided_ipv_6_cidr_block=, :amazon_provided_ipv6_cidr_block=
|
15
24
|
|
16
25
|
def subnets
|
17
26
|
service.subnets(:filters => {'vpcId' => self.identity}).all
|
@@ -10,6 +10,12 @@ module Fog
|
|
10
10
|
attribute :availability_zones, :aliases => 'AvailabilityZones', :type => :array
|
11
11
|
attribute :db_instance_class, :aliases => 'DBInstanceClass'
|
12
12
|
attribute :vpc, :aliases => 'Vpc', :type => :boolean
|
13
|
+
attribute :supports_iops, :aliases => 'SupportsIops', :type => :boolean
|
14
|
+
attribute :supports_enhanced_monitoring, :aliases => 'SupportsEnhancedMonitoring', :type => :boolean
|
15
|
+
attribute :supports_iam_database_authentication, :aliases => 'SupportsIAMDatabaseAuthentication', :type => :boolean
|
16
|
+
attribute :supports_performance_insights, :aliases => 'SupportsPerformanceInsights', :type => :boolean
|
17
|
+
attribute :supports_storage_encryption, :aliases => 'SupportsStorageEncryption', :type => :boolean
|
18
|
+
attribute :storage_type, :aliases => 'StorageType'
|
13
19
|
end
|
14
20
|
end
|
15
21
|
end
|
@@ -32,6 +32,8 @@ module Fog
|
|
32
32
|
case name
|
33
33
|
when 'subnetId', 'state', 'vpcId', 'cidrBlock', 'availableIpAddressCount', 'availabilityZone'
|
34
34
|
@subnet[name] = value
|
35
|
+
when 'mapPublicIpOnLaunch', 'defaultForAz'
|
36
|
+
@subnet[name] = value == 'true' ? true : false
|
35
37
|
when 'subnet'
|
36
38
|
@response['subnet'] = @subnet
|
37
39
|
when 'requestId'
|
@@ -32,7 +32,7 @@ module Fog
|
|
32
32
|
case name
|
33
33
|
when 'subnetId', 'state', 'vpcId', 'cidrBlock', 'availableIpAddressCount', 'availabilityZone'
|
34
34
|
@subnet[name] = value
|
35
|
-
when 'mapPublicIpOnLaunch'
|
35
|
+
when 'mapPublicIpOnLaunch', 'defaultForAz'
|
36
36
|
@subnet[name] = value == 'true' ? true : false
|
37
37
|
when 'item'
|
38
38
|
@response['subnetSet'] << @subnet
|
@@ -4,55 +4,89 @@ module Fog
|
|
4
4
|
module AWS
|
5
5
|
class DescribeVpcs < Fog::Parsers::Base
|
6
6
|
def reset
|
7
|
-
@vpc = { 'tagSet' => {}, 'ipv6CidrBlockAssociationSet' => {} }
|
8
7
|
@response = { 'vpcSet' => [] }
|
9
|
-
@
|
8
|
+
@context = []
|
10
9
|
end
|
11
10
|
|
12
11
|
def start_element(name, attrs = [])
|
13
12
|
super
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
@context.push(name)
|
14
|
+
|
15
|
+
case @context[1 .. -1].join('.')
|
16
|
+
when 'vpcSet.item'
|
17
|
+
@current_vpc = { 'tagSet' => {}, 'cidrBlockAssociationSet' => [], 'ipv6CidrBlockAssociationSet' => [] }
|
18
|
+
|
19
|
+
when 'vpcSet.item.tagSet.item'
|
20
|
+
@current_tag_key = @current_tag_value = nil
|
21
|
+
|
22
|
+
when 'vpcSet.item.cidrBlockAssociationSet.item'
|
23
|
+
@current_cidr_block = {}
|
24
|
+
|
25
|
+
when 'vpcSet.item.ipv6CidrBlockAssociationSet.item'
|
26
|
+
@current_ipv6_block = {}
|
19
27
|
end
|
20
28
|
end
|
21
29
|
|
22
30
|
def end_element(name)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
@
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
when '
|
46
|
-
@
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
31
|
+
case @context[1 .. -1].join('.')
|
32
|
+
# tagSet
|
33
|
+
|
34
|
+
when 'vpcSet.item.tagSet.item'
|
35
|
+
@current_vpc['tagSet'][@current_tag_key] = @current_tag_value
|
36
|
+
@current_tag_key = @current_tag_value = nil
|
37
|
+
|
38
|
+
when 'vpcSet.item.tagSet.item.key'
|
39
|
+
@current_tag_key = value
|
40
|
+
|
41
|
+
when 'vpcSet.item.tagSet.item.value'
|
42
|
+
@current_tag_value = value
|
43
|
+
|
44
|
+
# cidrBlockAssociationSet
|
45
|
+
|
46
|
+
when 'vpcSet.item.cidrBlockAssociationSet.item.cidrBlock',
|
47
|
+
'vpcSet.item.cidrBlockAssociationSet.item.associationId'
|
48
|
+
@current_cidr_block[name] = value
|
49
|
+
|
50
|
+
when 'vpcSet.item.cidrBlockAssociationSet.item.cidrBlockState'
|
51
|
+
@current_cidr_block['state'] = value.strip
|
52
|
+
|
53
|
+
when 'vpcSet.item.cidrBlockAssociationSet.item'
|
54
|
+
@current_vpc['cidrBlockAssociationSet'] << @current_cidr_block
|
55
|
+
|
56
|
+
# ipv6CidrBlockAssociationSet
|
57
|
+
|
58
|
+
when 'vpcSet.item.ipv6CidrBlockAssociationSet.item.ipv6CidrBlock',
|
59
|
+
'vpcSet.item.ipv6CidrBlockAssociationSet.item.associationId'
|
60
|
+
@current_ipv6_block[name] = value
|
61
|
+
|
62
|
+
when 'vpcSet.item.ipv6CidrBlockAssociationSet.item.ipv6CidrBlockState'
|
63
|
+
@current_ipv6_block['state'] = value.strip
|
64
|
+
|
65
|
+
when 'vpcSet.item.ipv6CidrBlockAssociationSet.item'
|
66
|
+
@current_vpc['ipv6CidrBlockAssociationSet'] << @current_ipv6_block
|
67
|
+
|
68
|
+
# vpc
|
69
|
+
|
70
|
+
when 'vpcSet.item.vpcId',
|
71
|
+
'vpcSet.item.state',
|
72
|
+
'vpcSet.item.cidrBlock',
|
73
|
+
'vpcSet.item.dhcpOptionsId',
|
74
|
+
'vpcSet.item.instanceTenancy'
|
75
|
+
@current_vpc[name] = value
|
76
|
+
|
77
|
+
when 'vpcSet.item.isDefault'
|
78
|
+
@current_vpc['isDefault'] = value == 'true'
|
79
|
+
|
80
|
+
when 'vpcSet.item'
|
81
|
+
@response['vpcSet'] << @current_vpc
|
82
|
+
|
83
|
+
# root
|
84
|
+
|
52
85
|
when 'requestId'
|
53
86
|
@response[name] = value
|
54
|
-
end
|
55
87
|
end
|
88
|
+
|
89
|
+
@context.pop
|
56
90
|
end
|
57
91
|
end
|
58
92
|
end
|
@@ -19,12 +19,13 @@ module Fog
|
|
19
19
|
|
20
20
|
def end_element(name)
|
21
21
|
case name
|
22
|
-
when 'MultiAZCapable', 'ReadReplicaCapable', 'Vpc'
|
23
|
-
|
22
|
+
when 'MultiAZCapable', 'ReadReplicaCapable', 'Vpc', 'SupportsIops',
|
23
|
+
'SupportsEnhancedMonitoring', 'SupportsIAMDatabaseAuthentication',
|
24
|
+
'SupportsPerformanceInsights', 'SupportsStorageEncryption' then @db_instance_option[name] = to_boolean(value)
|
25
|
+
when 'Engine', 'LicenseModel', 'EngineVersion', 'DBInstanceClass', 'StorageType' then @db_instance_option[name] = value
|
24
26
|
when 'AvailabilityZones' then @db_instance_option[name] = @availability_zones
|
25
27
|
when 'AvailabilityZone' then @availability_zones << @availability_zone unless @availability_zone.empty?
|
26
28
|
when 'Name' then @availability_zone[name] = value
|
27
|
-
when 'ProvisionedIopsCapable' then @availability_zone[name] = to_boolean(value)
|
28
29
|
when 'OrderableDBInstanceOption'
|
29
30
|
@db_instance_options << @db_instance_option
|
30
31
|
@db_instance_option = {}
|
@@ -13,9 +13,7 @@ module Fog
|
|
13
13
|
#
|
14
14
|
# * AutoScalingGroupName<~String> - The name of the Auto Scaling group``
|
15
15
|
# * 'InstanceIds'<~Array> - The list of Auto Scaling instances to detach.
|
16
|
-
#
|
17
|
-
# * options<~Hash>:
|
18
|
-
# 'shouldDecrementDesiredCapacity'<~Boolean> - decrement the asg capacity or not (it will boot another if an instance id detached)
|
16
|
+
# * ShouldDecrementDesiredCapacity<~Boolean> - decrement the asg capacity or not (it will boot another if an instance id detached)
|
19
17
|
#
|
20
18
|
# ==== See Also
|
21
19
|
#
|
@@ -23,6 +21,7 @@ module Fog
|
|
23
21
|
|
24
22
|
ExpectedOptions[:asg_name] = %w[AutoScalingGroupName]
|
25
23
|
ExpectedOptions[:instance_ids] = %w[InstanceIds]
|
24
|
+
ExpectedOptions[:should_decrement_desired_capacity] = %w[ShouldDecrementDesiredCapacity]
|
26
25
|
|
27
26
|
def detach_instances(auto_scaling_group_name, options = {})
|
28
27
|
|
@@ -46,7 +45,7 @@ module Fog
|
|
46
45
|
|
47
46
|
class Mock
|
48
47
|
def detach_instances(auto_scaling_group_name, options = {})
|
49
|
-
unexpected_options = options.keys - ExpectedOptions[:asg_name] - ExpectedOptions[:instance_ids]
|
48
|
+
unexpected_options = options.keys - ExpectedOptions[:asg_name] - ExpectedOptions[:instance_ids] - ExpectedOptions[:should_decrement_desired_capacity]
|
50
49
|
|
51
50
|
unless unexpected_options.empty?
|
52
51
|
raise Fog::AWS::AutoScaling::ValidationError.new("Options #{unexpected_options.join(',')} should not be included in request")
|
@@ -57,14 +57,16 @@ module Fog
|
|
57
57
|
class Mock
|
58
58
|
def authorize_security_group_egress(group_name, options = {})
|
59
59
|
options = Fog::AWS.parse_security_group_options(group_name, options)
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
|
61
|
+
group = if options.key?('GroupName')
|
62
|
+
self.data[:security_groups].values.find { |v| v['groupName'] == options['GroupName'] }
|
63
|
+
else
|
64
|
+
self.data[:security_groups][options.fetch('GroupId')]
|
65
|
+
end
|
65
66
|
|
66
67
|
response = Excon::Response.new
|
67
|
-
group
|
68
|
+
group ||
|
69
|
+
raise(Fog::Compute::AWS::NotFound.new("The security group '#{group_name}' does not exist"))
|
68
70
|
|
69
71
|
verify_permission_options(options, group['vpcId'] != nil)
|
70
72
|
|
@@ -80,14 +80,16 @@ module Fog
|
|
80
80
|
class Mock
|
81
81
|
def authorize_security_group_ingress(group_name, options = {})
|
82
82
|
options = Fog::AWS.parse_security_group_options(group_name, options)
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
|
84
|
+
group = if options.key?('GroupName')
|
85
|
+
self.data[:security_groups].values.find { |v| v['groupName'] == options['GroupName'] }
|
86
|
+
else
|
87
|
+
self.data[:security_groups][options.fetch('GroupId')]
|
88
|
+
end
|
88
89
|
|
89
90
|
response = Excon::Response.new
|
90
|
-
group
|
91
|
+
group ||
|
92
|
+
raise(Fog::Compute::AWS::NotFound.new("The security group '#{group_name}' does not exist"))
|
91
93
|
|
92
94
|
verify_permission_options(options, group['vpcId'] != nil)
|
93
95
|
|
@@ -150,14 +152,15 @@ module Fog
|
|
150
152
|
else
|
151
153
|
options['SourceSecurityGroupName']
|
152
154
|
end
|
153
|
-
source_group_id=self.data[:security_groups][
|
155
|
+
source_group_id, _ = self.data[:security_groups].find { |_,v| v['groupName'] == group_name }
|
156
|
+
|
154
157
|
['tcp', 'udp'].each do |protocol|
|
155
158
|
normalized_permissions << {
|
156
159
|
'ipProtocol' => protocol,
|
157
160
|
'fromPort' => 1,
|
158
161
|
'toPort' => 65535,
|
159
162
|
'groups' => [{
|
160
|
-
'groupName' =>
|
163
|
+
'groupName' => group_name,
|
161
164
|
'userId' => options['SourceSecurityGroupOwnerId'] || self.data[:owner_id],
|
162
165
|
'groupId' => source_group_id
|
163
166
|
}],
|
@@ -169,7 +172,7 @@ module Fog
|
|
169
172
|
'fromPort' => -1,
|
170
173
|
'toPort' => -1,
|
171
174
|
'groups' => [{
|
172
|
-
'groupName' =>
|
175
|
+
'groupName' => group_name,
|
173
176
|
'userId' => options['SourceSecurityGroupOwnerId'] || self.data[:owner_id],
|
174
177
|
'groupId' => source_group_id
|
175
178
|
}],
|
@@ -188,18 +191,19 @@ module Fog
|
|
188
191
|
|
189
192
|
groups = (permission['Groups'] || []).map do |authorized_group|
|
190
193
|
security_group = if group_name = authorized_group['GroupName']
|
191
|
-
self.data[:security_groups][group_name
|
194
|
+
self.data[:security_groups].values.find { |sg| sg['groupName'] == group_name }
|
192
195
|
elsif group_id = authorized_group['GroupId']
|
193
|
-
self.data[:security_groups]
|
194
|
-
end
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
196
|
+
self.data[:security_groups][group_id]
|
197
|
+
end
|
198
|
+
security_group ||
|
199
|
+
raise(Fog::Compute::AWS::NotFound.new("The security group '#{group_name || group_id}' does not exist"))
|
200
|
+
|
201
|
+
{
|
202
|
+
'groupName' => authorized_group['GroupName'] || security_group['groupName'],
|
203
|
+
'userId' => authorized_group['UserId'] || self.data[:owner_id],
|
204
|
+
'groupId' => authorized_group["GroupId"] || security_group['groupId']
|
205
|
+
}
|
206
|
+
end
|
203
207
|
|
204
208
|
|
205
209
|
if ['tcp', 'udp', 'icmp'].include?(permission['IpProtocol'])
|
@@ -208,7 +212,7 @@ module Fog
|
|
208
212
|
'fromPort' => Integer(permission['FromPort']),
|
209
213
|
'toPort' => Integer(permission['ToPort']),
|
210
214
|
'groups' => groups,
|
211
|
-
'ipRanges'
|
215
|
+
'ipRanges' => (permission['IpRanges'] || []).map {|r| { 'cidrIp' => r['CidrIp'] } }
|
212
216
|
}
|
213
217
|
else
|
214
218
|
normalized_permissions << {
|
@@ -9,6 +9,11 @@ module Fog
|
|
9
9
|
# ==== Parameters
|
10
10
|
# * source_snapshot_id<~String> - Id of snapshot
|
11
11
|
# * source_region<~String> - Region to move it from
|
12
|
+
# * options<~Hash>:
|
13
|
+
# * 'Description'<~String> - A description for the EBS snapshot
|
14
|
+
# * 'Encrypted'<~Boolean> - Specifies whether the destination snapshot should be encrypted
|
15
|
+
# * 'KmsKeyId'<~String> - The full ARN of the AWS Key Management Service (AWS KMS) CMK
|
16
|
+
# to use when creating the snapshot copy.
|
12
17
|
#
|
13
18
|
# ==== Returns
|
14
19
|
# * response<~Excon::Response>:
|
@@ -17,14 +22,22 @@ module Fog
|
|
17
22
|
# * 'snapshotId'<~String> - id of snapshot
|
18
23
|
#
|
19
24
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CopySnapshot.html]
|
20
|
-
def copy_snapshot(source_snapshot_id, source_region,
|
21
|
-
|
22
|
-
|
23
|
-
'
|
24
|
-
'
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def copy_snapshot(source_snapshot_id, source_region, options = {})
|
26
|
+
# For backward compatibility. In previous versions third param was a description
|
27
|
+
if options.is_a?(String)
|
28
|
+
Fog::Logger.warning("copy_snapshot with description as a string in third param is deprecated, use hash instead: copy_snapshot('source-id', 'source-region', { 'Description' => 'some description' })")
|
29
|
+
options = { 'Description' => options }
|
30
|
+
end
|
31
|
+
params = {
|
32
|
+
'Action' => 'CopySnapshot',
|
33
|
+
'SourceSnapshotId' => source_snapshot_id,
|
34
|
+
'SourceRegion' => source_region,
|
35
|
+
'Description' => options['Description'],
|
36
|
+
:parser => Fog::Parsers::Compute::AWS::CopySnapshot.new
|
37
|
+
}
|
38
|
+
params['Encrypted'] = true if options['Encrypted']
|
39
|
+
params['KmsKeyId'] = options['KmsKeyId'] if options['Encrypted'] && options['KmsKeyId']
|
40
|
+
request(params)
|
28
41
|
end
|
29
42
|
end
|
30
43
|
|
@@ -35,7 +48,7 @@ module Fog
|
|
35
48
|
# Fog::AWS[:compute].copy_snapshot("snap-1db0a957", 'us-east-1')
|
36
49
|
#
|
37
50
|
|
38
|
-
def copy_snapshot(source_snapshot_id, source_region,
|
51
|
+
def copy_snapshot(source_snapshot_id, source_region, options = {})
|
39
52
|
response = Excon::Response.new
|
40
53
|
response.status = 200
|
41
54
|
snapshot_id = Fog::AWS::Mock.snapshot_id
|
@@ -73,11 +73,11 @@ module Fog
|
|
73
73
|
groups = {}
|
74
74
|
if options['GroupSet']
|
75
75
|
options['GroupSet'].each do |group_id|
|
76
|
-
group_obj = self.data[:security_groups]
|
76
|
+
group_obj = self.data[:security_groups][group_id]
|
77
77
|
if group_obj.nil?
|
78
78
|
raise Fog::Compute::AWS::Error.new("Unknown security group '#{group_id}' specified")
|
79
79
|
end
|
80
|
-
groups[group_id] = group_obj
|
80
|
+
groups[group_id] = group_obj['groupName']
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -39,7 +39,7 @@ module Fog
|
|
39
39
|
unless vpc.nil?
|
40
40
|
response.status = 200
|
41
41
|
route_table = {
|
42
|
-
'routeTableId' =>
|
42
|
+
'routeTableId' => Fog::AWS::Mock.route_table_id,
|
43
43
|
'vpcId' => vpc["vpcId"],
|
44
44
|
'routeSet' => [{
|
45
45
|
"destinationCidrBlock" => vpc["cidrBlock"],
|
@@ -33,26 +33,31 @@ module Fog
|
|
33
33
|
class Mock
|
34
34
|
def create_security_group(name, description, vpc_id=nil)
|
35
35
|
response = Excon::Response.new
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
'
|
43
|
-
'ownerId' => self.data[:owner_id],
|
44
|
-
'vpcId' => vpc_id
|
45
|
-
}
|
46
|
-
self.data[:security_groups][name] = data
|
47
|
-
response.body = {
|
48
|
-
'requestId' => Fog::AWS::Mock.request_id,
|
49
|
-
'groupId' => data['groupId'],
|
50
|
-
'return' => true
|
51
|
-
}
|
52
|
-
response
|
53
|
-
else
|
54
|
-
raise Fog::Compute::AWS::Error.new("InvalidGroup.Duplicate => The security group '#{name}' already exists")
|
36
|
+
|
37
|
+
vpc_id ||= Fog::AWS::Mock.default_vpc_for(region)
|
38
|
+
group_id = Fog::AWS::Mock.security_group_id
|
39
|
+
|
40
|
+
if self.data[:security_groups].find { |_,v| v['groupName'] == name }
|
41
|
+
raise Fog::Compute::AWS::Error,
|
42
|
+
"InvalidGroup.Duplicate => The security group '#{name}' already exists"
|
55
43
|
end
|
44
|
+
|
45
|
+
self.data[:security_groups][group_id] = {
|
46
|
+
'groupDescription' => description,
|
47
|
+
'groupName' => name,
|
48
|
+
'groupId' => group_id,
|
49
|
+
'ipPermissionsEgress' => [],
|
50
|
+
'ipPermissions' => [],
|
51
|
+
'ownerId' => self.data[:owner_id],
|
52
|
+
'vpcId' => vpc_id
|
53
|
+
}
|
54
|
+
|
55
|
+
response.body = {
|
56
|
+
'requestId' => Fog::AWS::Mock.request_id,
|
57
|
+
'groupId' => group_id,
|
58
|
+
'return' => true
|
59
|
+
}
|
60
|
+
response
|
56
61
|
end
|
57
62
|
end
|
58
63
|
end
|