Class: Fog::Compute::Brightbox::CloudIp

Inherits:
Brightbox::Model show all
Defined in:
lib/fog/brightbox/models/compute/cloud_ip.rb

Instance Method Summary collapse

Methods included from Brightbox::ModelHelper

#collection_name, #resource_name

Instance Method Details

#destination_idObject



57
58
59
# File 'lib/fog/brightbox/models/compute/cloud_ip.rb', line 57

def destination_id
  server_id || load_balancer || server_group || database_server || interface_id
end

#destroyObject



52
53
54
55
# File 'lib/fog/brightbox/models/compute/cloud_ip.rb', line 52

def destroy
  requires :identity
  service.destroy_cloud_ip(identity)
end

#map(destination) ⇒ Object

Attempt to map or point the Cloud IP to the destination resource.

Parameters:

  • destination (Object)


31
32
33
34
35
36
37
38
39
40
41
# File 'lib/fog/brightbox/models/compute/cloud_ip.rb', line 31

def map(destination)
  requires :identity
  if destination.respond_to?(:mapping_identity)
    final_destination = destination.mapping_identity
  elsif destination.respond_to?(:identity)
    final_destination = destination.identity
  else
    final_destination = destination
  end
  service.map_cloud_ip(identity, :destination => final_destination)
end

#mapped?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/fog/brightbox/models/compute/cloud_ip.rb', line 43

def mapped?
  status == "mapped"
end

#unmapObject



47
48
49
50
# File 'lib/fog/brightbox/models/compute/cloud_ip.rb', line 47

def unmap
  requires :identity
  service.unmap_cloud_ip(identity)
end