Class: Fog::Compute::Ninefold::IpForwardingRule
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Ninefold::IpForwardingRule
show all
- Defined in:
- lib/rackspace-fog/ninefold/models/compute/ip_forwarding_rule.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Model
#inspect, #reload, #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
Returns a new instance of IpForwardingRule.
22
23
24
|
# File 'lib/rackspace-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/rackspace-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/rackspace-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/rackspace-fog/ninefold/models/compute/ip_forwarding_rule.rb', line 26
def destroy
requires :identity
self.jobid = (connection.delete_ip_forwarding_rule(:id => identity))
true
end
|
#ready? ⇒ Boolean
32
33
34
35
36
37
38
39
|
# File 'lib/rackspace-fog/ninefold/models/compute/ip_forwarding_rule.rb', line 32
def ready?
if jobid && connection.query_async_job_result(:jobid => jobid)['jobstatus'] == 0
false
else reload
true
end
end
|
#save ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/rackspace-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
options = {
:ipaddressid => ipaddressid,
:protocol => protocol,
:startport => startport,
:endport => endport
}.delete_if {|k,v| v.nil? || v == "" }
data = connection.create_ip_forwarding_rule(options)
merge_attributes(data)
true
end
|