Class: Chef::Knife::ProfitbricksFirewallCreate
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::ProfitbricksFirewallCreate
- Includes:
- ProfitbricksBase
- Defined in:
- lib/chef/knife/profitbricks_firewall_create.rb
Instance Method Summary collapse
Methods included from ProfitbricksBase
#connection, included, #msg_pair
Instance Method Details
#run ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/chef/knife/profitbricks_firewall_create.rb', line 78 def run $stdout.sync = true print "#{ui.color('Creating firewall...', :magenta)}" params = { name: config[:name], protocol: config[:protocol], sourceMac: config[:sourcemac], sourceIp: config[:sourceip], targetIp: config[:targetip], portRangeStart: config[:portrangestart], portRangeEnd: config[:portrangeend], icmpType: config[:icmptype], icmpCode: config[:icmpcode] } connection firewall = ProfitBricks::Firewall.create( config[:datacenter_id], config[:server_id], config[:nic_id], params.compact ) dot = ui.color('.', :magenta) firewall.wait_for { print dot; ready? } firewall.reload puts "\n" puts "#{ui.color('ID', :cyan)}: #{firewall.id}" puts "#{ui.color('Name', :cyan)}: #{firewall.properties['name']}" puts "#{ui.color('Protocol', :cyan)}: #{firewall.properties['protocol']}" puts "#{ui.color('Source MAC', :cyan)}: #{firewall.properties['sourceMac']}" puts "#{ui.color('Source IP', :cyan)}: #{firewall.properties['sourceIp']}" puts "#{ui.color('Target IP', :cyan)}: #{firewall.properties['targetIp']}" puts "#{ui.color('Port Range Start', :cyan)}: #{firewall.properties['portRangeStart']}" puts "#{ui.color('Port Range End', :cyan)}: #{firewall.properties['portRangeEnd']}" puts "#{ui.color('ICMP Type', :cyan)}: #{firewall.properties['icmpType']}" puts "#{ui.color('ICMP Code', :cyan)}: #{firewall.properties['icmpCode']}" puts 'done' end |