Class: Fog::Network::StormOnDemand::PrivateIps

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/storm_on_demand/models/network/private_ips.rb

Instance Attribute Summary

Attributes inherited from Collection

#service

Instance Method Summary collapse

Methods inherited from Collection

#clear, #create, #destroy, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json

Methods included from Attributes::ClassMethods

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

Methods included from 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::Collection

Instance Method Details

#allObject



12
13
14
15
# File 'lib/fog/storm_on_demand/models/network/private_ips.rb', line 12

def all
  data = service.list_private_ips.body['networks']
  load(data)
end

#attach(server_id) ⇒ Object



21
22
23
24
# File 'lib/fog/storm_on_demand/models/network/private_ips.rb', line 21

def attach(server_id)
  res = service.attach_server_to_private_ip(:uniq_id => server_id).body
  res['attached'].to_i == 1 ? true : false
end

#attached?(server_id) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
34
# File 'lib/fog/storm_on_demand/models/network/private_ips.rb', line 31

def attached?(server_id)
  r = service.check_server_attached(:uniq_id => server_id).body
  r['is_attached'].to_i == 1 ? true : false
end

#detach(server_id) ⇒ Object



26
27
28
29
# File 'lib/fog/storm_on_demand/models/network/private_ips.rb', line 26

def detach(server_id)
  r = service.detach_server_from_private_ip(:uniq_id => server_id).body
  r['detached'].to_i == 1 ? true : false
end

#get(server_id) ⇒ Object



17
18
19
# File 'lib/fog/storm_on_demand/models/network/private_ips.rb', line 17

def get(server_id)
  service.get_private_ip(:uniq_id => server_id).body['ip']
end