Class: Fog::Compute::ProfitBricks::FirewallRule
Instance Method Summary
collapse
#flatten
#request_status, #wait_for
Instance Method Details
#delete ⇒ Object
71
72
73
74
75
|
# File 'lib/fog/profitbricks/models/compute/firewall_rule.rb', line 71
def delete
requires :datacenter_id, :server_id, :nic_id, :id
service.delete_firewall_rule(datacenter_id, server_id, nic_id, id)
true
end
|
#failed? ⇒ Boolean
97
98
99
|
# File 'lib/fog/profitbricks/models/compute/firewall_rule.rb', line 97
def failed?
state == 'ERROR'
end
|
#ready? ⇒ Boolean
93
94
95
|
# File 'lib/fog/profitbricks/models/compute/firewall_rule.rb', line 93
def ready?
state == 'AVAILABLE'
end
|
#reload ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/fog/profitbricks/models/compute/firewall_rule.rb', line 77
def reload
requires :datacenter_id, :server_id, :nic_id, :id
data = begin
collection.get(datacenter_id, server_id, nic_id, id)
rescue Excon::Errors::SocketError
nil
end
return unless data
new_attributes = data.attributes
merge_attributes(new_attributes)
self
end
|
#save ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/fog/profitbricks/models/compute/firewall_rule.rb', line 36
def save
requires :datacenter_id, :server_id, :nic_id, :protocol
properties = {}
properties[:name] = name if name
properties[:protocol] = protocol if protocol
properties[:sourceMac] = source_mac if source_mac
properties[:sourceIp] = source_ip if source_ip
properties[:targetIp] = target_ip if target_ip
properties[:portRangeStart] = port_range_start if port_range_start
properties[:portRangeEnd] = port_range_end if port_range_end
properties[:icmpType] = icmp_type if icmp_type
properties[:icmpCode] = icmp_code if icmp_code
data = service.create_firewall_rule(datacenter_id, server_id, nic_id, properties)
merge_attributes(flatten(data.body))
end
|
#update ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/fog/profitbricks/models/compute/firewall_rule.rb', line 54
def update
requires :datacenter_id, :server_id, :nic_id, :id
properties = {}
properties[:name] = name if name
properties[:sourceMac] = source_mac if source_mac
properties[:sourceIp] = source_ip if source_ip
properties[:targetIp] = target_ip if target_ip
properties[:portRangeStart] = port_range_start if port_range_start
properties[:portRangeEnd] = port_range_end if port_range_end
properties[:icmpType] = icmp_type if icmp_type
properties[:icmpCode] = icmp_code if icmp_code
data = service.update_firewall_rule(datacenter_id, server_id, nic_id, id, properties)
merge_attributes(flatten(data.body))
end
|