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

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

Instance Method Summary collapse

Methods included from ModelHelper

#collection_name, #resource_name

Instance Method Details

#destination_idObject



59
60
61
# File 'lib/fog/brightbox/models/compute/cloud_ip.rb', line 59

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

#destroyObject



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

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

#map(destination) ⇒ Object

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

Parameters:

  • destination (Object)


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

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

#mapped?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/fog/brightbox/models/compute/cloud_ip.rb', line 45

def mapped?
  status == "mapped"
end

#unmapObject



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

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