Class: Fog::Compute::Ninefold::Address
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Ninefold::Address
- Defined in:
- lib/fog/ninefold/models/compute/address.rb
Instance Method Summary collapse
- #destroy ⇒ Object
- #disable_static_nat ⇒ Object
- #enable_static_nat(server) ⇒ Object
-
#initialize(attributes = {}) ⇒ Address
constructor
A new instance of Address.
- #ready? ⇒ Boolean
- #reload ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Address
Returns a new instance of Address.
30 31 32 |
# File 'lib/fog/ninefold/models/compute/address.rb', line 30 def initialize(attributes={}) super end |
Instance Method Details
#destroy ⇒ Object
34 35 36 37 38 |
# File 'lib/fog/ninefold/models/compute/address.rb', line 34 def destroy requires :identity self.jobid = extract_job_id(service.disassociate_ip_address(:id => identity)) true end |
#disable_static_nat ⇒ Object
47 48 49 50 |
# File 'lib/fog/ninefold/models/compute/address.rb', line 47 def disable_static_nat() self.jobid = extract_job_id(service.disable_static_nat(:ipaddressid => identity)) true end |
#enable_static_nat(server) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/fog/ninefold/models/compute/address.rb', line 40 def enable_static_nat(server) server.kind_of?(Integer) ? serverid = server : serverid = server.identity res = service.enable_static_nat(:virtualmachineid => serverid, :ipaddressid => identity) reload to_boolean(res['success']) end |
#ready? ⇒ Boolean
59 60 61 62 63 64 65 66 |
# File 'lib/fog/ninefold/models/compute/address.rb', line 59 def ready? if jobid && service.query_async_job_result(:jobid => jobid)['jobstatus'] == 0 false else # No running job, we are ready. Refresh data. reload true end end |
#reload ⇒ Object
52 53 54 55 56 57 |
# File 'lib/fog/ninefold/models/compute/address.rb', line 52 def reload self.virtualmachinedisplayname = nil self.virtualmachineid = nil self.virtualmachinename = nil super end |
#save ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/fog/ninefold/models/compute/address.rb', line 68 def save raise "Operation not supported" if self.identity requires :zoneid = { :zoneid => zoneid, :networkid => networkid, :account => account, :domainid => domainid }.delete_if {|k,v| v.nil? || v == "" } data = service.associate_ip_address() merge_attributes(data) true end |