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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: badc87e616be93da06befa9fd46e268c422729db
|
4
|
+
data.tar.gz: 35e964f02dbd63c4b6911fca95bf53e72fffa4b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6ca15f2dcb849b4f9a1bdf89fe9c22b9b69c5e8f916223f75158cf70adab53bbe70d3bff1b782823d022173b56e5a4b94cf3dfadc1d1815b52625406ba9ea5b
|
7
|
+
data.tar.gz: 87078c05b1e205f2230cb37b60cc65c57db0b694969bb88bb757d5b5c0127f77f900e79cf035ce392632843d49b11dfaf81fae8a3ba1b93f068d09bc89f8a178
|
data/.travis.yml
CHANGED
@@ -50,3 +50,5 @@ notifications:
|
|
50
50
|
env:
|
51
51
|
global:
|
52
52
|
secure: LlDKdKSRo3sEjQ55XesbOXhKZ3RrOtqoD1ZL8Wx39K3iVzeEV3Kc8HjDfEvo7R4pOc3BMTNJcputklVEPN0FkWGN7Py+OEtbHj3IZl0MX+KEWNk0gU+4+sgPrL1eXUQyMUSkCrBsKg08rPel4KMYUOXbtnLyUU9PDbBwm4LJYOc=
|
53
|
+
after_success:
|
54
|
+
- bundle exec codeclimate-test-reporter
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,35 @@
|
|
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/v0.
|
5
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v0.12.0...HEAD)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Fog::Compute::AWS::Image not properly loaded [\#324](https://github.com/fog/fog-aws/issues/324)
|
10
|
+
- Add creation\_date field for aws images [\#320](https://github.com/fog/fog-aws/issues/320)
|
11
|
+
- Bug: \[fog\]\[WARNING\] Unrecognized arguments: region, use\_iam\_profile [\#315](https://github.com/fog/fog-aws/issues/315)
|
12
|
+
- Better contributing documentation [\#311](https://github.com/fog/fog-aws/issues/311)
|
13
|
+
- AutoscalingGroups with a TargetGroup set are not parsed correctly [\#308](https://github.com/fog/fog-aws/issues/308)
|
14
|
+
- autoscaling create launch config doesn't work with BlockDeviceMappings [\#307](https://github.com/fog/fog-aws/issues/307)
|
15
|
+
- Is there a configuration setting for the AWS provider to adjust the url scheme for S3 buckets? [\#305](https://github.com/fog/fog-aws/issues/305)
|
16
|
+
- DB Subnet Group id for Cluster returns nil [\#292](https://github.com/fog/fog-aws/issues/292)
|
17
|
+
|
18
|
+
**Merged pull requests:**
|
19
|
+
|
20
|
+
- Fixed some missing parts in change sets [\#322](https://github.com/fog/fog-aws/pull/322) ([nilroy](https://github.com/nilroy))
|
21
|
+
- Add creation date and enhanced networking support for images [\#321](https://github.com/fog/fog-aws/pull/321) ([puneetloya](https://github.com/puneetloya))
|
22
|
+
- Fix warnings in running tests [\#319](https://github.com/fog/fog-aws/pull/319) ([ebihara99999](https://github.com/ebihara99999))
|
23
|
+
- Add `Fog::AWS::STS.Mock\#assume\_role` [\#316](https://github.com/fog/fog-aws/pull/316) ([pedrommonteiro](https://github.com/pedrommonteiro))
|
24
|
+
- Ohio region [\#314](https://github.com/fog/fog-aws/pull/314) ([chanakyacool](https://github.com/chanakyacool))
|
25
|
+
- mime types gem update [\#312](https://github.com/fog/fog-aws/pull/312) ([lucianosousa](https://github.com/lucianosousa))
|
26
|
+
- fix S3 \#delete\_multiple\_objects for UTF-8 names [\#310](https://github.com/fog/fog-aws/pull/310) ([alepore](https://github.com/alepore))
|
27
|
+
- Support for target groups \(fix for \#308\) [\#309](https://github.com/fog/fog-aws/pull/309) ([msiuts](https://github.com/msiuts))
|
28
|
+
- create, describe, and destroy elastic file systems [\#304](https://github.com/fog/fog-aws/pull/304) ([ehowe](https://github.com/ehowe))
|
29
|
+
- Correct optional parameter naming in documentation for Fog::AWS::Auto… [\#302](https://github.com/fog/fog-aws/pull/302) ([ehealy](https://github.com/ehealy))
|
30
|
+
- Modify Db subnet group [\#293](https://github.com/fog/fog-aws/pull/293) ([chanakyacool](https://github.com/chanakyacool))
|
31
|
+
|
32
|
+
## [v0.12.0](https://github.com/fog/fog-aws/tree/v0.12.0) (2016-09-22)
|
33
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v0.11.0...v0.12.0)
|
6
34
|
|
7
35
|
**Implemented enhancements:**
|
8
36
|
|
data/Gemfile
CHANGED
@@ -5,6 +5,10 @@ gemspec
|
|
5
5
|
|
6
6
|
group :test, :default do
|
7
7
|
gem 'pry-nav'
|
8
|
-
gem 'mime-types', '~>
|
8
|
+
gem 'mime-types', '~> 3.1'
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
|
+
group :test do
|
12
|
+
gem "simplecov"
|
13
|
+
gem "codeclimate-test-reporter", "~> 1.0.0"
|
14
|
+
end
|
data/gemfiles/Gemfile-edge
CHANGED
data/lib/fog/aws.rb
CHANGED
@@ -36,6 +36,7 @@ module Fog
|
|
36
36
|
autoload :DataPipeline, File.expand_path('../aws/data_pipeline', __FILE__)
|
37
37
|
autoload :DynamoDB, File.expand_path('../aws/dynamodb', __FILE__)
|
38
38
|
autoload :ECS, File.expand_path('../aws/ecs', __FILE__)
|
39
|
+
autoload :EFS, File.expand_path('../aws/efs', __FILE__)
|
39
40
|
autoload :ELB, File.expand_path('../aws/elb', __FILE__)
|
40
41
|
autoload :EMR, File.expand_path('../aws/emr', __FILE__)
|
41
42
|
autoload :ElasticBeanstalk, File.expand_path('../aws/beanstalk', __FILE__)
|
@@ -66,6 +67,7 @@ module Fog
|
|
66
67
|
service(:dynamodb, 'DynamoDB')
|
67
68
|
service(:elasticache, 'Elasticache')
|
68
69
|
service(:ecs, 'ECS')
|
70
|
+
service(:efs, 'EFS')
|
69
71
|
service(:elb, 'ELB')
|
70
72
|
service(:emr, 'EMR')
|
71
73
|
service(:federation, 'Federation')
|
@@ -226,7 +228,7 @@ module Fog
|
|
226
228
|
end
|
227
229
|
|
228
230
|
def self.regions
|
229
|
-
@regions ||= ['ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', 'eu-central-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1', 'cn-north-1', 'us-gov-west-1', 'ap-south-1']
|
231
|
+
@regions ||= ['ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', 'eu-central-1', 'eu-west-1', 'us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'sa-east-1', 'cn-north-1', 'us-gov-west-1', 'ap-south-1']
|
230
232
|
end
|
231
233
|
|
232
234
|
def self.validate_region!(region, host=nil)
|
data/lib/fog/aws/efs.rb
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class EFS < Fog::Service
|
4
|
+
extend Fog::AWS::CredentialFetcher::ServiceMethods
|
5
|
+
|
6
|
+
class FileSystemInUse < Fog::Errors::Error; end
|
7
|
+
class IncorrectFileSystemLifeCycleState < Fog::Errors::Error; end
|
8
|
+
class InvalidSubnet < Fog::Errors::Error; end
|
9
|
+
|
10
|
+
requires :aws_access_key_id, :aws_secret_access_key
|
11
|
+
recognizes :region, :host, :path, :port, :scheme, :persistent, :instrumentor, :instrumentor_name
|
12
|
+
|
13
|
+
model_path 'fog/aws/models/efs'
|
14
|
+
request_path 'fog/aws/requests/efs'
|
15
|
+
|
16
|
+
model :file_system
|
17
|
+
model :mount_target
|
18
|
+
|
19
|
+
collection :file_systems
|
20
|
+
collection :mount_targets
|
21
|
+
|
22
|
+
request :create_file_system
|
23
|
+
request :create_mount_target
|
24
|
+
request :delete_file_system
|
25
|
+
request :delete_mount_target
|
26
|
+
request :describe_file_systems
|
27
|
+
request :describe_mount_target_security_groups
|
28
|
+
request :describe_mount_targets
|
29
|
+
request :modify_mount_target_security_groups
|
30
|
+
|
31
|
+
class Mock
|
32
|
+
include Fog::AWS::CredentialFetcher::ConnectionMethods
|
33
|
+
|
34
|
+
def self.data
|
35
|
+
@data ||= Hash.new do |hash, region|
|
36
|
+
hash[region] = Hash.new do |region_hash, key|
|
37
|
+
region_hash[key] = {
|
38
|
+
:file_systems => {},
|
39
|
+
:mount_targets => {},
|
40
|
+
:security_groups => {}
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.reset
|
47
|
+
@data = nil
|
48
|
+
end
|
49
|
+
|
50
|
+
def data
|
51
|
+
self.class.data[@region][@aws_access_key_id]
|
52
|
+
end
|
53
|
+
|
54
|
+
def reset
|
55
|
+
self.class.reset
|
56
|
+
end
|
57
|
+
|
58
|
+
attr_accessor :region
|
59
|
+
|
60
|
+
def initialize(options={})
|
61
|
+
@region = options[:region] || "us-east-1"
|
62
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
63
|
+
@aws_secret_access_key = options[:aws_secret_access_key]
|
64
|
+
end
|
65
|
+
|
66
|
+
def mock_compute
|
67
|
+
@mock_compute ||= Fog::Compute::AWS.new(:aws_access_key_id => @aws_access_key_id, :aws_secret_access_key => @aws_secret_access_key, :region => @region)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class Real
|
72
|
+
include Fog::AWS::CredentialFetcher::ConnectionMethods
|
73
|
+
|
74
|
+
def initialize(options={})
|
75
|
+
@connection_options = options[:connection_options] || {}
|
76
|
+
@instrumentor = options[:instrumentor]
|
77
|
+
@instrumentor_name = options[:instrumentor_name] || 'fog.aws.efs'
|
78
|
+
|
79
|
+
@region = options[:region] || 'us-east-1'
|
80
|
+
@host = options[:host] || "elasticfilesystem.#{@region}.amazonaws.com"
|
81
|
+
@port = options[:port] || 443
|
82
|
+
@scheme = options[:scheme] || "https"
|
83
|
+
@persistent = options[:persistent] || false
|
84
|
+
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
85
|
+
@version = options[:version] || '2015-02-01'
|
86
|
+
@path = options[:path] || "/#{@version}/"
|
87
|
+
|
88
|
+
setup_credentials(options)
|
89
|
+
end
|
90
|
+
|
91
|
+
def reload
|
92
|
+
@connection.reset
|
93
|
+
end
|
94
|
+
|
95
|
+
def setup_credentials(options)
|
96
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
97
|
+
@aws_secret_access_key = options[:aws_secret_access_key]
|
98
|
+
@aws_session_token = options[:aws_session_token]
|
99
|
+
@aws_credentials_expire_at = options[:aws_credentials_expire_at]
|
100
|
+
|
101
|
+
#global services that have no region are signed with the us-east-1 region
|
102
|
+
#the only exception is GovCloud, which requires the region to be explicitly specified as us-gov-west-1
|
103
|
+
@signer = Fog::AWS::SignatureV4.new(@aws_access_key_id, @aws_secret_access_key, @region, 'elasticfilesystem')
|
104
|
+
end
|
105
|
+
|
106
|
+
def request(params)
|
107
|
+
refresh_credentials_if_expired
|
108
|
+
idempotent = params.delete(:idempotent)
|
109
|
+
parser = params.delete(:parser)
|
110
|
+
expects = params.delete(:expects) || 200
|
111
|
+
path = @path + params.delete(:path)
|
112
|
+
method = params.delete(:method) || 'GET'
|
113
|
+
request_body = Fog::JSON.encode(params)
|
114
|
+
|
115
|
+
body, headers = Fog::AWS.signed_params_v4(
|
116
|
+
params,
|
117
|
+
{
|
118
|
+
'Content-Type' => "application/x-amz-json-1.0",
|
119
|
+
},
|
120
|
+
{
|
121
|
+
:host => @host,
|
122
|
+
:path => path,
|
123
|
+
:port => @port,
|
124
|
+
:version => @version,
|
125
|
+
:signer => @signer,
|
126
|
+
:aws_session_token => @aws_session_token,
|
127
|
+
:method => method,
|
128
|
+
:body => request_body
|
129
|
+
}
|
130
|
+
)
|
131
|
+
|
132
|
+
if @instrumentor
|
133
|
+
@instrumentor.instrument("#{@instrumentor_name}.request", params) do
|
134
|
+
_request(body, headers, idempotent, parser, method, path, expects)
|
135
|
+
end
|
136
|
+
else
|
137
|
+
_request(body, headers, idempotent, parser, method, path, expects)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def _request(body, headers, idempotent, parser, method, path, expects)
|
142
|
+
response = @connection.request({
|
143
|
+
:body => body,
|
144
|
+
:expects => expects,
|
145
|
+
:idempotent => idempotent,
|
146
|
+
:headers => headers,
|
147
|
+
:method => method,
|
148
|
+
:parser => parser,
|
149
|
+
:path => path
|
150
|
+
})
|
151
|
+
unless response.body.empty?
|
152
|
+
response.body = Fog::JSON.decode(response.body)
|
153
|
+
end
|
154
|
+
response
|
155
|
+
rescue Excon::Errors::HTTPStatusError => error
|
156
|
+
match = Fog::AWS::Errors.match_error(error)
|
157
|
+
raise if match.empty?
|
158
|
+
if match[:code] == "IncorrectFileSystemLifeCycleState"
|
159
|
+
raise Fog::AWS::EFS::IncorrectFileSystemLifeCycleState.slurp(error, match[:message])
|
160
|
+
elsif match[:code] == 'FileSystemInUse'
|
161
|
+
raise Fog::AWS::EFS::FileSystemInUse.slurp(error, match[:message])
|
162
|
+
elsif match[:code].match(/(FileSystem|MountTarget)NotFound/)
|
163
|
+
raise Fog::AWS::EFS::NotFound.slurp(error, match[:message])
|
164
|
+
end
|
165
|
+
raise case match[:message]
|
166
|
+
when /invalid ((file system)|(mount target)|(security group)) id/i
|
167
|
+
Fog::AWS::EFS::NotFound.slurp(error, match[:message])
|
168
|
+
when /invalid subnet id/i
|
169
|
+
Fog::AWS::EFS::InvalidSubnet.slurp(error, match[:message])
|
170
|
+
else
|
171
|
+
Fog::AWS::EFS::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
@@ -21,6 +21,7 @@ module Fog
|
|
21
21
|
attribute :tags, :aliases => 'Tags'
|
22
22
|
attribute :termination_policies, :aliases => 'TerminationPolicies'
|
23
23
|
attribute :vpc_zone_identifier, :aliases => 'VPCZoneIdentifier'
|
24
|
+
attribute :target_group_arns, :aliases => 'TargetGroupARNs'
|
24
25
|
|
25
26
|
def initialize(attributes={})
|
26
27
|
self.instances = []
|
@@ -35,6 +36,7 @@ module Fog
|
|
35
36
|
self.suspended_processes = []
|
36
37
|
self.tags = {}
|
37
38
|
self.termination_policies = ['Default']
|
39
|
+
self.target_group_arns = []
|
38
40
|
super
|
39
41
|
end
|
40
42
|
|
@@ -22,6 +22,8 @@ module Fog
|
|
22
22
|
attribute :tags, :aliases => 'tagSet'
|
23
23
|
attribute :name
|
24
24
|
attribute :virtualization_type, :aliases => 'virtualizationType'
|
25
|
+
attribute :creation_date, :aliases => 'creationDate'
|
26
|
+
attribute :ena_support, :aliases => 'enaSupport'
|
25
27
|
|
26
28
|
def deregister(delete_snapshot = false)
|
27
29
|
service.deregister_image(id)
|
@@ -11,6 +11,10 @@ module Fog
|
|
11
11
|
attribute :tenancy, :aliases => 'instanceTenancy'
|
12
12
|
attribute :is_default, :aliases => 'isDefault'
|
13
13
|
|
14
|
+
def subnets
|
15
|
+
service.subnets(:filters => {'vpcId' => self.identity}).all
|
16
|
+
end
|
17
|
+
|
14
18
|
def initialize(attributes={})
|
15
19
|
self.dhcp_options_id ||= "default"
|
16
20
|
self.tenancy ||= "default"
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class EFS
|
4
|
+
class FileSystem < Fog::Model
|
5
|
+
identity :id, :aliases => 'FileSystemId'
|
6
|
+
|
7
|
+
attribute :owner_id, :aliases => 'OwnerId'
|
8
|
+
attribute :creation_token, :aliases => 'CreationToken'
|
9
|
+
attribute :performance_mode, :aliases => 'PerformanceMode'
|
10
|
+
attribute :creation_time, :aliases => 'CreationTime'
|
11
|
+
attribute :state, :aliases => 'LifeCycleState'
|
12
|
+
attribute :name, :aliases => 'Name'
|
13
|
+
attribute :number_of_mount_targets, :aliases => 'NumberOfMountTargets'
|
14
|
+
attribute :size_in_bytes, :aliases => 'SizeInBytes'
|
15
|
+
|
16
|
+
def ready?
|
17
|
+
state == 'available'
|
18
|
+
end
|
19
|
+
|
20
|
+
def mount_targets
|
21
|
+
requires :identity
|
22
|
+
service.mount_targets(:file_system_id => self.identity).all
|
23
|
+
end
|
24
|
+
|
25
|
+
def destroy
|
26
|
+
requires :identity
|
27
|
+
|
28
|
+
service.delete_file_system(self.identity)
|
29
|
+
|
30
|
+
true
|
31
|
+
end
|
32
|
+
|
33
|
+
def save
|
34
|
+
params = {}
|
35
|
+
params.merge!(:performance_mode => self.performance_mode) if self.performance_mode
|
36
|
+
|
37
|
+
merge_attributes(service.create_file_system(self.creation_token || Fog::Mock.random_hex(32), params).body)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'fog/aws/models/efs/file_system'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module AWS
|
5
|
+
class EFS
|
6
|
+
class FileSystems < Fog::Collection
|
7
|
+
model Fog::AWS::EFS::FileSystem
|
8
|
+
|
9
|
+
def all
|
10
|
+
data = service.describe_file_systems.body["FileSystems"]
|
11
|
+
load(data)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(identity)
|
15
|
+
data = service.describe_file_systems(:id => identity).body["FileSystems"].first
|
16
|
+
new(data)
|
17
|
+
rescue Fog::AWS::EFS::NotFound
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class EFS
|
4
|
+
class MountTarget < Fog::Model
|
5
|
+
identity :id, :aliases => "MountTargetId"
|
6
|
+
|
7
|
+
attribute :file_system_id, :aliases => "FileSystemId"
|
8
|
+
attribute :ip_address, :aliases => "IpAddress"
|
9
|
+
attribute :state, :aliases => "LifeCycleState"
|
10
|
+
attribute :network_interface_id, :aliases => "NetworkInterfaceId"
|
11
|
+
attribute :owner_id, :aliases => "OwnerId"
|
12
|
+
attribute :subnet_id, :aliases => "SubnetId"
|
13
|
+
|
14
|
+
def ready?
|
15
|
+
state == 'available'
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy
|
19
|
+
requires :identity
|
20
|
+
service.delete_mount_target(self.identity)
|
21
|
+
true
|
22
|
+
end
|
23
|
+
|
24
|
+
def file_system
|
25
|
+
requires :file_system_id
|
26
|
+
service.file_systems.get(self.file_system_id)
|
27
|
+
end
|
28
|
+
|
29
|
+
def security_groups
|
30
|
+
if persisted?
|
31
|
+
requires :identity
|
32
|
+
service.describe_mount_target_security_groups(self.identity).body["SecurityGroups"]
|
33
|
+
else
|
34
|
+
@security_groups || []
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def security_groups=(security_groups)
|
39
|
+
if persisted?
|
40
|
+
requires :identity
|
41
|
+
service.modify_mount_target_security_groups(self.identity, security_groups)
|
42
|
+
else
|
43
|
+
@security_groups = security_groups
|
44
|
+
end
|
45
|
+
security_groups
|
46
|
+
end
|
47
|
+
|
48
|
+
def save
|
49
|
+
requires :file_system_id, :subnet_id
|
50
|
+
params = {}
|
51
|
+
params.merge!('IpAddress' => self.ip_address) if self.ip_address
|
52
|
+
params.merge!('SecurityGroups' => @security_groups) if @security_groups
|
53
|
+
|
54
|
+
merge_attributes(service.create_mount_target(self.file_system_id, self.subnet_id, params).body)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|