class StudioApi::Appliance::Configuration::Firewall

Public Instance Methods

to_xml(options={}) click to toggle source
# File lib/studio_api/appliance.rb, line 54
def to_xml(options={})
  if enabled == "false"
    "<firewall><enabled>false</enabled></firewall>"
  else
    #open port can be array or single string
    ports = open_port.is_a?(String) ? [open_port] : open_port
    openports_xml = ports.map{ |p| "<open_port>#{p}</open_port>" }.join("") #FIXME escape name
    "<firewall><enabled>true</enabled>#{openports_xml}</firewall>"
  end
end