fog-aws 0.12.0 → 0.13.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 +2 -0
- data/CHANGELOG.md +29 -1
- data/Gemfile +6 -2
- data/gemfiles/Gemfile-edge +1 -1
- data/lib/fog/aws.rb +3 -1
- data/lib/fog/aws/efs.rb +177 -0
- data/lib/fog/aws/models/auto_scaling/group.rb +2 -0
- data/lib/fog/aws/models/compute/image.rb +2 -0
- data/lib/fog/aws/models/compute/images.rb +3 -1
- data/lib/fog/aws/models/compute/vpc.rb +4 -0
- data/lib/fog/aws/models/efs/file_system.rb +42 -0
- data/lib/fog/aws/models/efs/file_systems.rb +23 -0
- data/lib/fog/aws/models/efs/mount_target.rb +59 -0
- data/lib/fog/aws/models/efs/mount_targets.rb +25 -0
- data/lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb +8 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_change_set.rb +1 -1
- data/lib/fog/aws/parsers/compute/describe_images.rb +3 -1
- data/lib/fog/aws/parsers/rds/modify_db_subnet_group.rb +24 -0
- data/lib/fog/aws/rds.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +1 -0
- data/lib/fog/aws/requests/auto_scaling/put_scaling_policy.rb +1 -1
- data/lib/fog/aws/requests/cloud_formation/create_change_set.rb +5 -0
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +4 -0
- data/lib/fog/aws/requests/compute/describe_images.rb +2 -0
- data/lib/fog/aws/requests/efs/create_file_system.rb +51 -0
- data/lib/fog/aws/requests/efs/create_mount_target.rb +69 -0
- data/lib/fog/aws/requests/efs/delete_file_system.rb +41 -0
- data/lib/fog/aws/requests/efs/delete_mount_target.rb +38 -0
- data/lib/fog/aws/requests/efs/describe_file_systems.rb +62 -0
- data/lib/fog/aws/requests/efs/describe_mount_target_security_groups.rb +34 -0
- data/lib/fog/aws/requests/efs/describe_mount_targets.rb +61 -0
- data/lib/fog/aws/requests/efs/modify_mount_target_security_groups.rb +39 -0
- data/lib/fog/aws/requests/rds/modify_db_subnet_group.rb +27 -0
- data/lib/fog/aws/requests/storage/delete_multiple_objects.rb +1 -1
- data/lib/fog/aws/requests/sts/assume_role.rb +25 -0
- data/lib/fog/aws/version.rb +1 -1
- data/tests/helper.rb +3 -2
- data/tests/models/efs/file_system_tests.rb +12 -0
- data/tests/models/efs/mount_target_tests.rb +43 -0
- data/tests/models/efs/mount_targets_tests.rb +30 -0
- data/tests/requests/auto_scaling/helper.rb +1 -0
- data/tests/requests/compute/image_tests.rb +3 -1
- data/tests/requests/efs/file_system_tests.rb +152 -0
- data/tests/requests/efs/helper.rb +42 -0
- data/tests/requests/storage/object_tests.rb +4 -0
- metadata +23 -2
@@ -0,0 +1,34 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class EFS
|
4
|
+
class Real
|
5
|
+
# Describe mount target security groups
|
6
|
+
# http://docs.aws.amazon.com/efs/latest/ug/API_DescribeMountTargetSecurityGroups.html
|
7
|
+
# ==== Parameters
|
8
|
+
# * MountTargetId - Id of the mount target for which you want to describe security groups
|
9
|
+
# ==== Returns
|
10
|
+
# * response<~Excon::Response>
|
11
|
+
# * body<~Hash>
|
12
|
+
|
13
|
+
def describe_mount_target_security_groups(mount_target_id)
|
14
|
+
request(
|
15
|
+
:path => "mount-targets/#{mount_target_id}/security-groups"
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Mock
|
21
|
+
def describe_mount_target_security_groups(mount_target_id)
|
22
|
+
response = Excon::Response.new
|
23
|
+
|
24
|
+
unless self.data[:mount_targets][mount_target_id]
|
25
|
+
raise Fog::AWS::EFS::NotFound.new("invalid mount target ID: #{mount_target_id}")
|
26
|
+
end
|
27
|
+
|
28
|
+
response.body = {"SecurityGroups" => self.data[:security_groups][mount_target_id]}
|
29
|
+
response
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class EFS
|
4
|
+
class Real
|
5
|
+
# Describe all mount targets for a filesystem, or specified mount target
|
6
|
+
# http://docs.aws.amazon.com/efs/latest/ug/API_DescribeMountTargets.html
|
7
|
+
# ==== Parameters
|
8
|
+
# * FileSystemId<~String> - Id of file system to describe mount targets for. Required unless MountTargetId is specified
|
9
|
+
# * MountTargetId<~String> - Specific mount target to describe. Required if FileSystemId is not specified
|
10
|
+
# ==== Returns
|
11
|
+
# * response<~Excon::Response>
|
12
|
+
# * body<~Hash>
|
13
|
+
def describe_mount_targets(options={})
|
14
|
+
params = {}
|
15
|
+
if options[:marker]
|
16
|
+
params['Marker'] = options[:marker]
|
17
|
+
end
|
18
|
+
if options[:max_records]
|
19
|
+
params['MaxRecords'] = options[:max_records]
|
20
|
+
end
|
21
|
+
if options[:id]
|
22
|
+
params['MountTargetId'] = options[:id]
|
23
|
+
end
|
24
|
+
if options[:file_system_id]
|
25
|
+
params['FileSystemId'] = options[:file_system_id]
|
26
|
+
end
|
27
|
+
|
28
|
+
request({
|
29
|
+
:path => "mount-targets"
|
30
|
+
}.merge(params))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class Mock
|
35
|
+
def describe_mount_targets(options={})
|
36
|
+
response = Excon::Response.new
|
37
|
+
|
38
|
+
mount_targets = if id = options[:id]
|
39
|
+
if mount_target = self.data[:mount_targets][id]
|
40
|
+
[mount_target]
|
41
|
+
else
|
42
|
+
raise Fog::AWS::EFS::NotFound.new("Mount target does not exist.")
|
43
|
+
end
|
44
|
+
elsif file_system_id = options[:file_system_id]
|
45
|
+
self.data[:mount_targets].values.select { |mt| mt["FileSystemId"] == file_system_id }
|
46
|
+
else
|
47
|
+
raise Fog::AWS::EFS::Error.new("file system ID or mount target ID must be specified")
|
48
|
+
end
|
49
|
+
|
50
|
+
mount_targets.each do |mount_target|
|
51
|
+
mount_target['LifeCycleState'] = 'available'
|
52
|
+
self.data[:mount_targets][mount_target["MountTargetId"]] = mount_target
|
53
|
+
end
|
54
|
+
|
55
|
+
response.body = {"MountTargets" => mount_targets}
|
56
|
+
response
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class EFS
|
4
|
+
class Real
|
5
|
+
def modify_mount_target_security_groups(id, security_groups)
|
6
|
+
request({
|
7
|
+
:path => "mount-targets/#{id}/security-groups",
|
8
|
+
:method => "PUT",
|
9
|
+
:expects => 204,
|
10
|
+
'SecurityGroups' => security_groups
|
11
|
+
})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
def modify_mount_target_security_groups(id, security_groups)
|
17
|
+
if security_groups.nil? || security_groups.empty?
|
18
|
+
raise Fog::AWS::EFS::Error.new("Must provide at least one security group.")
|
19
|
+
end
|
20
|
+
|
21
|
+
response = Excon::Response.new
|
22
|
+
|
23
|
+
unless self.data[:mount_targets][id]
|
24
|
+
raise Fog::AWS::EFS::NotFound.new("invalid mount target ID: #{id}")
|
25
|
+
end
|
26
|
+
|
27
|
+
security_groups.each do |sg|
|
28
|
+
raise Fog::AWS::EFS::NotFound.new("invalid security group ID: #{sg}") unless mock_compute.data[:security_groups].values.detect { |sgd| sgd["groupId"] == sg }
|
29
|
+
end
|
30
|
+
|
31
|
+
self.data[:security_groups][id] = security_groups
|
32
|
+
|
33
|
+
response.status = 204
|
34
|
+
response
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class RDS
|
4
|
+
class Real
|
5
|
+
require 'fog/aws/parsers/rds/modify_db_subnet_group.rb'
|
6
|
+
|
7
|
+
# Creates a db subnet group
|
8
|
+
# http://docs.aws.amazon.com/AmazonRDS/2012-01-15/APIReference/API_ModifyDBSubnetGroup.html
|
9
|
+
# ==== Parameters
|
10
|
+
# * DBSubnetGroupName <~String> - The name for the DB Subnet Group. This value is stored as a lowercase string. Must contain no more than 255 alphanumeric characters or hyphens. Must not be "Default".
|
11
|
+
# * SubnetIds <~Array> - The EC2 Subnet IDs for the DB Subnet Group.
|
12
|
+
# * DBSubnetGroupDescription <~String> - The description for the DB Subnet Group
|
13
|
+
# ==== Returns
|
14
|
+
# * response<~Excon::Response>:
|
15
|
+
# * body<~Hash>:
|
16
|
+
def modify_db_subnet_group(name, subnet_ids, description = nil)
|
17
|
+
params = { 'Action' => 'ModifyDBSubnetGroup',
|
18
|
+
'DBSubnetGroupName' => name,
|
19
|
+
'DBSubnetGroupDescription' => description,
|
20
|
+
:parser => Fog::Parsers::AWS::RDS::ModifyDBSubnetGroup.new }
|
21
|
+
params.merge!(Fog::AWS.indexed_param("SubnetIds.member", Array(subnet_ids)))
|
22
|
+
request(params)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -39,6 +39,31 @@ module Fog
|
|
39
39
|
})
|
40
40
|
end
|
41
41
|
end
|
42
|
+
|
43
|
+
class Mock
|
44
|
+
def assume_role(role_session_name, role_arn, external_id=nil, policy=nil, duration=3600)
|
45
|
+
account_id = /[0-9]{12}/.match(role_arn)
|
46
|
+
request_id = Fog::AWS::Mock.request_id
|
47
|
+
|
48
|
+
Excon::Response.new.tap do |response|
|
49
|
+
response.status = 200
|
50
|
+
|
51
|
+
response.body = {
|
52
|
+
'Arn' => "arn:aws:sts::#{account_id}:assumed-role/#{role_session_name}/#{role_session_name}",
|
53
|
+
'AssumedRoleId' => "#{Fog::Mock.random_base64(21)}:#{role_session_name}",
|
54
|
+
'AccessKeyId' => Fog::Mock.random_base64(20),
|
55
|
+
'SecretAccessKey' => Fog::Mock.random_base64(40),
|
56
|
+
'SessionToken' => Fog::Mock.random_base64(580),
|
57
|
+
'Expiration' => (Time.now + duration).utc.iso8601,
|
58
|
+
'RequestId' => request_id,
|
59
|
+
}
|
60
|
+
|
61
|
+
response.headers = {
|
62
|
+
'x-amzn-RequestId' => request_id,
|
63
|
+
}
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
42
67
|
end
|
43
68
|
end
|
44
69
|
end
|
data/lib/fog/aws/version.rb
CHANGED
data/tests/helper.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
Shindo.tests("AWS::EFS | file system", ["aws", "efs"]) do
|
2
|
+
file_system_params = {
|
3
|
+
:creation_token => "fogtoken#{rand(999).to_s}"
|
4
|
+
}
|
5
|
+
|
6
|
+
model_tests(Fog::AWS[:efs].file_systems, file_system_params, true)
|
7
|
+
|
8
|
+
file_system_params = {
|
9
|
+
:creation_token => "fogtoken#{rand(999).to_s}"
|
10
|
+
}
|
11
|
+
collection_tests(Fog::AWS[:efs].file_systems, file_system_params, true)
|
12
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
Shindo.tests("AWS::EFS | mount target", ["aws", "efs"]) do
|
2
|
+
@file_system = Fog::AWS[:efs].file_systems.create(:creation_token => "fogtoken#{rand(999).to_s}")
|
3
|
+
@file_system.wait_for { ready? }
|
4
|
+
|
5
|
+
if Fog.mocking?
|
6
|
+
vpc = Fog::Compute[:aws].vpcs.create(:cidr_block => "10.0.0.0/16")
|
7
|
+
subnet = Fog::Compute[:aws].subnets.create(:vpc_id => vpc.id, :cidr_block => "10.0.1.0/24")
|
8
|
+
default_security_group_data = Fog::Compute[:aws].data[:security_groups]['default']
|
9
|
+
default_security_group = Fog::Compute[:aws].security_groups.new(default_security_group_data)
|
10
|
+
else
|
11
|
+
vpc = Fog::Compute[:aws].vpcs.first
|
12
|
+
subnet = vpc.subnets.first
|
13
|
+
default_security_group = Fog::Compute[:aws].security_groups.detect { |sg| sg.description == 'default VPC security group' }
|
14
|
+
end
|
15
|
+
|
16
|
+
security_group = Fog::Compute[:aws].security_groups.create(
|
17
|
+
:vpc_id => vpc.id,
|
18
|
+
:name => "fog#{rand(999).to_s}",
|
19
|
+
:description => "fog#{rand(999).to_s}"
|
20
|
+
)
|
21
|
+
|
22
|
+
mount_target_params = {
|
23
|
+
:file_system_id => @file_system.identity,
|
24
|
+
:subnet_id => subnet.identity,
|
25
|
+
}
|
26
|
+
|
27
|
+
model_tests(Fog::AWS[:efs].mount_targets, mount_target_params, true) do
|
28
|
+
@instance.wait_for { ready? }
|
29
|
+
|
30
|
+
tests("#security_groups") do
|
31
|
+
returns([default_security_group.group_id]) { @instance.security_groups }
|
32
|
+
end
|
33
|
+
|
34
|
+
tests("#security_groups=") do
|
35
|
+
@instance.security_groups = [security_group.group_id]
|
36
|
+
returns([security_group.group_id]) { @instance.security_groups }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
@file_system.wait_for { number_of_mount_targets == 0 }
|
41
|
+
@file_system.destroy
|
42
|
+
security_group.destroy
|
43
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Shindo.tests("AWS::EFS | mount targets", ["aws", "efs"]) do
|
2
|
+
@file_system = Fog::AWS[:efs].file_systems.create(:creation_token => "fogtoken#{rand(999).to_s}")
|
3
|
+
@file_system.wait_for { ready? }
|
4
|
+
|
5
|
+
if Fog.mocking?
|
6
|
+
vpc = Fog::Compute[:aws].vpcs.create(:cidr_block => "10.0.0.0/16")
|
7
|
+
subnet = Fog::Compute[:aws].subnets.create(:vpc_id => vpc.id, :cidr_block => "10.0.1.0/24")
|
8
|
+
else
|
9
|
+
vpc = Fog::Compute[:aws].vpcs.first
|
10
|
+
subnet = vpc.subnets.first
|
11
|
+
end
|
12
|
+
|
13
|
+
security_group = Fog::Compute[:aws].security_groups.create(
|
14
|
+
:vpc_id => vpc.id,
|
15
|
+
:name => "fog#{rand(999).to_s}",
|
16
|
+
:description => "fog#{rand(999).to_s}"
|
17
|
+
)
|
18
|
+
|
19
|
+
mount_target_params = {
|
20
|
+
:file_system_id => @file_system.identity,
|
21
|
+
:subnet_id => subnet.identity,
|
22
|
+
:security_groups => [security_group.group_id]
|
23
|
+
}
|
24
|
+
|
25
|
+
collection_tests(Fog::AWS[:efs].mount_targets(:file_system_id => @file_system.identity), mount_target_params, true)
|
26
|
+
|
27
|
+
@file_system.wait_for { number_of_mount_targets == 0 }
|
28
|
+
@file_system.destroy
|
29
|
+
security_group.destroy
|
30
|
+
end
|
@@ -21,7 +21,9 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
|
|
21
21
|
'rootDeviceType' => String,
|
22
22
|
'stateReason' => {},
|
23
23
|
'tagSet' => {},
|
24
|
-
'virtualizationType' => String
|
24
|
+
'virtualizationType' => String,
|
25
|
+
'creationDate' => Fog::Nullable::Time,
|
26
|
+
'enaSupport' => Fog::Nullable::Boolean
|
25
27
|
}],
|
26
28
|
'requestId' => String,
|
27
29
|
}
|
@@ -0,0 +1,152 @@
|
|
1
|
+
Shindo.tests('AWS::EFS | file systems', ['aws', 'efs']) do
|
2
|
+
suffix = rand(65535).to_s(16)
|
3
|
+
|
4
|
+
@creation_token = "fogtest#{suffix}"
|
5
|
+
|
6
|
+
tests('success') do
|
7
|
+
tests("#create_file_system('#{@creation_token}')").formats(AWS::EFS::Formats::FILE_SYSTEM_FORMAT) do
|
8
|
+
result = Fog::AWS[:efs].create_file_system(@creation_token).body
|
9
|
+
returns('creating') { result['LifeCycleState'] }
|
10
|
+
result
|
11
|
+
end
|
12
|
+
|
13
|
+
tests("#describe_file_systems").formats(AWS::EFS::Formats::DESCRIBE_FILE_SYSTEMS_RESULT) do
|
14
|
+
Fog::AWS[:efs].describe_file_systems.body
|
15
|
+
end
|
16
|
+
|
17
|
+
tests("#describe_file_systems(creation_token: #{@creation_token})").formats(AWS::EFS::Formats::DESCRIBE_FILE_SYSTEMS_RESULT) do
|
18
|
+
result = Fog::AWS[:efs].describe_file_systems(:creation_token => @creation_token).body
|
19
|
+
returns(@creation_token) { result["FileSystems"].first["CreationToken"] }
|
20
|
+
result
|
21
|
+
end
|
22
|
+
|
23
|
+
file_system_id = Fog::AWS[:efs].describe_file_systems(:creation_token => @creation_token).body["FileSystems"].first["FileSystemId"]
|
24
|
+
file_system = Fog::AWS[:efs].file_systems.get(file_system_id)
|
25
|
+
|
26
|
+
tests("#describe_file_systems(id: #{file_system_id})").formats(AWS::EFS::Formats::DESCRIBE_FILE_SYSTEMS_RESULT) do
|
27
|
+
Fog::AWS[:efs].describe_file_systems(:id => file_system_id).body
|
28
|
+
end
|
29
|
+
|
30
|
+
if Fog.mocking?
|
31
|
+
vpc = Fog::Compute[:aws].vpcs.create(:cidr_block => "10.0.0.0/16")
|
32
|
+
subnet = Fog::Compute[:aws].subnets.create(
|
33
|
+
:vpc_id => vpc.id,
|
34
|
+
:cidr_block => "10.0.1.0/24"
|
35
|
+
)
|
36
|
+
default_security_group = Fog::Compute[:aws].security_groups.detect { |sg| sg.description == 'default group' }
|
37
|
+
else
|
38
|
+
vpc = Fog::Compute[:aws].vpcs.first
|
39
|
+
subnet = vpc.subnets.first
|
40
|
+
default_security_group = Fog::Compute[:aws].security_groups.detect { |sg| sg.description == 'default VPC security group' }
|
41
|
+
end
|
42
|
+
|
43
|
+
security_group = Fog::Compute[:aws].security_groups.create(
|
44
|
+
:vpc_id => vpc.id,
|
45
|
+
:name => "fog#{suffix}",
|
46
|
+
:description => "fog#{suffix}"
|
47
|
+
)
|
48
|
+
|
49
|
+
raises(Fog::AWS::EFS::InvalidSubnet, "invalid subnet ID: foobar#{suffix}") do
|
50
|
+
Fog::AWS[:efs].create_mount_target(file_system_id, "foobar#{suffix}")
|
51
|
+
end
|
52
|
+
|
53
|
+
raises(Fog::AWS::EFS::NotFound, "invalid file system ID: foobar#{suffix}") do
|
54
|
+
Fog::AWS[:efs].create_mount_target("foobar#{suffix}", subnet.identity)
|
55
|
+
end
|
56
|
+
|
57
|
+
if Fog.mocking?
|
58
|
+
tests("#create_mount_target") do
|
59
|
+
Fog::AWS[:efs].data[:file_systems][file_system_id]["LifeCycleState"] = 'creating'
|
60
|
+
raises(Fog::AWS::EFS::IncorrectFileSystemLifeCycleState) do
|
61
|
+
Fog::AWS[:efs].create_mount_target(file_system_id, subnet.identity)
|
62
|
+
end
|
63
|
+
|
64
|
+
Fog::AWS[:efs].data[:file_systems][file_system_id]["LifeCycleState"] = 'available'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
raises(Fog::AWS::EFS::NotFound, "invalid security group ID: foobar#{suffix}") do
|
69
|
+
Fog::AWS[:efs].create_mount_target(file_system_id, subnet.identity, 'SecurityGroups' => ["foobar#{suffix}"])
|
70
|
+
end
|
71
|
+
|
72
|
+
tests("#create_mount_target(#{file_system_id}, #{subnet.identity})").formats(AWS::EFS::Formats::MOUNT_TARGET_FORMAT) do
|
73
|
+
Fog::AWS[:efs].create_mount_target(file_system_id, subnet.identity).body
|
74
|
+
end
|
75
|
+
|
76
|
+
tests("#describe_mount_targets(file_system_id: #{file_system_id})").formats(AWS::EFS::Formats::DESCRIBE_MOUNT_TARGETS_RESULT) do
|
77
|
+
Fog::AWS[:efs].describe_mount_targets(:file_system_id => file_system_id).body
|
78
|
+
end
|
79
|
+
|
80
|
+
mount_target_id = Fog::AWS[:efs].describe_mount_targets(:file_system_id => file_system_id).body["MountTargets"].first["MountTargetId"]
|
81
|
+
|
82
|
+
tests("#describe_mount_target_security_groups(#{mount_target_id})").formats(AWS::EFS::Formats::DESCRIBE_MOUNT_TARGET_SECURITY_GROUPS_FORMAT) do
|
83
|
+
result = Fog::AWS[:efs].describe_mount_target_security_groups(mount_target_id).body
|
84
|
+
returns([default_security_group.group_id]) { result["SecurityGroups"] }
|
85
|
+
result
|
86
|
+
end
|
87
|
+
|
88
|
+
raises(Fog::AWS::EFS::Error, 'Must provide at least one security group.') do
|
89
|
+
Fog::AWS[:efs].modify_mount_target_security_groups(mount_target_id, [])
|
90
|
+
end
|
91
|
+
|
92
|
+
tests("#modify_mount_target_security_groups(#{mount_target_id}, [#{security_group.group_id}])") do
|
93
|
+
returns(204) do
|
94
|
+
Fog::AWS[:efs].modify_mount_target_security_groups(mount_target_id, [security_group.group_id]).status
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
Fog.wait_for { Fog::AWS[:efs].describe_mount_target_security_groups(mount_target_id).body["SecurityGroups"] != [default_security_group.group_id] }
|
99
|
+
|
100
|
+
tests("#describe_mount_target_security_groups(#{mount_target_id})").formats(AWS::EFS::Formats::DESCRIBE_MOUNT_TARGET_SECURITY_GROUPS_FORMAT) do
|
101
|
+
result = Fog::AWS[:efs].describe_mount_target_security_groups(mount_target_id).body
|
102
|
+
returns([security_group.group_id]) { result["SecurityGroups"] }
|
103
|
+
result
|
104
|
+
end
|
105
|
+
|
106
|
+
tests("#describe_mount_targets(id: #{mount_target_id})").formats(AWS::EFS::Formats::DESCRIBE_MOUNT_TARGETS_RESULT) do
|
107
|
+
Fog::AWS[:efs].describe_mount_targets(:id => mount_target_id).body
|
108
|
+
end
|
109
|
+
|
110
|
+
raises(Fog::AWS::EFS::NotFound, 'Mount target does not exist.') do
|
111
|
+
Fog::AWS[:efs].describe_mount_targets(:id => "foobar")
|
112
|
+
end
|
113
|
+
|
114
|
+
raises(Fog::AWS::EFS::Error, 'file system ID or mount target ID must be specified') do
|
115
|
+
Fog::AWS[:efs].describe_mount_targets
|
116
|
+
end
|
117
|
+
|
118
|
+
raises(Fog::AWS::EFS::NotFound, "invalid mount target id: foobar#{suffix}") do
|
119
|
+
Fog::AWS[:efs].delete_mount_target("foobar#{suffix}")
|
120
|
+
end
|
121
|
+
|
122
|
+
tests("#delete_mount_target(id: #{mount_target_id})") do
|
123
|
+
returns(true) do
|
124
|
+
result = Fog::AWS[:efs].delete_mount_target(mount_target_id)
|
125
|
+
result.body.empty?
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
file_system.wait_for { number_of_mount_targets == 0 }
|
130
|
+
|
131
|
+
if Fog.mocking?
|
132
|
+
Fog::AWS[:efs].data[:file_systems][file_system_id]["NumberOfMountTargets"] = 1
|
133
|
+
raises(Fog::AWS::EFS::FileSystemInUse) do
|
134
|
+
Fog::AWS[:efs].delete_file_system(file_system_id)
|
135
|
+
end
|
136
|
+
Fog::AWS[:efs].data[:file_systems][file_system_id]["NumberOfMountTargets"] = 0
|
137
|
+
end
|
138
|
+
|
139
|
+
raises(Fog::AWS::EFS::NotFound, "invalid file system ID: foobar#{suffix}") do
|
140
|
+
Fog::AWS[:efs].delete_file_system("foobar#{suffix}")
|
141
|
+
end
|
142
|
+
|
143
|
+
tests("#delete_file_system") do
|
144
|
+
returns(true) do
|
145
|
+
result = Fog::AWS[:efs].delete_file_system(file_system_id)
|
146
|
+
result.body.empty?
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
security_group.destroy
|
151
|
+
end
|
152
|
+
end
|