import SoftLayer
# For nice debug output
from pprint import pprint as pp
# Create a client for use with the NetworkManager
client = SoftLayer.Client()
net_mgr = SoftLayer.NetworkManager(client)
name = 'pythonCreatedGroupExample'
description = 'Security Group created via python'
try:
result = net_mgr.create_securitygroup(name=name, description=description)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Failed... Unable to create a new security group: faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
import SoftLayer
# For nice debug output
from pprint import pprint as pp
# Create a client for use with the NetworkManager
client = SoftLayer.Client()
net_mgr = SoftLayer.NetworkManager(client)
sg_id = 12045
try:
result = net_mgr.delete_securitygroup(sg_id)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Failed... Unable to delete security group: faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
import SoftLayer
# For nice debug output
from pprint import pprint as pp
# Create a client for use with the NetworkManager
client = SoftLayer.Client()
net_mgr = SoftLayer.NetworkManager(client)
sg_id = 12045
try:
result = net_mgr.get_securitygroup(sg_id)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Failed... Unable to get security group: faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
import SoftLayer
# For nice debug output
from pprint import pprint as pp
# Create a client for use with the NetworkManager
client = SoftLayer.Client()
net_mgr = SoftLayer.NetworkManager(client)
result = net_mgr.list_securitygroups()
pp(result)
If this article contains any error, or leaves any of your questions unanswered, please help us out by
opening up a github issue.
Open an issue