SoftLayer.firewall

Firewall Manager/helpers

license

MIT, see LICENSE for more details.

class SoftLayer.managers.firewall.FirewallManager(client)[source]

Manages SoftLayer firewalls

See product information here: https://www.ibm.com/cloud/network-security

Parameters

client (SoftLayer.API.BaseClient) – the client instance

add_standard_firewall(server_id, is_virt=True)[source]

Creates a firewall for the specified virtual/hardware server.

Parameters
  • server_id (int) – The ID of the server to create the firewall for

  • is_virt (bool) – If true, will create the firewall for a virtual server, otherwise for a hardware server.

Returns

A dictionary containing the standard virtual server firewall order

add_vlan_firewall(vlan_id, ha_enabled=False)[source]

Creates a firewall for the specified vlan.

Parameters
  • vlan_id (int) – The ID of the vlan to create the firewall for

  • ha_enabled (bool) – If True, an HA firewall will be created

Returns

A dictionary containing the VLAN firewall order

cancel_firewall(firewall_id, dedicated=False)[source]

Cancels the specified firewall.

Parameters
  • firewall_id (int) – Firewall ID to be cancelled.

  • dedicated (bool) – If true, the firewall instance is dedicated, otherwise, the firewall instance is shared.

edit_dedicated_fwl_rules(firewall_id, rules)[source]

Edit the rules for dedicated firewall.

Parameters
  • firewall_id (integer) – the instance ID of the dedicated firewall

  • rules (list) – the rules to be pushed on the firewall as defined by SoftLayer_Network_Firewall_Update_Request_Rule

edit_standard_fwl_rules(firewall_id, rules)[source]

Edit the rules for standard firewall.

Parameters
  • firewall_id (integer) – the instance ID of the standard firewall

  • rules (list) – the rules to be pushed on the firewall as defined by SoftLayer_Network_Firewall_Update_Request_Rule

get_dedicated_fwl_rules(firewall_id)[source]

Get the rules of a dedicated firewall.

Parameters

firewall_id (integer) – the instance ID of the dedicated firewall

Returns

A list of the rules.

get_dedicated_package(ha_enabled=False)[source]

Retrieves the dedicated firewall package.

Parameters

ha_enabled (bool) – True if HA is to be enabled on the firewall False for No HA

Returns

A dictionary containing the dedicated virtual server firewall package

get_firewalls()[source]

Returns a list of all firewalls on the account.

Returns

A list of firewalls on the current account.

get_instance(firewall_id, mask=None)[source]

Get the firewall information

Parameters

firewall_id (integer) – the instance ID of the standard firewall

get_standard_fwl_rules(firewall_id)[source]

Get the rules of a standard firewall.

Parameters

firewall_id (integer) – the instance ID of the standard firewall

Returns

A list of the rules.

get_standard_package(server_id, is_virt=True)[source]

Retrieves the standard firewall package for the virtual server.

Parameters
  • server_id (int) – The ID of the server to create the firewall for

  • is_virt (bool) – True if the ID provided is for a virtual server, False for a server

Returns

A dictionary containing the standard virtual server firewall package

resolve_ids(identifier)

Takes a string and tries to resolve to a list of matching ids.

What exactly ‘identifier’ can be depends on the resolvers

Parameters

identifier (string) – identifying string

Returns list

SoftLayer.managers.firewall.has_firewall(vlan)[source]

Helper to determine whether or not a VLAN has a firewall.

Parameters

vlan (dict) – A dictionary representing a VLAN

Returns

True if the VLAN has a firewall, false if it doesn’t.