Class: Fog::Compute::Cloudstack::PublicIpAddresses

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/cloudstack/models/compute/public_ip_addresses.rb

Instance Method Summary collapse

Instance Method Details

#all(options = {}) ⇒ Object


10
11
12
13
14
# File 'lib/fog/cloudstack/models/compute/public_ip_addresses.rb', line 10

def all(options = {})
  response = service.list_public_ip_addresses(options)
  public_ip_addresses = response["listpublicipaddressesresponse"]["publicipaddress"] || []
  load(public_ip_addresses)
end

#get(address_id) ⇒ Object


16
17
18
19
20
21
22
23
# File 'lib/fog/cloudstack/models/compute/public_ip_addresses.rb', line 16

def get(address_id)
  response = service.list_public_ip_addresses('id' => address_id)
  if public_ip_address = response["listpublicipaddressesresponse"]["publicipaddress"].first
    new(public_ip_address)
  end
rescue Fog::Compute::Cloudstack::BadRequest
  nil
end