Class: Fog::AWS::EC2::Address

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/ec2/address.rb

Instance Method Summary collapse

Methods inherited from Model

aliases, attribute, attributes, #attributes, #inspect, #merge_attributes

Constructor Details

#initialize(new_attributes = {}) ⇒ Address

Returns a new instance of Address.



14
15
16
17
18
19
# File 'lib/fog/aws/models/ec2/address.rb', line 14

def initialize(new_attributes = {})
  new_attributes = {
    :instance_id => ''
  }.merge!(new_attributes)
  super(new_attributes)
end

Instance Method Details

#addressesObject



10
11
12
# File 'lib/fog/aws/models/ec2/address.rb', line 10

def addresses
  @addresses
end

#destroyObject



21
22
23
24
# File 'lib/fog/aws/models/ec2/address.rb', line 21

def destroy
  connection.release_address(@public_ip)
  true
end

#reloadObject



26
27
28
29
# File 'lib/fog/aws/models/ec2/address.rb', line 26

def reload
  new_attributes = addresses.get(@public_ip).attributes
  merge_attributes(new_attributes)
end

#saveObject



31
32
33
34
35
# File 'lib/fog/aws/models/ec2/address.rb', line 31

def save
  data = connection.allocate_address
  @public_ip = data.body['publicIp']
  true
end