Module: DeltacloudVM::Client::Methods::Firewall
- Included in:
- Connection, Firewall
- Defined in:
- lib/deltacloud_vm/client/methods/firewall.rb
Instance Method Summary collapse
- #add_firewall_rule(firewall_id, protocol, port_from, port_to, opts = {}) ⇒ Object
-
#create_firewall(name, create_opts = {}) ⇒ Object
Create a new firewall.
- #destroy_firewall(firewall_id) ⇒ Object
-
#firewall(firewall_id) ⇒ Object
Retrieve the single firewall entity.
-
#firewalls(filter_opts = {}) ⇒ Object
Retrieve list of all firewall entities.
Instance Method Details
#add_firewall_rule(firewall_id, protocol, port_from, port_to, opts = {}) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/deltacloud_vm/client/methods/firewall.rb', line 53 def add_firewall_rule(firewall_id, protocol, port_from, port_to, opts={}) r = connection.post(api_uri("firewalls/#{firewall_id}/rules")) do |request| request.params = { :protocol => protocol, :port_from => port_from, :port_to => port_to } # TODO: Add support for sources end model(:firewall).convert(self, r.body) end |
#create_firewall(name, create_opts = {}) ⇒ Object
Create a new firewall
-
name - Name to associate with new firewall
-
create_opts :name -> Name of firewall
45 46 47 |
# File 'lib/deltacloud_vm/client/methods/firewall.rb', line 45 def create_firewall(name, create_opts={}) create_resource :firewall, { :name => name }.merge(create_opts) end |
#destroy_firewall(firewall_id) ⇒ Object
49 50 51 |
# File 'lib/deltacloud_vm/client/methods/firewall.rb', line 49 def destroy_firewall(firewall_id) destroy_resource :firewall, firewall_id end |
#firewall(firewall_id) ⇒ Object
Retrieve the single firewall entity
-
firewall_id -> Firewall entity to retrieve
34 35 36 37 |
# File 'lib/deltacloud_vm/client/methods/firewall.rb', line 34 def firewall(firewall_id) from_resource :firewall, connection.get(api_uri("firewalls/#{firewall_id}")) end |
#firewalls(filter_opts = {}) ⇒ Object
Retrieve list of all firewall entities
-
filter_opts:
-
:id -> Filter entities using ‘id’ attribute
-
25 26 27 28 |
# File 'lib/deltacloud_vm/client/methods/firewall.rb', line 25 def firewalls(filter_opts={}) from_collection :firewalls, connection.get(api_uri('firewalls'), filter_opts) end |