Module: Deltacloud::Client::Methods::Address

Included in:
Address, Connection
Defined in:
lib/deltacloud/client/methods/address.rb

Instance Method Summary collapse

Instance Method Details

#address(address_id) ⇒ Object

Retrieve the single address entity

  • address_id -> Address entity to retrieve



34
35
36
37
# File 'lib/deltacloud/client/methods/address.rb', line 34

def address(address_id)
  from_resource :address,
    connection.get(api_uri("addresses/#{address_id}"))
end

#addresses(filter_opts = {}) ⇒ Object

Retrieve list of all address entities

filter_opts:

  • :id -> Filter entities using ‘id’ attribute



25
26
27
28
# File 'lib/deltacloud/client/methods/address.rb', line 25

def addresses(filter_opts={})
  from_collection :addresses,
  connection.get(api_uri('addresses'), filter_opts)
end

#associate_address(address_id, instance_id) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/deltacloud/client/methods/address.rb', line 49

def associate_address(address_id, instance_id)
  result = connection.post(
    api_uri("/addresses/#{address_id}/associate")
  ) do |request|
    request.params = { :instance_id => instance_id }
  end
  result.status == 202
end

#create_addressObject

Create a new address



41
42
43
# File 'lib/deltacloud/client/methods/address.rb', line 41

def create_address
  create_resource :address, {}
end

#destroy_address(address_id) ⇒ Object



45
46
47
# File 'lib/deltacloud/client/methods/address.rb', line 45

def destroy_address(address_id)
  destroy_resource :address, address_id
end

#disassociate_address(address_id) ⇒ Object



58
59
60
61
62
63
# File 'lib/deltacloud/client/methods/address.rb', line 58

def disassociate_address(address_id)
  result = connection.post(
    api_uri("/addresses/#{address_id}/disassociate")
  )
  result.status == 202
end