Class: Fog::Compute::Ninefold::IpForwardingRule
- Defined in:
- lib/fog/ninefold/models/compute/ip_forwarding_rule.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #address ⇒ Object
- #address=(addr) ⇒ Object
- #destroy ⇒ Object
-
#initialize(attributes = {}) ⇒ IpForwardingRule
constructor
A new instance of IpForwardingRule.
- #ready? ⇒ Boolean
- #save ⇒ Object
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::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
#initialize(attributes = {}) ⇒ IpForwardingRule
Returns a new instance of IpForwardingRule.
22 23 24 |
# File 'lib/fog/ninefold/models/compute/ip_forwarding_rule.rb', line 22 def initialize(attributes={}) super end |
Instance Method Details
#address ⇒ Object
41 42 43 |
# File 'lib/fog/ninefold/models/compute/ip_forwarding_rule.rb', line 41 def address Ninefold.address.get(ipaddressid) end |
#address=(addr) ⇒ Object
45 46 47 |
# File 'lib/fog/ninefold/models/compute/ip_forwarding_rule.rb', line 45 def address=(addr) self.ipaddressid = addr.identity end |
#destroy ⇒ Object
26 27 28 29 30 |
# File 'lib/fog/ninefold/models/compute/ip_forwarding_rule.rb', line 26 def destroy requires :identity self.jobid = extract_job_id(service.delete_ip_forwarding_rule(:id => identity)) true end |
#ready? ⇒ Boolean
32 33 34 35 36 37 38 39 |
# File 'lib/fog/ninefold/models/compute/ip_forwarding_rule.rb', line 32 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
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/fog/ninefold/models/compute/ip_forwarding_rule.rb', line 49 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 |