Class: Fog::Compute::Ninefold::Address
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Ninefold::Address
show all
- Defined in:
- lib/fog/ninefold/models/compute/address.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Model
#inspect, #symbolize_keys, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
#initialize(attributes = {}) ⇒ Address
Returns a new instance of Address.
32
33
34
|
# File 'lib/fog/ninefold/models/compute/address.rb', line 32
def initialize(attributes={})
super
end
|
Instance Method Details
#destroy ⇒ Object
36
37
38
39
40
|
# File 'lib/fog/ninefold/models/compute/address.rb', line 36
def destroy
requires :identity
self.jobid = (connection.disassociate_ip_address(:id => identity))
true
end
|
#disable_static_nat ⇒ Object
49
50
51
52
|
# File 'lib/fog/ninefold/models/compute/address.rb', line 49
def disable_static_nat()
self.jobid = (connection.disable_static_nat(:ipaddressid => identity))
true
end
|
#enable_static_nat(server) ⇒ Object
42
43
44
45
46
47
|
# File 'lib/fog/ninefold/models/compute/address.rb', line 42
def enable_static_nat(server)
server.kind_of?(Integer) ? serverid = server : serverid = server.identity
res = connection.enable_static_nat(:virtualmachineid => serverid, :ipaddressid => identity)
reload
to_boolean(res['success'])
end
|
#ready? ⇒ Boolean
61
62
63
64
65
66
67
68
|
# File 'lib/fog/ninefold/models/compute/address.rb', line 61
def ready?
if jobid && connection.query_async_job_result(:jobid => jobid)['jobstatus'] == 0
false
else reload
true
end
end
|
#reload ⇒ Object
54
55
56
57
58
59
|
# File 'lib/fog/ninefold/models/compute/address.rb', line 54
def reload
self.virtualmachinedisplayname = nil
self.virtualmachineid = nil
self.virtualmachinename = nil
super
end
|
#save ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/fog/ninefold/models/compute/address.rb', line 70
def save
raise "Operation not supported" if self.identity
requires :zoneid
options = {
:zoneid => zoneid,
:networkid => networkid,
:account => account,
:domainid => domainid
}.delete_if {|k,v| v.nil? || v == "" }
data = connection.associate_ip_address(options)
merge_attributes(data)
true
end
|