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

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destination_idObject



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

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

#destroyObject



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

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)


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

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)


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

def mapped?
  status == "mapped"
end

#unmapObject



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

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