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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#inspect, #update_attributes

Constructor Details

#initialize(attributes = {}) ⇒ Address

Returns a new instance of Address.



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

def initialize(attributes = {})
  remap_attributes(attributes, {
    'instanceId'  => :instance_id,
    'publicIp'    => :public_ip
  })
  super
end

Instance Attribute Details

#instance_idObject

Returns the value of attribute instance_id.



7
8
9
# File 'lib/fog/aws/models/ec2/address.rb', line 7

def instance_id
  @instance_id
end

#public_ipObject

Returns the value of attribute public_ip.



7
8
9
# File 'lib/fog/aws/models/ec2/address.rb', line 7

def public_ip
  @public_ip
end

Instance Method Details

#deleteObject



18
19
20
# File 'lib/fog/aws/models/ec2/address.rb', line 18

def delete
  connection.release_address(@public_ip)
end

#saveObject



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

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