Class: Fog::Compute::Ninefold::IpForwardingRule
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Ninefold::IpForwardingRule
- Defined in:
- lib/fog/ninefold/models/compute/ip_forwarding_rule.rb
Instance Method Summary collapse
- #address ⇒ Object
- #address=(addr) ⇒ Object
- #destroy ⇒ Object
-
#initialize(attributes = {}) ⇒ IpForwardingRule
constructor
A new instance of IpForwardingRule.
- #ready? ⇒ Boolean
- #save ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ IpForwardingRule
Returns a new instance of IpForwardingRule.
20 21 22 |
# File 'lib/fog/ninefold/models/compute/ip_forwarding_rule.rb', line 20 def initialize(attributes={}) super end |
Instance Method Details
#address ⇒ Object
39 40 41 |
# File 'lib/fog/ninefold/models/compute/ip_forwarding_rule.rb', line 39 def address Ninefold.address.get(ipaddressid) end |
#address=(addr) ⇒ Object
43 44 45 |
# File 'lib/fog/ninefold/models/compute/ip_forwarding_rule.rb', line 43 def address=(addr) self.ipaddressid = addr.identity end |
#destroy ⇒ Object
24 25 26 27 28 |
# File 'lib/fog/ninefold/models/compute/ip_forwarding_rule.rb', line 24 def destroy requires :identity self.jobid = extract_job_id(service.delete_ip_forwarding_rule(:id => identity)) true end |
#ready? ⇒ Boolean
30 31 32 33 34 35 36 37 |
# File 'lib/fog/ninefold/models/compute/ip_forwarding_rule.rb', line 30 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 |
#save ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fog/ninefold/models/compute/ip_forwarding_rule.rb', line 47 def save raise "Operation not supported" if self.identity requires :ipaddressid requires :protocol requires :startport = { :ipaddressid => ipaddressid, :protocol => protocol, :startport => startport, :endport => endport }.delete_if {|k,v| v.nil? || v == "" } data = service.create_ip_forwarding_rule() merge_attributes(data) true end |