Class: Fog::AWS::EC2::Address
- Inherits:
-
Model
- Object
- Model
- Fog::AWS::EC2::Address
show all
- Defined in:
- lib/fog/aws/models/ec2/address.rb
Instance Attribute Summary
Attributes inherited from Model
#connection
Instance Method Summary
collapse
Methods inherited from Model
#_dump, _load, aliases, attribute, attributes, #attributes, #collection, identity, #identity, #identity=, #inspect, #merge_attributes, #new_record?, #reload, #requires, #to_json, #wait_for
Constructor Details
#initialize(attributes = {}) ⇒ Address
Returns a new instance of Address.
13
14
15
16
17
|
# File 'lib/fog/aws/models/ec2/address.rb', line 13
def initialize(attributes = {})
self.server = attributes.delete(:server)
super
end
|
Instance Method Details
#destroy ⇒ Object
19
20
21
22
23
24
|
# File 'lib/fog/aws/models/ec2/address.rb', line 19
def destroy
requires :public_ip
connection.release_address(@public_ip)
true
end
|
#save ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/fog/aws/models/ec2/address.rb', line 34
def save
data = connection.allocate_address
@public_ip = data.body['publicIp']
if @server
self.server = @server
end
true
end
|
#server=(new_server) ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/fog/aws/models/ec2/address.rb', line 26
def server=(new_server)
if new_server
associate(new_server)
else
disassociate
end
end
|