Class: Chef::Knife::ProfitbricksFirewallDelete
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::ProfitbricksFirewallDelete
- Includes:
- ProfitbricksBase
- Defined in:
- lib/chef/knife/profitbricks_firewall_delete.rb
Instance Method Summary collapse
Methods included from ProfitbricksBase
#connection, included, #msg_pair
Instance Method Details
#run ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/chef/knife/profitbricks_firewall_delete.rb', line 29 def run connection @name_args.each do |firewall_id| begin firewall = ProfitBricks::Firewall.get(config[:datacenter_id], config[:server_id], config[:nic_id], firewall_id) rescue Excon::Errors::NotFound ui.error("Firewall ID #{firewall_id} not found. Skipping.") next end msg_pair('ID', firewall.id) msg_pair('Name', firewall.properties['name']) msg_pair('Protocol', firewall.properties['protocol']) msg_pair('Source MAC', firewall.properties['sourceMac']) msg_pair('Source IP', firewall.properties['sourceIp']) msg_pair('Target IP', firewall.properties['targetIp']) msg_pair('Port Range Start', firewall.properties['portRangeStart']) msg_pair('Port Range End', firewall.properties['portRangeEnd']) msg_pair('ICMP Type', firewall.properties['icmpType']) msg_pair('ICMP Code', firewall.properties['icmpCode']) confirm('Do you really want to delete this firewall rule') firewall.delete ui.warn("Deleted firewall rule #{firewall.id}") end end |