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.
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 = extract_job_id(service.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 = extract_job_id(service.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 = service.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 && 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
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 = { :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 |