Method: KnifeCloudstack::CsServerCreate#create_port_forwarding_rules

Defined in:
lib/chef/knife/cs_server_create.rb

#create_port_forwarding_rules(ip_address_id, server_id, connection) ⇒ Object



266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/chef/knife/cs_server_create.rb', line 266

def create_port_forwarding_rules(ip_address_id, server_id, connection)
  rules = locate_config_value(:port_rules)
  return unless rules

  rules.each do |rule|
    args = rule.split(':')
    public_port = args[0]
    private_port = args[1] || args[0]
    protocol = args[2] || "TCP"
    connection.create_port_forwarding_rule(ip_address_id, private_port, protocol, public_port, server_id)
  end

end