repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
gabstopper/smc-python | smc/elements/user.py | UserMixin.permissions | def permissions(self):
"""
Return each permission role mapping for this Admin User. A permission
role will have 3 fields:
* Domain
* Role (Viewer, Operator, etc)
* Elements (Engines, Policies, or ACLs)
:return: permissions as list
:rtype:... | python | def permissions(self):
"""
Return each permission role mapping for this Admin User. A permission
role will have 3 fields:
* Domain
* Role (Viewer, Operator, etc)
* Elements (Engines, Policies, or ACLs)
:return: permissions as list
:rtype:... | [
"def",
"permissions",
"(",
"self",
")",
":",
"if",
"'permissions'",
"in",
"self",
".",
"data",
":",
"_permissions",
"=",
"self",
".",
"data",
"[",
"'permissions'",
"]",
"[",
"'permission'",
"]",
"return",
"[",
"Permission",
"(",
"*",
"*",
"perm",
")",
... | Return each permission role mapping for this Admin User. A permission
role will have 3 fields:
* Domain
* Role (Viewer, Operator, etc)
* Elements (Engines, Policies, or ACLs)
:return: permissions as list
:rtype: list(Permission) | [
"Return",
"each",
"permission",
"role",
"mapping",
"for",
"this",
"Admin",
"User",
".",
"A",
"permission",
"role",
"will",
"have",
"3",
"fields",
":",
"*",
"Domain",
"*",
"Role",
"(",
"Viewer",
"Operator",
"etc",
")",
"*",
"Elements",
"(",
"Engines",
"Po... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/user.py#L120-L135 |
gabstopper/smc-python | smc/elements/user.py | AdminUser.create | def create(cls, name, local_admin=False, allow_sudo=False,
superuser=False, enabled=True, engine_target=None,
can_use_api=True, console_superuser=False,
allowed_to_login_in_shared=True, comment=None):
"""
Create an admin user account.
.. vers... | python | def create(cls, name, local_admin=False, allow_sudo=False,
superuser=False, enabled=True, engine_target=None,
can_use_api=True, console_superuser=False,
allowed_to_login_in_shared=True, comment=None):
"""
Create an admin user account.
.. vers... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"local_admin",
"=",
"False",
",",
"allow_sudo",
"=",
"False",
",",
"superuser",
"=",
"False",
",",
"enabled",
"=",
"True",
",",
"engine_target",
"=",
"None",
",",
"can_use_api",
"=",
"True",
",",
"console_su... | Create an admin user account.
.. versionadded:: 0.6.2
Added can_use_api, console_superuser, and allowed_to_login_in_shared.
Requires SMC >= SMC 6.4
:param str name: name of account
:param bool local_admin: is a local admin only
:param bool allow_sudo: al... | [
"Create",
"an",
"admin",
"user",
"account",
".",
"..",
"versionadded",
"::",
"0",
".",
"6",
".",
"2",
"Added",
"can_use_api",
"console_superuser",
"and",
"allowed_to_login_in_shared",
".",
"Requires",
"SMC",
">",
"=",
"SMC",
"6",
".",
"4"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/user.py#L163-L201 |
gabstopper/smc-python | smc/elements/user.py | AdminUser.change_engine_password | def change_engine_password(self, password):
""" Change Engine password for engines on allowed
list.
:param str password: password for engine level
:raises ModificationFailed: failed setting password on engine
:return: None
"""
self.make_request(
Modif... | python | def change_engine_password(self, password):
""" Change Engine password for engines on allowed
list.
:param str password: password for engine level
:raises ModificationFailed: failed setting password on engine
:return: None
"""
self.make_request(
Modif... | [
"def",
"change_engine_password",
"(",
"self",
",",
"password",
")",
":",
"self",
".",
"make_request",
"(",
"ModificationFailed",
",",
"method",
"=",
"'update'",
",",
"resource",
"=",
"'change_engine_password'",
",",
"params",
"=",
"{",
"'password'",
":",
"passwo... | Change Engine password for engines on allowed
list.
:param str password: password for engine level
:raises ModificationFailed: failed setting password on engine
:return: None | [
"Change",
"Engine",
"password",
"for",
"engines",
"on",
"allowed",
"list",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/user.py#L212-L224 |
gabstopper/smc-python | smc/elements/user.py | ApiClient.create | def create(cls, name, enabled=True, superuser=True):
"""
Create a new API Client. Once client is created,
you can create a new password by::
>>> client = ApiClient.create('myclient')
>>> print(client)
ApiClient(name=myclient)
>>> client.change_pas... | python | def create(cls, name, enabled=True, superuser=True):
"""
Create a new API Client. Once client is created,
you can create a new password by::
>>> client = ApiClient.create('myclient')
>>> print(client)
ApiClient(name=myclient)
>>> client.change_pas... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"enabled",
"=",
"True",
",",
"superuser",
"=",
"True",
")",
":",
"json",
"=",
"{",
"'enabled'",
":",
"enabled",
",",
"'name'",
":",
"name",
",",
"'superuser'",
":",
"superuser",
"}",
"return",
"ElementCrea... | Create a new API Client. Once client is created,
you can create a new password by::
>>> client = ApiClient.create('myclient')
>>> print(client)
ApiClient(name=myclient)
>>> client.change_password('mynewpassword')
:param str name: name of client
:... | [
"Create",
"a",
"new",
"API",
"Client",
".",
"Once",
"client",
"is",
"created",
"you",
"can",
"create",
"a",
"new",
"password",
"by",
"::"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/user.py#L234-L256 |
gabstopper/smc-python | smc/core/engine.py | Engine._create | def _create(cls, name, node_type,
physical_interfaces,
nodes=1, loopback_ndi=None,
log_server_ref=None,
domain_server_address=None,
enable_antivirus=False, enable_gti=False,
sidewinder_proxy_enabled=False,
de... | python | def _create(cls, name, node_type,
physical_interfaces,
nodes=1, loopback_ndi=None,
log_server_ref=None,
domain_server_address=None,
enable_antivirus=False, enable_gti=False,
sidewinder_proxy_enabled=False,
de... | [
"def",
"_create",
"(",
"cls",
",",
"name",
",",
"node_type",
",",
"physical_interfaces",
",",
"nodes",
"=",
"1",
",",
"loopback_ndi",
"=",
"None",
",",
"log_server_ref",
"=",
"None",
",",
"domain_server_address",
"=",
"None",
",",
"enable_antivirus",
"=",
"F... | Create will return the engine configuration as a dict that is a
representation of the engine. The creating class will also add
engine specific requirements before constructing the request
and sending to SMC (which will serialize the dict to json).
:param name: name of engine
:pa... | [
"Create",
"will",
"return",
"the",
"engine",
"configuration",
"as",
"a",
"dict",
"that",
"is",
"a",
"representation",
"of",
"the",
"engine",
".",
"The",
"creating",
"class",
"will",
"also",
"add",
"engine",
"specific",
"requirements",
"before",
"constructing",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L64-L157 |
gabstopper/smc-python | smc/core/engine.py | Engine.rename | def rename(self, name):
"""
Rename the firewall engine, nodes, and internal gateway (VPN gw)
:return: None
"""
for node in self.nodes:
node.rename(name)
self.update(name=name)
self.vpn.rename(name) | python | def rename(self, name):
"""
Rename the firewall engine, nodes, and internal gateway (VPN gw)
:return: None
"""
for node in self.nodes:
node.rename(name)
self.update(name=name)
self.vpn.rename(name) | [
"def",
"rename",
"(",
"self",
",",
"name",
")",
":",
"for",
"node",
"in",
"self",
".",
"nodes",
":",
"node",
".",
"rename",
"(",
"name",
")",
"self",
".",
"update",
"(",
"name",
"=",
"name",
")",
"self",
".",
"vpn",
".",
"rename",
"(",
"name",
... | Rename the firewall engine, nodes, and internal gateway (VPN gw)
:return: None | [
"Rename",
"the",
"firewall",
"engine",
"nodes",
"and",
"internal",
"gateway",
"(",
"VPN",
"gw",
")"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L186-L195 |
gabstopper/smc-python | smc/core/engine.py | Engine.location | def location(self):
"""
The location for this engine. May be None if no specific
location has been assigned.
:param value: location to assign engine. Can be name, str href,
or Location element. If name, it will be automatically created
if a Location with the same... | python | def location(self):
"""
The location for this engine. May be None if no specific
location has been assigned.
:param value: location to assign engine. Can be name, str href,
or Location element. If name, it will be automatically created
if a Location with the same... | [
"def",
"location",
"(",
"self",
")",
":",
"location",
"=",
"Element",
".",
"from_href",
"(",
"self",
".",
"location_ref",
")",
"if",
"location",
"and",
"location",
".",
"name",
"==",
"'Default'",
":",
"return",
"None",
"return",
"location"
] | The location for this engine. May be None if no specific
location has been assigned.
:param value: location to assign engine. Can be name, str href,
or Location element. If name, it will be automatically created
if a Location with the same name doesn't exist.
:raises Upd... | [
"The",
"location",
"for",
"this",
"engine",
".",
"May",
"be",
"None",
"if",
"no",
"specific",
"location",
"has",
"been",
"assigned",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L208-L222 |
gabstopper/smc-python | smc/core/engine.py | Engine.nodes | def nodes(self):
"""
Return a list of child nodes of this engine. This can be
used to iterate to obtain access to node level operations
::
>>> print(list(engine.nodes))
[Node(name=myfirewall node 1)]
>>> engine.nodes.get(0)
Node(na... | python | def nodes(self):
"""
Return a list of child nodes of this engine. This can be
used to iterate to obtain access to node level operations
::
>>> print(list(engine.nodes))
[Node(name=myfirewall node 1)]
>>> engine.nodes.get(0)
Node(na... | [
"def",
"nodes",
"(",
"self",
")",
":",
"resource",
"=",
"sub_collection",
"(",
"self",
".",
"get_relation",
"(",
"'nodes'",
")",
",",
"Node",
")",
"resource",
".",
"_load_from_engine",
"(",
"self",
",",
"'nodes'",
")",
"return",
"resource"
] | Return a list of child nodes of this engine. This can be
used to iterate to obtain access to node level operations
::
>>> print(list(engine.nodes))
[Node(name=myfirewall node 1)]
>>> engine.nodes.get(0)
Node(name=myfirewall node 1)
... | [
"Return",
"a",
"list",
"of",
"child",
"nodes",
"of",
"this",
"engine",
".",
"This",
"can",
"be",
"used",
"to",
"iterate",
"to",
"obtain",
"access",
"to",
"node",
"level",
"operations",
"::",
">>>",
"print",
"(",
"list",
"(",
"engine",
".",
"nodes",
"))... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L442-L462 |
gabstopper/smc-python | smc/core/engine.py | Engine.permissions | def permissions(self):
"""
Retrieve the permissions for this engine instance.
::
>>> from smc.core.engine import Engine
>>> engine = Engine('myfirewall')
>>> for x in engine.permissions:
... print(x)
...
AccessControlLis... | python | def permissions(self):
"""
Retrieve the permissions for this engine instance.
::
>>> from smc.core.engine import Engine
>>> engine = Engine('myfirewall')
>>> for x in engine.permissions:
... print(x)
...
AccessControlLis... | [
"def",
"permissions",
"(",
"self",
")",
":",
"acl_list",
"=",
"list",
"(",
"AccessControlList",
".",
"objects",
".",
"all",
"(",
")",
")",
"def",
"acl_map",
"(",
"elem_href",
")",
":",
"for",
"elem",
"in",
"acl_list",
":",
"if",
"elem",
".",
"href",
... | Retrieve the permissions for this engine instance.
::
>>> from smc.core.engine import Engine
>>> engine = Engine('myfirewall')
>>> for x in engine.permissions:
... print(x)
...
AccessControlList(name=ALL Elements)
AccessCont... | [
"Retrieve",
"the",
"permissions",
"for",
"this",
"engine",
"instance",
".",
"::"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L466-L493 |
gabstopper/smc-python | smc/core/engine.py | Engine.pending_changes | def pending_changes(self):
"""
Pending changes provides insight into changes on an engine that are
pending approval or disapproval. Feature requires SMC >= v6.2.
:raises UnsupportedEngineFeature: SMC version >= 6.2 is required to
support pending changes
:rtype: Pendi... | python | def pending_changes(self):
"""
Pending changes provides insight into changes on an engine that are
pending approval or disapproval. Feature requires SMC >= v6.2.
:raises UnsupportedEngineFeature: SMC version >= 6.2 is required to
support pending changes
:rtype: Pendi... | [
"def",
"pending_changes",
"(",
"self",
")",
":",
"if",
"'pending_changes'",
"in",
"self",
".",
"data",
".",
"links",
":",
"return",
"PendingChanges",
"(",
"self",
")",
"raise",
"UnsupportedEngineFeature",
"(",
"'Pending changes is an unsupported feature on this engine: ... | Pending changes provides insight into changes on an engine that are
pending approval or disapproval. Feature requires SMC >= v6.2.
:raises UnsupportedEngineFeature: SMC version >= 6.2 is required to
support pending changes
:rtype: PendingChanges | [
"Pending",
"changes",
"provides",
"insight",
"into",
"changes",
"on",
"an",
"engine",
"that",
"are",
"pending",
"approval",
"or",
"disapproval",
".",
"Feature",
"requires",
"SMC",
">",
"=",
"v6",
".",
"2",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L496-L509 |
gabstopper/smc-python | smc/core/engine.py | Engine.alias_resolving | def alias_resolving(self):
"""
Alias definitions with resolved values as defined on this engine.
Aliases can be used in rules to simplify multiple object creation
::
fw = Engine('myfirewall')
for alias in fw.alias_resolving():
print(alias, alias.r... | python | def alias_resolving(self):
"""
Alias definitions with resolved values as defined on this engine.
Aliases can be used in rules to simplify multiple object creation
::
fw = Engine('myfirewall')
for alias in fw.alias_resolving():
print(alias, alias.r... | [
"def",
"alias_resolving",
"(",
"self",
")",
":",
"alias_list",
"=",
"list",
"(",
"Alias",
".",
"objects",
".",
"all",
"(",
")",
")",
"for",
"alias",
"in",
"self",
".",
"make_request",
"(",
"resource",
"=",
"'alias_resolving'",
")",
":",
"yield",
"Alias",... | Alias definitions with resolved values as defined on this engine.
Aliases can be used in rules to simplify multiple object creation
::
fw = Engine('myfirewall')
for alias in fw.alias_resolving():
print(alias, alias.resolved_value)
...
(Ali... | [
"Alias",
"definitions",
"with",
"resolved",
"values",
"as",
"defined",
"on",
"this",
"engine",
".",
"Aliases",
"can",
"be",
"used",
"in",
"rules",
"to",
"simplify",
"multiple",
"object",
"creation",
"::"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L511-L530 |
gabstopper/smc-python | smc/core/engine.py | Engine.blacklist_bulk | def blacklist_bulk(self, blacklist):
"""
Add blacklist entries to the engine node in bulk. For blacklist to work,
you must also create a rule with action "Apply Blacklist".
First create your blacklist entries using :class:`smc.elements.other.Blacklist`
then provide the blacklist ... | python | def blacklist_bulk(self, blacklist):
"""
Add blacklist entries to the engine node in bulk. For blacklist to work,
you must also create a rule with action "Apply Blacklist".
First create your blacklist entries using :class:`smc.elements.other.Blacklist`
then provide the blacklist ... | [
"def",
"blacklist_bulk",
"(",
"self",
",",
"blacklist",
")",
":",
"self",
".",
"make_request",
"(",
"EngineCommandFailed",
",",
"method",
"=",
"'create'",
",",
"resource",
"=",
"'blacklist'",
",",
"json",
"=",
"blacklist",
".",
"entries",
")"
] | Add blacklist entries to the engine node in bulk. For blacklist to work,
you must also create a rule with action "Apply Blacklist".
First create your blacklist entries using :class:`smc.elements.other.Blacklist`
then provide the blacklist to this method.
:param blacklist Blackli... | [
"Add",
"blacklist",
"entries",
"to",
"the",
"engine",
"node",
"in",
"bulk",
".",
"For",
"blacklist",
"to",
"work",
"you",
"must",
"also",
"create",
"a",
"rule",
"with",
"action",
"Apply",
"Blacklist",
".",
"First",
"create",
"your",
"blacklist",
"entries",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L552-L567 |
gabstopper/smc-python | smc/core/engine.py | Engine.blacklist_show | def blacklist_show(self, **kw):
"""
.. versionadded:: 0.5.6
Requires pip install smc-python-monitoring
Blacklist show requires that you install the smc-python-monitoring
package. To obtain blacklist entries from the engine you need to
use this extension to pl... | python | def blacklist_show(self, **kw):
"""
.. versionadded:: 0.5.6
Requires pip install smc-python-monitoring
Blacklist show requires that you install the smc-python-monitoring
package. To obtain blacklist entries from the engine you need to
use this extension to pl... | [
"def",
"blacklist_show",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"try",
":",
"from",
"smc_monitoring",
".",
"monitors",
".",
"blacklist",
"import",
"BlacklistQuery",
"except",
"ImportError",
":",
"pass",
"else",
":",
"query",
"=",
"BlacklistQuery",
"(",
... | .. versionadded:: 0.5.6
Requires pip install smc-python-monitoring
Blacklist show requires that you install the smc-python-monitoring
package. To obtain blacklist entries from the engine you need to
use this extension to plumb the websocket to the session. If you
nee... | [
"..",
"versionadded",
"::",
"0",
".",
"5",
".",
"6",
"Requires",
"pip",
"install",
"smc",
"-",
"python",
"-",
"monitoring",
"Blacklist",
"show",
"requires",
"that",
"you",
"install",
"the",
"smc",
"-",
"python",
"-",
"monitoring",
"package",
".",
"To",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L581-L615 |
gabstopper/smc-python | smc/core/engine.py | Engine.add_route | def add_route(self, gateway, network):
"""
Add a route to engine. Specify gateway and network.
If this is the default gateway, use a network address of
0.0.0.0/0.
.. note: This will fail if the gateway provided does not have a
corresponding interface on the netw... | python | def add_route(self, gateway, network):
"""
Add a route to engine. Specify gateway and network.
If this is the default gateway, use a network address of
0.0.0.0/0.
.. note: This will fail if the gateway provided does not have a
corresponding interface on the netw... | [
"def",
"add_route",
"(",
"self",
",",
"gateway",
",",
"network",
")",
":",
"self",
".",
"make_request",
"(",
"EngineCommandFailed",
",",
"method",
"=",
"'create'",
",",
"resource",
"=",
"'add_route'",
",",
"params",
"=",
"{",
"'gateway'",
":",
"gateway",
"... | Add a route to engine. Specify gateway and network.
If this is the default gateway, use a network address of
0.0.0.0/0.
.. note: This will fail if the gateway provided does not have a
corresponding interface on the network.
:param str gateway: gateway of an existing in... | [
"Add",
"a",
"route",
"to",
"engine",
".",
"Specify",
"gateway",
"and",
"network",
".",
"If",
"this",
"is",
"the",
"default",
"gateway",
"use",
"a",
"network",
"address",
"of",
"0",
".",
"0",
".",
"0",
".",
"0",
"/",
"0",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L617-L636 |
gabstopper/smc-python | smc/core/engine.py | Engine.routing_monitoring | def routing_monitoring(self):
"""
Return route table for the engine, including
gateway, networks and type of route (dynamic, static).
Calling this can take a few seconds to retrieve routes
from the engine.
Find all routes for engine resource::
>>> engine = E... | python | def routing_monitoring(self):
"""
Return route table for the engine, including
gateway, networks and type of route (dynamic, static).
Calling this can take a few seconds to retrieve routes
from the engine.
Find all routes for engine resource::
>>> engine = E... | [
"def",
"routing_monitoring",
"(",
"self",
")",
":",
"try",
":",
"result",
"=",
"self",
".",
"make_request",
"(",
"EngineCommandFailed",
",",
"resource",
"=",
"'routing_monitoring'",
")",
"return",
"Route",
"(",
"result",
")",
"except",
"SMCConnectionError",
":",... | Return route table for the engine, including
gateway, networks and type of route (dynamic, static).
Calling this can take a few seconds to retrieve routes
from the engine.
Find all routes for engine resource::
>>> engine = Engine('sg_vm')
>>> for route in engine... | [
"Return",
"route",
"table",
"for",
"the",
"engine",
"including",
"gateway",
"networks",
"and",
"type",
"of",
"route",
"(",
"dynamic",
"static",
")",
".",
"Calling",
"this",
"can",
"take",
"a",
"few",
"seconds",
"to",
"retrieve",
"routes",
"from",
"the",
"e... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L675-L702 |
gabstopper/smc-python | smc/core/engine.py | Engine.virtual_resource | def virtual_resource(self):
"""
Available on a Master Engine only.
To get all virtual resources call::
engine.virtual_resource.all()
:raises UnsupportedEngineFeature: master engine only
:rtype: CreateCollection(VirtualResource)
"""
resource = create... | python | def virtual_resource(self):
"""
Available on a Master Engine only.
To get all virtual resources call::
engine.virtual_resource.all()
:raises UnsupportedEngineFeature: master engine only
:rtype: CreateCollection(VirtualResource)
"""
resource = create... | [
"def",
"virtual_resource",
"(",
"self",
")",
":",
"resource",
"=",
"create_collection",
"(",
"self",
".",
"get_relation",
"(",
"'virtual_resources'",
",",
"UnsupportedEngineFeature",
")",
",",
"VirtualResource",
")",
"resource",
".",
"_load_from_engine",
"(",
"self"... | Available on a Master Engine only.
To get all virtual resources call::
engine.virtual_resource.all()
:raises UnsupportedEngineFeature: master engine only
:rtype: CreateCollection(VirtualResource) | [
"Available",
"on",
"a",
"Master",
"Engine",
"only",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L784-L801 |
gabstopper/smc-python | smc/core/engine.py | Engine.add_interface | def add_interface(self, interface):
"""
Add interface is a lower level option to adding interfaces directly
to the engine. The interface is expected to be an instance of
Layer3PhysicalInterface, Layer2PhysicalInterface, TunnelInterface,
or ClusterInterface. The engines instance c... | python | def add_interface(self, interface):
"""
Add interface is a lower level option to adding interfaces directly
to the engine. The interface is expected to be an instance of
Layer3PhysicalInterface, Layer2PhysicalInterface, TunnelInterface,
or ClusterInterface. The engines instance c... | [
"def",
"add_interface",
"(",
"self",
",",
"interface",
")",
":",
"self",
".",
"make_request",
"(",
"EngineCommandFailed",
",",
"method",
"=",
"'create'",
",",
"href",
"=",
"self",
".",
"get_relation",
"(",
"interface",
".",
"typeof",
")",
",",
"json",
"=",... | Add interface is a lower level option to adding interfaces directly
to the engine. The interface is expected to be an instance of
Layer3PhysicalInterface, Layer2PhysicalInterface, TunnelInterface,
or ClusterInterface. The engines instance cache is flushed after
this call is made to provi... | [
"Add",
"interface",
"is",
"a",
"lower",
"level",
"option",
"to",
"adding",
"interfaces",
"directly",
"to",
"the",
"engine",
".",
"The",
"interface",
"is",
"expected",
"to",
"be",
"an",
"instance",
"of",
"Layer3PhysicalInterface",
"Layer2PhysicalInterface",
"Tunnel... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L986-L1005 |
gabstopper/smc-python | smc/core/engine.py | Engine.refresh | def refresh(self, timeout=3, wait_for_finish=False, **kw):
"""
Refresh existing policy on specified device. This is an asynchronous
call that will return a 'follower' link that can be queried to
determine the status of the task.
::
poller = engine.refresh()
... | python | def refresh(self, timeout=3, wait_for_finish=False, **kw):
"""
Refresh existing policy on specified device. This is an asynchronous
call that will return a 'follower' link that can be queried to
determine the status of the task.
::
poller = engine.refresh()
... | [
"def",
"refresh",
"(",
"self",
",",
"timeout",
"=",
"3",
",",
"wait_for_finish",
"=",
"False",
",",
"*",
"*",
"kw",
")",
":",
"return",
"Task",
".",
"execute",
"(",
"self",
",",
"'refresh'",
",",
"timeout",
"=",
"timeout",
",",
"wait_for_finish",
"=",
... | Refresh existing policy on specified device. This is an asynchronous
call that will return a 'follower' link that can be queried to
determine the status of the task.
::
poller = engine.refresh()
while not poller.done():
poller.wait(5)
prin... | [
"Refresh",
"existing",
"policy",
"on",
"specified",
"device",
".",
"This",
"is",
"an",
"asynchronous",
"call",
"that",
"will",
"return",
"a",
"follower",
"link",
"that",
"can",
"be",
"queried",
"to",
"determine",
"the",
"status",
"of",
"the",
"task",
".",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L1007-L1024 |
gabstopper/smc-python | smc/core/engine.py | Engine.generate_snapshot | def generate_snapshot(self, filename='snapshot.zip'):
"""
Generate and retrieve a policy snapshot from the engine
This is blocking as file is downloaded
:param str filename: name of file to save file to, including directory
path
:raises EngineCommandFailed: snapshot ... | python | def generate_snapshot(self, filename='snapshot.zip'):
"""
Generate and retrieve a policy snapshot from the engine
This is blocking as file is downloaded
:param str filename: name of file to save file to, including directory
path
:raises EngineCommandFailed: snapshot ... | [
"def",
"generate_snapshot",
"(",
"self",
",",
"filename",
"=",
"'snapshot.zip'",
")",
":",
"try",
":",
"self",
".",
"make_request",
"(",
"EngineCommandFailed",
",",
"resource",
"=",
"'generate_snapshot'",
",",
"filename",
"=",
"filename",
")",
"except",
"IOError... | Generate and retrieve a policy snapshot from the engine
This is blocking as file is downloaded
:param str filename: name of file to save file to, including directory
path
:raises EngineCommandFailed: snapshot failed, possibly invalid filename
specified
:return: N... | [
"Generate",
"and",
"retrieve",
"a",
"policy",
"snapshot",
"from",
"the",
"engine",
"This",
"is",
"blocking",
"as",
"file",
"is",
"downloaded"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L1050-L1069 |
gabstopper/smc-python | smc/core/engine.py | VPN.add_site | def add_site(self, name, site_elements=None):
"""
Add a VPN site with site elements to this engine.
VPN sites identify the sites with protected networks
to be included in the VPN.
Add a network and new VPN site::
>>> net = Network.get_or_create(name='wireless... | python | def add_site(self, name, site_elements=None):
"""
Add a VPN site with site elements to this engine.
VPN sites identify the sites with protected networks
to be included in the VPN.
Add a network and new VPN site::
>>> net = Network.get_or_create(name='wireless... | [
"def",
"add_site",
"(",
"self",
",",
"name",
",",
"site_elements",
"=",
"None",
")",
":",
"site_elements",
"=",
"site_elements",
"if",
"site_elements",
"else",
"[",
"]",
"return",
"self",
".",
"sites",
".",
"create",
"(",
"name",
",",
"site_elements",
")"
... | Add a VPN site with site elements to this engine.
VPN sites identify the sites with protected networks
to be included in the VPN.
Add a network and new VPN site::
>>> net = Network.get_or_create(name='wireless', ipv4_network='192.168.5.0/24')
>>> engine.vpn.add_s... | [
"Add",
"a",
"VPN",
"site",
"with",
"site",
"elements",
"to",
"this",
"engine",
".",
"VPN",
"sites",
"identify",
"the",
"sites",
"with",
"protected",
"networks",
"to",
"be",
"included",
"in",
"the",
"VPN",
".",
"Add",
"a",
"network",
"and",
"new",
"VPN",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L1245-L1269 |
gabstopper/smc-python | smc/core/engine.py | VPN.generate_certificate | def generate_certificate(self, common_name, public_key_algorithm='rsa',
signature_algorithm='rsa_sha_512', key_length=2048,
signing_ca=None):
"""
Generate an internal gateway certificate used for VPN on this engine.
Certificate request should be an instance of VPNCertific... | python | def generate_certificate(self, common_name, public_key_algorithm='rsa',
signature_algorithm='rsa_sha_512', key_length=2048,
signing_ca=None):
"""
Generate an internal gateway certificate used for VPN on this engine.
Certificate request should be an instance of VPNCertific... | [
"def",
"generate_certificate",
"(",
"self",
",",
"common_name",
",",
"public_key_algorithm",
"=",
"'rsa'",
",",
"signature_algorithm",
"=",
"'rsa_sha_512'",
",",
"key_length",
"=",
"2048",
",",
"signing_ca",
"=",
"None",
")",
":",
"return",
"GatewayCertificate",
"... | Generate an internal gateway certificate used for VPN on this engine.
Certificate request should be an instance of VPNCertificate.
:param: str common_name: common name for certificate
:param str public_key_algorithm: public key type to use. Valid values
rsa, dsa, ecdsa.
:par... | [
"Generate",
"an",
"internal",
"gateway",
"certificate",
"used",
"for",
"VPN",
"on",
"this",
"engine",
".",
"Certificate",
"request",
"should",
"be",
"an",
"instance",
"of",
"VPNCertificate",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L1334-L1357 |
gabstopper/smc-python | smc/core/engine.py | VirtualResource.create | def create(self, name, vfw_id, domain='Shared Domain',
show_master_nic=False, connection_limit=0, comment=None):
"""
Create a new virtual resource. Called through engine
reference::
engine.virtual_resource.create(....)
:param str name: name of virtual resourc... | python | def create(self, name, vfw_id, domain='Shared Domain',
show_master_nic=False, connection_limit=0, comment=None):
"""
Create a new virtual resource. Called through engine
reference::
engine.virtual_resource.create(....)
:param str name: name of virtual resourc... | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"vfw_id",
",",
"domain",
"=",
"'Shared Domain'",
",",
"show_master_nic",
"=",
"False",
",",
"connection_limit",
"=",
"0",
",",
"comment",
"=",
"None",
")",
":",
"allocated_domain",
"=",
"domain_helper",
"(",
... | Create a new virtual resource. Called through engine
reference::
engine.virtual_resource.create(....)
:param str name: name of virtual resource
:param int vfw_id: virtual fw identifier
:param str domain: name of domain to install, (default Shared)
:param bool show_m... | [
"Create",
"a",
"new",
"virtual",
"resource",
".",
"Called",
"through",
"engine",
"reference",
"::"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L1486-L1512 |
gabstopper/smc-python | smc/core/general.py | SNMP.enable | def enable(self, snmp_agent, snmp_location=None, snmp_interface=None):
"""
Enable SNMP on the engine. Specify a list of interfaces
by ID to enable only on those interfaces. Only interfaces
that have NDI's are supported.
:param str,Element snmp_agent: the SNMP agent refer... | python | def enable(self, snmp_agent, snmp_location=None, snmp_interface=None):
"""
Enable SNMP on the engine. Specify a list of interfaces
by ID to enable only on those interfaces. Only interfaces
that have NDI's are supported.
:param str,Element snmp_agent: the SNMP agent refer... | [
"def",
"enable",
"(",
"self",
",",
"snmp_agent",
",",
"snmp_location",
"=",
"None",
",",
"snmp_interface",
"=",
"None",
")",
":",
"agent",
"=",
"element_resolver",
"(",
"snmp_agent",
")",
"snmp_interface",
"=",
"[",
"]",
"if",
"not",
"snmp_interface",
"else"... | Enable SNMP on the engine. Specify a list of interfaces
by ID to enable only on those interfaces. Only interfaces
that have NDI's are supported.
:param str,Element snmp_agent: the SNMP agent reference for this engine
:param str snmp_location: the SNMP location identifier for the... | [
"Enable",
"SNMP",
"on",
"the",
"engine",
".",
"Specify",
"a",
"list",
"of",
"interfaces",
"by",
"ID",
"to",
"enable",
"only",
"on",
"those",
"interfaces",
".",
"Only",
"interfaces",
"that",
"have",
"NDI",
"s",
"are",
"supported",
".",
":",
"param",
"str"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/general.py#L55-L74 |
gabstopper/smc-python | smc/core/general.py | SNMP.update_configuration | def update_configuration(self, **kwargs):
"""
Update the SNMP configuration using any kwargs supported in the
`enable` constructor. Return whether a change was made. You must call
update on the engine to commit any changes.
:param dict kwargs: keyword arguments supported... | python | def update_configuration(self, **kwargs):
"""
Update the SNMP configuration using any kwargs supported in the
`enable` constructor. Return whether a change was made. You must call
update on the engine to commit any changes.
:param dict kwargs: keyword arguments supported... | [
"def",
"update_configuration",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"updated",
"=",
"False",
"if",
"'snmp_agent'",
"in",
"kwargs",
":",
"kwargs",
".",
"update",
"(",
"snmp_agent_ref",
"=",
"kwargs",
".",
"pop",
"(",
"'snmp_agent'",
")",
")",
"... | Update the SNMP configuration using any kwargs supported in the
`enable` constructor. Return whether a change was made. You must call
update on the engine to commit any changes.
:param dict kwargs: keyword arguments supported by enable constructor
:rtype: bool | [
"Update",
"the",
"SNMP",
"configuration",
"using",
"any",
"kwargs",
"supported",
"in",
"the",
"enable",
"constructor",
".",
"Return",
"whether",
"a",
"change",
"was",
"made",
".",
"You",
"must",
"call",
"update",
"on",
"the",
"engine",
"to",
"commit",
"any",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/general.py#L85-L114 |
gabstopper/smc-python | smc/core/general.py | SNMP.interface | def interface(self):
"""
Return a list of physical interfaces that the SNMP
agent is bound to.
:rtype: list(PhysicalInterface)
"""
nics = set([nic.get('nicid') for nic in \
getattr(self.engine, 'snmp_interface', [])])
return [self.engine.inter... | python | def interface(self):
"""
Return a list of physical interfaces that the SNMP
agent is bound to.
:rtype: list(PhysicalInterface)
"""
nics = set([nic.get('nicid') for nic in \
getattr(self.engine, 'snmp_interface', [])])
return [self.engine.inter... | [
"def",
"interface",
"(",
"self",
")",
":",
"nics",
"=",
"set",
"(",
"[",
"nic",
".",
"get",
"(",
"'nicid'",
")",
"for",
"nic",
"in",
"getattr",
"(",
"self",
".",
"engine",
",",
"'snmp_interface'",
",",
"[",
"]",
")",
"]",
")",
"return",
"[",
"sel... | Return a list of physical interfaces that the SNMP
agent is bound to.
:rtype: list(PhysicalInterface) | [
"Return",
"a",
"list",
"of",
"physical",
"interfaces",
"that",
"the",
"SNMP",
"agent",
"is",
"bound",
"to",
".",
":",
"rtype",
":",
"list",
"(",
"PhysicalInterface",
")"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/general.py#L126-L135 |
gabstopper/smc-python | smc/core/general.py | DNSRelay.enable | def enable(self, interface_id, dns_relay_profile=None):
"""
Enable the DNS Relay service on this engine.
:param int interface_id: interface id to enable relay
:param str,DNSRelayProfile dns_relay_profile: DNSRelayProfile element
or str href
:raises EngineCommandFaile... | python | def enable(self, interface_id, dns_relay_profile=None):
"""
Enable the DNS Relay service on this engine.
:param int interface_id: interface id to enable relay
:param str,DNSRelayProfile dns_relay_profile: DNSRelayProfile element
or str href
:raises EngineCommandFaile... | [
"def",
"enable",
"(",
"self",
",",
"interface_id",
",",
"dns_relay_profile",
"=",
"None",
")",
":",
"if",
"not",
"dns_relay_profile",
":",
"# Use default",
"href",
"=",
"DNSRelayProfile",
"(",
"'Cache Only'",
")",
".",
"href",
"else",
":",
"href",
"=",
"elem... | Enable the DNS Relay service on this engine.
:param int interface_id: interface id to enable relay
:param str,DNSRelayProfile dns_relay_profile: DNSRelayProfile element
or str href
:raises EngineCommandFailed: interface not found
:raises ElementNotFound: profile not found
... | [
"Enable",
"the",
"DNS",
"Relay",
"service",
"on",
"this",
"engine",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/general.py#L162-L181 |
gabstopper/smc-python | smc/core/general.py | DNSRelay.disable | def disable(self):
"""
Disable DNS Relay on this engine
:return: None
"""
self.engine.data.update(dns_relay_interface=[])
self.engine.data.pop('dns_relay_profile_ref', None) | python | def disable(self):
"""
Disable DNS Relay on this engine
:return: None
"""
self.engine.data.update(dns_relay_interface=[])
self.engine.data.pop('dns_relay_profile_ref', None) | [
"def",
"disable",
"(",
"self",
")",
":",
"self",
".",
"engine",
".",
"data",
".",
"update",
"(",
"dns_relay_interface",
"=",
"[",
"]",
")",
"self",
".",
"engine",
".",
"data",
".",
"pop",
"(",
"'dns_relay_profile_ref'",
",",
"None",
")"
] | Disable DNS Relay on this engine
:return: None | [
"Disable",
"DNS",
"Relay",
"on",
"this",
"engine",
":",
"return",
":",
"None"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/general.py#L183-L190 |
gabstopper/smc-python | smc/core/general.py | RankedDNSAddress.remove | def remove(self, values):
"""
Remove DNS entries from this ranked DNS list. A DNS entry can be either
a raw IP Address, or an element of type :class:`smc.elements.network.Host`
or :class:`smc.elements.servers.DNSServer`.
:param list values: list of IP addresses, Host and... | python | def remove(self, values):
"""
Remove DNS entries from this ranked DNS list. A DNS entry can be either
a raw IP Address, or an element of type :class:`smc.elements.network.Host`
or :class:`smc.elements.servers.DNSServer`.
:param list values: list of IP addresses, Host and... | [
"def",
"remove",
"(",
"self",
",",
"values",
")",
":",
"removables",
"=",
"[",
"]",
"for",
"value",
"in",
"values",
":",
"if",
"value",
"in",
"self",
":",
"removables",
".",
"append",
"(",
"value",
")",
"if",
"removables",
":",
"self",
".",
"entries"... | Remove DNS entries from this ranked DNS list. A DNS entry can be either
a raw IP Address, or an element of type :class:`smc.elements.network.Host`
or :class:`smc.elements.servers.DNSServer`.
:param list values: list of IP addresses, Host and/or DNSServer elements.
:return: None | [
"Remove",
"DNS",
"entries",
"from",
"this",
"ranked",
"DNS",
"list",
".",
"A",
"DNS",
"entry",
"can",
"be",
"either",
"a",
"raw",
"IP",
"Address",
"or",
"an",
"element",
"of",
"type",
":",
"class",
":",
"smc",
".",
"elements",
".",
"network",
".",
"H... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/general.py#L329-L348 |
gabstopper/smc-python | smc/core/general.py | Layer2Settings.enable | def enable(self, policy):
"""
Set a layer 2 interface policy.
:param str,Element policy: an InterfacePolicy or str href
:raises LoadPolicyFailed: Invalid policy specified
:raises ElementNotFound: InterfacePolicy not found
:return: None
"""
if hasa... | python | def enable(self, policy):
"""
Set a layer 2 interface policy.
:param str,Element policy: an InterfacePolicy or str href
:raises LoadPolicyFailed: Invalid policy specified
:raises ElementNotFound: InterfacePolicy not found
:return: None
"""
if hasa... | [
"def",
"enable",
"(",
"self",
",",
"policy",
")",
":",
"if",
"hasattr",
"(",
"policy",
",",
"'href'",
")",
":",
"if",
"not",
"isinstance",
"(",
"policy",
",",
"InterfacePolicy",
")",
":",
"raise",
"LoadPolicyFailed",
"(",
"'Invalid policy type specified. The p... | Set a layer 2 interface policy.
:param str,Element policy: an InterfacePolicy or str href
:raises LoadPolicyFailed: Invalid policy specified
:raises ElementNotFound: InterfacePolicy not found
:return: None | [
"Set",
"a",
"layer",
"2",
"interface",
"policy",
".",
":",
"param",
"str",
"Element",
"policy",
":",
"an",
"InterfacePolicy",
"or",
"str",
"href",
":",
"raises",
"LoadPolicyFailed",
":",
"Invalid",
"policy",
"specified",
":",
"raises",
"ElementNotFound",
":",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/general.py#L424-L438 |
gabstopper/smc-python | smc/policy/ips.py | IPSPolicy.create | def create(cls, name, template='High-Security IPS Template'):
"""
Create an IPS Policy
:param str name: Name of policy
:param str template: name of template
:raises CreatePolicyFailed: policy failed to create
:return: IPSPolicy
"""
try:
if cls... | python | def create(cls, name, template='High-Security IPS Template'):
"""
Create an IPS Policy
:param str name: Name of policy
:param str template: name of template
:raises CreatePolicyFailed: policy failed to create
:return: IPSPolicy
"""
try:
if cls... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"template",
"=",
"'High-Security IPS Template'",
")",
":",
"try",
":",
"if",
"cls",
".",
"typeof",
"==",
"'ips_template_policy'",
"and",
"template",
"is",
"None",
":",
"fw_template",
"=",
"None",
"else",
":",
... | Create an IPS Policy
:param str name: Name of policy
:param str template: name of template
:raises CreatePolicyFailed: policy failed to create
:return: IPSPolicy | [
"Create",
"an",
"IPS",
"Policy"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/ips.py#L98-L121 |
gabstopper/smc-python | smc/base/structs.py | BaseIterable.get | def get(self, *args, **kwargs):
"""
Get an element from the iterable by an arg or kwarg.
Args can be a single positional argument that is an index
value to retrieve. If the specified index is out of range,
None is returned. Otherwise use kwargs to provide a key/value.
Th... | python | def get(self, *args, **kwargs):
"""
Get an element from the iterable by an arg or kwarg.
Args can be a single positional argument that is an index
value to retrieve. If the specified index is out of range,
None is returned. Otherwise use kwargs to provide a key/value.
Th... | [
"def",
"get",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
":",
"if",
"args",
":",
"index",
"=",
"args",
"[",
"0",
"]",
"if",
"index",
"<=",
"len",
"(",
"self",
")",
"-",
"1",
":",
"return",
"self",
"[",
"... | Get an element from the iterable by an arg or kwarg.
Args can be a single positional argument that is an index
value to retrieve. If the specified index is out of range,
None is returned. Otherwise use kwargs to provide a key/value.
The key is expected to be a valid attribute of the ite... | [
"Get",
"an",
"element",
"from",
"the",
"iterable",
"by",
"an",
"arg",
"or",
"kwarg",
".",
"Args",
"can",
"be",
"a",
"single",
"positional",
"argument",
"that",
"is",
"an",
"index",
"value",
"to",
"retrieve",
".",
"If",
"the",
"specified",
"index",
"is",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/structs.py#L54-L81 |
gabstopper/smc-python | smc/examples/ip_lists.py | upload_as_zip | def upload_as_zip(name, filename):
"""
Upload an IPList as a zip file. Useful when IPList is very large.
This is the default upload format for IPLists.
:param str name: name of IPList
:param str filename: name of zip file to upload, full path
:return: None
"""
location = list(IPList.obj... | python | def upload_as_zip(name, filename):
"""
Upload an IPList as a zip file. Useful when IPList is very large.
This is the default upload format for IPLists.
:param str name: name of IPList
:param str filename: name of zip file to upload, full path
:return: None
"""
location = list(IPList.obj... | [
"def",
"upload_as_zip",
"(",
"name",
",",
"filename",
")",
":",
"location",
"=",
"list",
"(",
"IPList",
".",
"objects",
".",
"filter",
"(",
"name",
")",
")",
"if",
"location",
":",
"iplist",
"=",
"location",
"[",
"0",
"]",
"return",
"iplist",
".",
"u... | Upload an IPList as a zip file. Useful when IPList is very large.
This is the default upload format for IPLists.
:param str name: name of IPList
:param str filename: name of zip file to upload, full path
:return: None | [
"Upload",
"an",
"IPList",
"as",
"a",
"zip",
"file",
".",
"Useful",
"when",
"IPList",
"is",
"very",
"large",
".",
"This",
"is",
"the",
"default",
"upload",
"format",
"for",
"IPLists",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/examples/ip_lists.py#L42-L54 |
gabstopper/smc-python | smc/examples/ip_lists.py | upload_as_text | def upload_as_text(name, filename):
"""
Upload the IPList as text from a file.
:param str name: name of IPList
:param str filename: name of text file to upload
:return: None
"""
location = list(IPList.objects.filter(name))
if location:
iplist = location[0]
return iplist... | python | def upload_as_text(name, filename):
"""
Upload the IPList as text from a file.
:param str name: name of IPList
:param str filename: name of text file to upload
:return: None
"""
location = list(IPList.objects.filter(name))
if location:
iplist = location[0]
return iplist... | [
"def",
"upload_as_text",
"(",
"name",
",",
"filename",
")",
":",
"location",
"=",
"list",
"(",
"IPList",
".",
"objects",
".",
"filter",
"(",
"name",
")",
")",
"if",
"location",
":",
"iplist",
"=",
"location",
"[",
"0",
"]",
"return",
"iplist",
".",
"... | Upload the IPList as text from a file.
:param str name: name of IPList
:param str filename: name of text file to upload
:return: None | [
"Upload",
"the",
"IPList",
"as",
"text",
"from",
"a",
"file",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/examples/ip_lists.py#L57-L68 |
gabstopper/smc-python | smc/examples/ip_lists.py | upload_as_json | def upload_as_json(name, mylist):
"""
Upload the IPList as json payload.
:param str name: name of IPList
:param list: list of IPList entries
:return: None
"""
location = list(IPList.objects.filter(name))
if location:
iplist = location[0]
return iplist.upload(json=mylist... | python | def upload_as_json(name, mylist):
"""
Upload the IPList as json payload.
:param str name: name of IPList
:param list: list of IPList entries
:return: None
"""
location = list(IPList.objects.filter(name))
if location:
iplist = location[0]
return iplist.upload(json=mylist... | [
"def",
"upload_as_json",
"(",
"name",
",",
"mylist",
")",
":",
"location",
"=",
"list",
"(",
"IPList",
".",
"objects",
".",
"filter",
"(",
"name",
")",
")",
"if",
"location",
":",
"iplist",
"=",
"location",
"[",
"0",
"]",
"return",
"iplist",
".",
"up... | Upload the IPList as json payload.
:param str name: name of IPList
:param list: list of IPList entries
:return: None | [
"Upload",
"the",
"IPList",
"as",
"json",
"payload",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/examples/ip_lists.py#L71-L82 |
gabstopper/smc-python | smc/examples/ip_lists.py | download_as_zip | def download_as_zip(name, filename):
"""
Download IPList with zip compression. Recommended for IPLists
of larger sizes. This is the default format for downloading
IPLists.
:param str name: name of IPList
:param str filename: name of filename for IPList
"""
location = list(IPList.objects... | python | def download_as_zip(name, filename):
"""
Download IPList with zip compression. Recommended for IPLists
of larger sizes. This is the default format for downloading
IPLists.
:param str name: name of IPList
:param str filename: name of filename for IPList
"""
location = list(IPList.objects... | [
"def",
"download_as_zip",
"(",
"name",
",",
"filename",
")",
":",
"location",
"=",
"list",
"(",
"IPList",
".",
"objects",
".",
"filter",
"(",
"name",
")",
")",
"if",
"location",
":",
"iplist",
"=",
"location",
"[",
"0",
"]",
"return",
"iplist",
".",
... | Download IPList with zip compression. Recommended for IPLists
of larger sizes. This is the default format for downloading
IPLists.
:param str name: name of IPList
:param str filename: name of filename for IPList | [
"Download",
"IPList",
"with",
"zip",
"compression",
".",
"Recommended",
"for",
"IPLists",
"of",
"larger",
"sizes",
".",
"This",
"is",
"the",
"default",
"format",
"for",
"downloading",
"IPLists",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/examples/ip_lists.py#L85-L97 |
gabstopper/smc-python | smc/examples/ip_lists.py | download_as_text | def download_as_text(name, filename):
"""
Download IPList as text to specified filename.
:param str name: name of IPList
:param str filename: name of file for IPList download
"""
location = list(IPList.objects.filter(name))
if location:
iplist = location[0]
return iplist.dow... | python | def download_as_text(name, filename):
"""
Download IPList as text to specified filename.
:param str name: name of IPList
:param str filename: name of file for IPList download
"""
location = list(IPList.objects.filter(name))
if location:
iplist = location[0]
return iplist.dow... | [
"def",
"download_as_text",
"(",
"name",
",",
"filename",
")",
":",
"location",
"=",
"list",
"(",
"IPList",
".",
"objects",
".",
"filter",
"(",
"name",
")",
")",
"if",
"location",
":",
"iplist",
"=",
"location",
"[",
"0",
"]",
"return",
"iplist",
".",
... | Download IPList as text to specified filename.
:param str name: name of IPList
:param str filename: name of file for IPList download | [
"Download",
"IPList",
"as",
"text",
"to",
"specified",
"filename",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/examples/ip_lists.py#L100-L110 |
gabstopper/smc-python | smc/examples/ip_lists.py | download_as_json | def download_as_json(name):
"""
Download IPList as json. This would allow for easily
manipulation of the IPList, but generally recommended only for
smaller lists
:param str name: name of IPList
:return: None
"""
location = list(IPList.objects.filter(name))
if location:
ipli... | python | def download_as_json(name):
"""
Download IPList as json. This would allow for easily
manipulation of the IPList, but generally recommended only for
smaller lists
:param str name: name of IPList
:return: None
"""
location = list(IPList.objects.filter(name))
if location:
ipli... | [
"def",
"download_as_json",
"(",
"name",
")",
":",
"location",
"=",
"list",
"(",
"IPList",
".",
"objects",
".",
"filter",
"(",
"name",
")",
")",
"if",
"location",
":",
"iplist",
"=",
"location",
"[",
"0",
"]",
"return",
"iplist",
".",
"download",
"(",
... | Download IPList as json. This would allow for easily
manipulation of the IPList, but generally recommended only for
smaller lists
:param str name: name of IPList
:return: None | [
"Download",
"IPList",
"as",
"json",
".",
"This",
"would",
"allow",
"for",
"easily",
"manipulation",
"of",
"the",
"IPList",
"but",
"generally",
"recommended",
"only",
"for",
"smaller",
"lists"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/examples/ip_lists.py#L113-L125 |
gabstopper/smc-python | smc/examples/ip_lists.py | create_iplist_with_data | def create_iplist_with_data(name, iplist):
"""
Create an IPList with initial list contents.
:param str name: name of IPList
:param list iplist: list of IPList IP's, networks, etc
:return: href of list location
"""
iplist = IPList.create(name=name, iplist=iplist)
return iplist | python | def create_iplist_with_data(name, iplist):
"""
Create an IPList with initial list contents.
:param str name: name of IPList
:param list iplist: list of IPList IP's, networks, etc
:return: href of list location
"""
iplist = IPList.create(name=name, iplist=iplist)
return iplist | [
"def",
"create_iplist_with_data",
"(",
"name",
",",
"iplist",
")",
":",
"iplist",
"=",
"IPList",
".",
"create",
"(",
"name",
"=",
"name",
",",
"iplist",
"=",
"iplist",
")",
"return",
"iplist"
] | Create an IPList with initial list contents.
:param str name: name of IPList
:param list iplist: list of IPList IP's, networks, etc
:return: href of list location | [
"Create",
"an",
"IPList",
"with",
"initial",
"list",
"contents",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/examples/ip_lists.py#L139-L148 |
gabstopper/smc-python | smc/routing/ospf.py | OSPF.enable | def enable(self, ospf_profile=None, router_id=None):
"""
Enable OSPF on this engine. For master engines, enable
OSPF on the virtual firewall.
Once enabled on the engine, add an OSPF area to an interface::
engine.dynamic_routing.ospf.enable()
interface = engine.r... | python | def enable(self, ospf_profile=None, router_id=None):
"""
Enable OSPF on this engine. For master engines, enable
OSPF on the virtual firewall.
Once enabled on the engine, add an OSPF area to an interface::
engine.dynamic_routing.ospf.enable()
interface = engine.r... | [
"def",
"enable",
"(",
"self",
",",
"ospf_profile",
"=",
"None",
",",
"router_id",
"=",
"None",
")",
":",
"ospf_profile",
"=",
"element_resolver",
"(",
"ospf_profile",
")",
"if",
"ospf_profile",
"else",
"OSPFProfile",
"(",
"'Default OSPFv2 Profile'",
")",
".",
... | Enable OSPF on this engine. For master engines, enable
OSPF on the virtual firewall.
Once enabled on the engine, add an OSPF area to an interface::
engine.dynamic_routing.ospf.enable()
interface = engine.routing.get(0)
interface.add_ospf_area(OSPFArea('myarea'))
... | [
"Enable",
"OSPF",
"on",
"this",
"engine",
".",
"For",
"master",
"engines",
"enable",
"OSPF",
"on",
"the",
"virtual",
"firewall",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/ospf.py#L100-L123 |
gabstopper/smc-python | smc/routing/ospf.py | OSPF.update_configuration | def update_configuration(self, **kwargs):
"""
Update the OSPF configuration using kwargs that match the
`enable` constructor.
:param dict kwargs: keyword arguments matching enable constructor.
:return: whether change was made
:rtype: bool
"""
upda... | python | def update_configuration(self, **kwargs):
"""
Update the OSPF configuration using kwargs that match the
`enable` constructor.
:param dict kwargs: keyword arguments matching enable constructor.
:return: whether change was made
:rtype: bool
"""
upda... | [
"def",
"update_configuration",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"updated",
"=",
"False",
"if",
"'ospf_profile'",
"in",
"kwargs",
":",
"kwargs",
".",
"update",
"(",
"ospfv2_profile_ref",
"=",
"kwargs",
".",
"pop",
"(",
"'ospf_profile'",
")",
... | Update the OSPF configuration using kwargs that match the
`enable` constructor.
:param dict kwargs: keyword arguments matching enable constructor.
:return: whether change was made
:rtype: bool | [
"Update",
"the",
"OSPF",
"configuration",
"using",
"kwargs",
"that",
"match",
"the",
"enable",
"constructor",
".",
":",
"param",
"dict",
"kwargs",
":",
"keyword",
"arguments",
"matching",
"enable",
"constructor",
".",
":",
"return",
":",
"whether",
"change",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/ospf.py#L125-L142 |
gabstopper/smc-python | smc/routing/ospf.py | OSPFArea.create | def create(cls, name, interface_settings_ref=None, area_id=1,
area_type='normal', outbound_filters=None,
inbound_filters=None, shortcut_capable_area=False,
ospfv2_virtual_links_endpoints_container=None,
ospf_abr_substitute_container=None, comment=None, **kwarg... | python | def create(cls, name, interface_settings_ref=None, area_id=1,
area_type='normal', outbound_filters=None,
inbound_filters=None, shortcut_capable_area=False,
ospfv2_virtual_links_endpoints_container=None,
ospf_abr_substitute_container=None, comment=None, **kwarg... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"interface_settings_ref",
"=",
"None",
",",
"area_id",
"=",
"1",
",",
"area_type",
"=",
"'normal'",
",",
"outbound_filters",
"=",
"None",
",",
"inbound_filters",
"=",
"None",
",",
"shortcut_capable_area",
"=",
"... | Create a new OSPF Area
:param str name: name of OSPFArea configuration
:param str,OSPFInterfaceSetting interface_settings_ref: an OSPFInterfaceSetting
element or href. If None, uses the default system profile
:param str name: area id
:param str area_type: \|normal\|stub\|not... | [
"Create",
"a",
"new",
"OSPF",
"Area"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/ospf.py#L210-L257 |
gabstopper/smc-python | smc/routing/ospf.py | OSPFInterfaceSetting.create | def create(cls, name, dead_interval=40, hello_interval=10,
hello_interval_type='normal', dead_multiplier=1,
mtu_mismatch_detection=True, retransmit_interval=5,
router_priority=1, transmit_delay=1,
authentication_type=None, password=None,
key_cha... | python | def create(cls, name, dead_interval=40, hello_interval=10,
hello_interval_type='normal', dead_multiplier=1,
mtu_mismatch_detection=True, retransmit_interval=5,
router_priority=1, transmit_delay=1,
authentication_type=None, password=None,
key_cha... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"dead_interval",
"=",
"40",
",",
"hello_interval",
"=",
"10",
",",
"hello_interval_type",
"=",
"'normal'",
",",
"dead_multiplier",
"=",
"1",
",",
"mtu_mismatch_detection",
"=",
"True",
",",
"retransmit_interval",
... | Create custom OSPF interface settings profile
:param str name: name of interface settings
:param int dead_interval: in seconds
:param str hello_interval: in seconds
:param str hello_interval_type: \|normal\|fast_hello
:param int dead_multipler: fast hello packet multipler
... | [
"Create",
"custom",
"OSPF",
"interface",
"settings",
"profile"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/ospf.py#L297-L337 |
gabstopper/smc-python | smc/routing/ospf.py | OSPFKeyChain.create | def create(cls, name, key_chain_entry):
"""
Create a key chain with list of keys
Key_chain_entry format is::
[{'key': 'xxxx', 'key_id': 1-255, 'send_key': True|False}]
:param str name: Name of key chain
:param list key_chain_entry: list of key chain entries
... | python | def create(cls, name, key_chain_entry):
"""
Create a key chain with list of keys
Key_chain_entry format is::
[{'key': 'xxxx', 'key_id': 1-255, 'send_key': True|False}]
:param str name: Name of key chain
:param list key_chain_entry: list of key chain entries
... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"key_chain_entry",
")",
":",
"key_chain_entry",
"=",
"key_chain_entry",
"or",
"[",
"]",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'ospfv2_key_chain_entry'",
":",
"key_chain_entry",
"}",
"return",
"ElementCrea... | Create a key chain with list of keys
Key_chain_entry format is::
[{'key': 'xxxx', 'key_id': 1-255, 'send_key': True|False}]
:param str name: Name of key chain
:param list key_chain_entry: list of key chain entries
:raises CreateElementFailed: create failed with reason
... | [
"Create",
"a",
"key",
"chain",
"with",
"list",
"of",
"keys"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/ospf.py#L359-L377 |
gabstopper/smc-python | smc/routing/ospf.py | OSPFProfile.create | def create(cls, name, domain_settings_ref=None, external_distance=110,
inter_distance=110, intra_distance=110, redistribution_entry=None,
default_metric=None, comment=None):
"""
Create an OSPF Profile.
If providing a list of redistribution entries, provide ... | python | def create(cls, name, domain_settings_ref=None, external_distance=110,
inter_distance=110, intra_distance=110, redistribution_entry=None,
default_metric=None, comment=None):
"""
Create an OSPF Profile.
If providing a list of redistribution entries, provide ... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"domain_settings_ref",
"=",
"None",
",",
"external_distance",
"=",
"110",
",",
"inter_distance",
"=",
"110",
",",
"intra_distance",
"=",
"110",
",",
"redistribution_entry",
"=",
"None",
",",
"default_metric",
"=",... | Create an OSPF Profile.
If providing a list of redistribution entries, provide in the following
dict format:
{'enabled': boolean, 'metric_type': 'external_1' or 'external_2',
'metric': 2, 'type': 'kernel'}
Valid types for redistribution entries are: k... | [
"Create",
"an",
"OSPF",
"Profile",
".",
"If",
"providing",
"a",
"list",
"of",
"redistribution",
"entries",
"provide",
"in",
"the",
"following",
"dict",
"format",
":",
"{",
"enabled",
":",
"boolean",
"metric_type",
":",
"external_1",
"or",
"external_2",
"metric... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/ospf.py#L425-L478 |
gabstopper/smc-python | smc/routing/ospf.py | OSPFDomainSetting.create | def create(cls, name, abr_type='cisco', auto_cost_bandwidth=100,
deprecated_algorithm=False, initial_delay=200,
initial_hold_time=1000, max_hold_time=10000,
shutdown_max_metric_lsa=0, startup_max_metric_lsa=0):
"""
Create custom Domain Settings
Domai... | python | def create(cls, name, abr_type='cisco', auto_cost_bandwidth=100,
deprecated_algorithm=False, initial_delay=200,
initial_hold_time=1000, max_hold_time=10000,
shutdown_max_metric_lsa=0, startup_max_metric_lsa=0):
"""
Create custom Domain Settings
Domai... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"abr_type",
"=",
"'cisco'",
",",
"auto_cost_bandwidth",
"=",
"100",
",",
"deprecated_algorithm",
"=",
"False",
",",
"initial_delay",
"=",
"200",
",",
"initial_hold_time",
"=",
"1000",
",",
"max_hold_time",
"=",
... | Create custom Domain Settings
Domain settings are referenced by an OSPFProfile
:param str name: name of custom domain settings
:param str abr_type: cisco|shortcut|standard
:param int auto_cost_bandwidth: Mbits/s
:param bool deprecated_algorithm: RFC 1518 compatibility
:... | [
"Create",
"custom",
"Domain",
"Settings"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/ospf.py#L519-L551 |
gabstopper/smc-python | smc/base/decorators.py | create_hook | def create_hook(function):
"""
Provide a pre-filter to the create function that provides the ability
to modify the element json before submitting to the SMC. To register
a create hook, set on the class or top level Element class to enable
this on any descendent of Element::
Element._cre... | python | def create_hook(function):
"""
Provide a pre-filter to the create function that provides the ability
to modify the element json before submitting to the SMC. To register
a create hook, set on the class or top level Element class to enable
this on any descendent of Element::
Element._cre... | [
"def",
"create_hook",
"(",
"function",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"function",
")",
"def",
"run",
"(",
"cls",
",",
"json",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"hasattr",
"(",
"cls",
",",
"'_create_hook'",
")",
":",
"json",
"... | Provide a pre-filter to the create function that provides the ability
to modify the element json before submitting to the SMC. To register
a create hook, set on the class or top level Element class to enable
this on any descendent of Element::
Element._create_hook = classmethod(myhook)
... | [
"Provide",
"a",
"pre",
"-",
"filter",
"to",
"the",
"create",
"function",
"that",
"provides",
"the",
"ability",
"to",
"modify",
"the",
"element",
"json",
"before",
"submitting",
"to",
"the",
"SMC",
".",
"To",
"register",
"a",
"create",
"hook",
"set",
"on",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/decorators.py#L81-L104 |
gabstopper/smc-python | smc/base/decorators.py | exception | def exception(function):
"""
If exception was specified for prepared_request,
inject this into SMCRequest so it can be used for
return if needed.
"""
@functools.wraps(function)
def wrapper(*exception, **kwargs):
result = function(**kwargs)
if exception:
result.exc... | python | def exception(function):
"""
If exception was specified for prepared_request,
inject this into SMCRequest so it can be used for
return if needed.
"""
@functools.wraps(function)
def wrapper(*exception, **kwargs):
result = function(**kwargs)
if exception:
result.exc... | [
"def",
"exception",
"(",
"function",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"function",
")",
"def",
"wrapper",
"(",
"*",
"exception",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"function",
"(",
"*",
"*",
"kwargs",
")",
"if",
"exception... | If exception was specified for prepared_request,
inject this into SMCRequest so it can be used for
return if needed. | [
"If",
"exception",
"was",
"specified",
"for",
"prepared_request",
"inject",
"this",
"into",
"SMCRequest",
"so",
"it",
"can",
"be",
"used",
"for",
"return",
"if",
"needed",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/decorators.py#L107-L119 |
gabstopper/smc-python | smc/core/engines.py | add_snmp | def add_snmp(data, interfaces):
"""
Format data for adding SNMP to an engine.
:param list data: list of interfaces as provided by kw
:param list interfaces: interfaces to enable SNMP by id
"""
snmp_interface = []
if interfaces: # Not providing interfaces will enable SNMP on all NDIs
... | python | def add_snmp(data, interfaces):
"""
Format data for adding SNMP to an engine.
:param list data: list of interfaces as provided by kw
:param list interfaces: interfaces to enable SNMP by id
"""
snmp_interface = []
if interfaces: # Not providing interfaces will enable SNMP on all NDIs
... | [
"def",
"add_snmp",
"(",
"data",
",",
"interfaces",
")",
":",
"snmp_interface",
"=",
"[",
"]",
"if",
"interfaces",
":",
"# Not providing interfaces will enable SNMP on all NDIs",
"interfaces",
"=",
"map",
"(",
"str",
",",
"interfaces",
")",
"for",
"interface",
"in"... | Format data for adding SNMP to an engine.
:param list data: list of interfaces as provided by kw
:param list interfaces: interfaces to enable SNMP by id | [
"Format",
"data",
"for",
"adding",
"SNMP",
"to",
"an",
"engine",
".",
":",
"param",
"list",
"data",
":",
"list",
"of",
"interfaces",
"as",
"provided",
"by",
"kw",
":",
"param",
"list",
"interfaces",
":",
"interfaces",
"to",
"enable",
"SNMP",
"by",
"id"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engines.py#L824-L848 |
gabstopper/smc-python | smc/core/engines.py | Layer3Firewall.create_bulk | def create_bulk(cls, name, interfaces=None,
primary_mgt=None, backup_mgt=None,
log_server_ref=None,
domain_server_address=None,
location_ref=None, default_nat=False,
enable_antivirus=False, enable_gti=False,
... | python | def create_bulk(cls, name, interfaces=None,
primary_mgt=None, backup_mgt=None,
log_server_ref=None,
domain_server_address=None,
location_ref=None, default_nat=False,
enable_antivirus=False, enable_gti=False,
... | [
"def",
"create_bulk",
"(",
"cls",
",",
"name",
",",
"interfaces",
"=",
"None",
",",
"primary_mgt",
"=",
"None",
",",
"backup_mgt",
"=",
"None",
",",
"log_server_ref",
"=",
"None",
",",
"domain_server_address",
"=",
"None",
",",
"location_ref",
"=",
"None",
... | Create a Layer 3 Firewall providing all of the interface configuration.
This method provides a way to fully create the engine and all interfaces
at once versus using :py:meth:`~create` and creating each individual
interface after the engine exists.
Example interfaces format::
... | [
"Create",
"a",
"Layer",
"3",
"Firewall",
"providing",
"all",
"of",
"the",
"interface",
"configuration",
".",
"This",
"method",
"provides",
"a",
"way",
"to",
"fully",
"create",
"the",
"engine",
"and",
"all",
"interfaces",
"at",
"once",
"versus",
"using",
":",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engines.py#L21-L105 |
gabstopper/smc-python | smc/core/engines.py | Layer3Firewall.create | def create(cls, name, mgmt_ip, mgmt_network,
mgmt_interface=0,
log_server_ref=None,
default_nat=False,
reverse_connection=False,
domain_server_address=None, zone_ref=None,
enable_antivirus=False, enable_gti=False,
l... | python | def create(cls, name, mgmt_ip, mgmt_network,
mgmt_interface=0,
log_server_ref=None,
default_nat=False,
reverse_connection=False,
domain_server_address=None, zone_ref=None,
enable_antivirus=False, enable_gti=False,
l... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"mgmt_ip",
",",
"mgmt_network",
",",
"mgmt_interface",
"=",
"0",
",",
"log_server_ref",
"=",
"None",
",",
"default_nat",
"=",
"False",
",",
"reverse_connection",
"=",
"False",
",",
"domain_server_address",
"=",
... | Create a single layer 3 firewall with management interface and DNS.
Provide the `interfaces` keyword argument if adding multiple additional interfaces.
Interfaces can be one of any valid interface for a layer 3 firewall. Unless the
interface type is specified, physical_interface is assumed.
... | [
"Create",
"a",
"single",
"layer",
"3",
"firewall",
"with",
"management",
"interface",
"and",
"DNS",
".",
"Provide",
"the",
"interfaces",
"keyword",
"argument",
"if",
"adding",
"multiple",
"additional",
"interfaces",
".",
"Interfaces",
"can",
"be",
"one",
"of",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engines.py#L108-L178 |
gabstopper/smc-python | smc/core/engines.py | Layer3Firewall.create_dynamic | def create_dynamic(cls, name, interface_id,
dynamic_index=1,
reverse_connection=True,
automatic_default_route=True,
domain_server_address=None,
loopback_ndi='127.0.0.1',
location_ref... | python | def create_dynamic(cls, name, interface_id,
dynamic_index=1,
reverse_connection=True,
automatic_default_route=True,
domain_server_address=None,
loopback_ndi='127.0.0.1',
location_ref... | [
"def",
"create_dynamic",
"(",
"cls",
",",
"name",
",",
"interface_id",
",",
"dynamic_index",
"=",
"1",
",",
"reverse_connection",
"=",
"True",
",",
"automatic_default_route",
"=",
"True",
",",
"domain_server_address",
"=",
"None",
",",
"loopback_ndi",
"=",
"'127... | Create a single layer 3 firewall with only a single DHCP interface. Useful
when creating virtualized FW's such as in Microsoft Azure.
:param str name: name of engine
:param str,int interface_id: interface ID used for dynamic interface and management
:param bool reverse_connectio... | [
"Create",
"a",
"single",
"layer",
"3",
"firewall",
"with",
"only",
"a",
"single",
"DHCP",
"interface",
".",
"Useful",
"when",
"creating",
"virtualized",
"FW",
"s",
"such",
"as",
"in",
"Microsoft",
"Azure",
".",
":",
"param",
"str",
"name",
":",
"name",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engines.py#L181-L243 |
gabstopper/smc-python | smc/core/engines.py | Layer2Firewall.create | def create(cls, name, mgmt_ip, mgmt_network,
mgmt_interface=0,
inline_interface='1-2',
logical_interface='default_eth',
log_server_ref=None,
domain_server_address=None, zone_ref=None,
enable_antivirus=False, enable_gti=False, comm... | python | def create(cls, name, mgmt_ip, mgmt_network,
mgmt_interface=0,
inline_interface='1-2',
logical_interface='default_eth',
log_server_ref=None,
domain_server_address=None, zone_ref=None,
enable_antivirus=False, enable_gti=False, comm... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"mgmt_ip",
",",
"mgmt_network",
",",
"mgmt_interface",
"=",
"0",
",",
"inline_interface",
"=",
"'1-2'",
",",
"logical_interface",
"=",
"'default_eth'",
",",
"log_server_ref",
"=",
"None",
",",
"domain_server_address... | Create a single layer 2 firewall with management interface and inline pair
:param str name: name of firewall engine
:param str mgmt_ip: ip address of management interface
:param str mgmt_network: management network in cidr format
:param int mgmt_interface: (optional) interface for manag... | [
"Create",
"a",
"single",
"layer",
"2",
"firewall",
"with",
"management",
"interface",
"and",
"inline",
"pair"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engines.py#L258-L317 |
gabstopper/smc-python | smc/core/engines.py | Layer3VirtualEngine.create | def create(cls, name, master_engine, virtual_resource,
interfaces, default_nat=False, outgoing_intf=0,
domain_server_address=None, enable_ospf=False,
ospf_profile=None, comment=None, **kw):
"""
Create a Layer3Virtual engine for a Master Engine. Provide interf... | python | def create(cls, name, master_engine, virtual_resource,
interfaces, default_nat=False, outgoing_intf=0,
domain_server_address=None, enable_ospf=False,
ospf_profile=None, comment=None, **kw):
"""
Create a Layer3Virtual engine for a Master Engine. Provide interf... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"master_engine",
",",
"virtual_resource",
",",
"interfaces",
",",
"default_nat",
"=",
"False",
",",
"outgoing_intf",
"=",
"0",
",",
"domain_server_address",
"=",
"None",
",",
"enable_ospf",
"=",
"False",
",",
"o... | Create a Layer3Virtual engine for a Master Engine. Provide interfaces
as a list of dict items specifying the interface details in format::
{'interface_id': 1, 'address': '1.1.1.1', 'network_value': '1.1.1.0/24',
'zone_ref': zone_by_name,href, 'comment': 'my interface comment'}
... | [
"Create",
"a",
"Layer3Virtual",
"engine",
"for",
"a",
"Master",
"Engine",
".",
"Provide",
"interfaces",
"as",
"a",
"list",
"of",
"dict",
"items",
"specifying",
"the",
"interface",
"details",
"in",
"format",
"::",
"{",
"interface_id",
":",
"1",
"address",
":"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engines.py#L406-L480 |
gabstopper/smc-python | smc/core/engines.py | FirewallCluster.create_bulk | def create_bulk(cls, name, interfaces=None, nodes=2, cluster_mode='balancing',
primary_mgt=None, backup_mgt=None, primary_heartbeat=None,
log_server_ref=None, domain_server_address=None, location_ref=None,
default_nat=False, enable_antivirus=False, enable_gti=False, comment=None,
... | python | def create_bulk(cls, name, interfaces=None, nodes=2, cluster_mode='balancing',
primary_mgt=None, backup_mgt=None, primary_heartbeat=None,
log_server_ref=None, domain_server_address=None, location_ref=None,
default_nat=False, enable_antivirus=False, enable_gti=False, comment=None,
... | [
"def",
"create_bulk",
"(",
"cls",
",",
"name",
",",
"interfaces",
"=",
"None",
",",
"nodes",
"=",
"2",
",",
"cluster_mode",
"=",
"'balancing'",
",",
"primary_mgt",
"=",
"None",
",",
"backup_mgt",
"=",
"None",
",",
"primary_heartbeat",
"=",
"None",
",",
"... | :param dict snmp: SNMP dict should have keys `snmp_agent` str defining name of SNMPAgent,
`snmp_interface` which is a list of interface IDs, and optionally `snmp_location` which
is a string with the SNMP location name. | [
":",
"param",
"dict",
"snmp",
":",
"SNMP",
"dict",
"should",
"have",
"keys",
"snmp_agent",
"str",
"defining",
"name",
"of",
"SNMPAgent",
"snmp_interface",
"which",
"is",
"a",
"list",
"of",
"interface",
"IDs",
"and",
"optionally",
"snmp_location",
"which",
"is"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engines.py#L495-L553 |
gabstopper/smc-python | smc/core/engines.py | FirewallCluster.create | def create(cls, name, cluster_virtual, network_value, macaddress,
interface_id, nodes, vlan_id=None, cluster_mode='balancing',
backup_mgt=None, primary_heartbeat=None, log_server_ref=None,
domain_server_address=None, location_ref=None, zone_ref=None,
default_n... | python | def create(cls, name, cluster_virtual, network_value, macaddress,
interface_id, nodes, vlan_id=None, cluster_mode='balancing',
backup_mgt=None, primary_heartbeat=None, log_server_ref=None,
domain_server_address=None, location_ref=None, zone_ref=None,
default_n... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"cluster_virtual",
",",
"network_value",
",",
"macaddress",
",",
"interface_id",
",",
"nodes",
",",
"vlan_id",
"=",
"None",
",",
"cluster_mode",
"=",
"'balancing'",
",",
"backup_mgt",
"=",
"None",
",",
"primary_... | Create a layer 3 firewall cluster with management interface and any number
of nodes. If providing keyword arguments to create additional interfaces,
use the same constructor arguments and pass an `interfaces` keyword argument.
The constructor defined interface will be assigned as the primary
... | [
"Create",
"a",
"layer",
"3",
"firewall",
"cluster",
"with",
"management",
"interface",
"and",
"any",
"number",
"of",
"nodes",
".",
"If",
"providing",
"keyword",
"arguments",
"to",
"create",
"additional",
"interfaces",
"use",
"the",
"same",
"constructor",
"argume... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engines.py#L557-L694 |
gabstopper/smc-python | smc/core/engines.py | MasterEngine.create | def create(cls, name, master_type, mgmt_ip, mgmt_network,
mgmt_interface=0,
log_server_ref=None, zone_ref=None,
domain_server_address=None, enable_gti=False,
enable_antivirus=False, comment=None):
"""
Create a Master Engine with management inte... | python | def create(cls, name, master_type, mgmt_ip, mgmt_network,
mgmt_interface=0,
log_server_ref=None, zone_ref=None,
domain_server_address=None, enable_gti=False,
enable_antivirus=False, comment=None):
"""
Create a Master Engine with management inte... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"master_type",
",",
"mgmt_ip",
",",
"mgmt_network",
",",
"mgmt_interface",
"=",
"0",
",",
"log_server_ref",
"=",
"None",
",",
"zone_ref",
"=",
"None",
",",
"domain_server_address",
"=",
"None",
",",
"enable_gti"... | Create a Master Engine with management interface
:param str name: name of master engine engine
:param str master_type: firewall|
:param str mgmt_ip: ip address for management interface
:param str mgmt_network: full netmask for management
:param str mgmt_interface: interface to u... | [
"Create",
"a",
"Master",
"Engine",
"with",
"management",
"interface"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engines.py#L705-L749 |
gabstopper/smc-python | smc/core/engines.py | MasterEngineCluster.create | def create(cls, name, master_type, macaddress, nodes, mgmt_interface=0,
log_server_ref=None, domain_server_address=None, enable_gti=False,
enable_antivirus=False, comment=None, **kw):
"""
Create Master Engine Cluster
:param str name: name of master engine engine
:param s... | python | def create(cls, name, master_type, macaddress, nodes, mgmt_interface=0,
log_server_ref=None, domain_server_address=None, enable_gti=False,
enable_antivirus=False, comment=None, **kw):
"""
Create Master Engine Cluster
:param str name: name of master engine engine
:param s... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"master_type",
",",
"macaddress",
",",
"nodes",
",",
"mgmt_interface",
"=",
"0",
",",
"log_server_ref",
"=",
"None",
",",
"domain_server_address",
"=",
"None",
",",
"enable_gti",
"=",
"False",
",",
"enable_antiv... | Create Master Engine Cluster
:param str name: name of master engine engine
:param str master_type: firewall|
:param str mgmt_ip: ip address for management interface
:param str mgmt_netmask: full netmask for management
:param str mgmt_interface: interface to use for mgmt (default... | [
"Create",
"Master",
"Engine",
"Cluster"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engines.py#L761-L821 |
gabstopper/smc-python | smc/__init__.py | set_stream_logger | def set_stream_logger(log_level=logging.DEBUG, format_string=None, logger_name='smc'):
"""
Stream logger convenience function to log to console
:param int log_level: A log level as specified in the `logging` module
:param str format_string: Optional format string as specified in the
`log... | python | def set_stream_logger(log_level=logging.DEBUG, format_string=None, logger_name='smc'):
"""
Stream logger convenience function to log to console
:param int log_level: A log level as specified in the `logging` module
:param str format_string: Optional format string as specified in the
`log... | [
"def",
"set_stream_logger",
"(",
"log_level",
"=",
"logging",
".",
"DEBUG",
",",
"format_string",
"=",
"None",
",",
"logger_name",
"=",
"'smc'",
")",
":",
"if",
"format_string",
"is",
"None",
":",
"format_string",
"=",
"LOG_FORMAT",
"logger",
"=",
"logging",
... | Stream logger convenience function to log to console
:param int log_level: A log level as specified in the `logging` module
:param str format_string: Optional format string as specified in the
`logging` module | [
"Stream",
"logger",
"convenience",
"function",
"to",
"log",
"to",
"console",
":",
"param",
"int",
"log_level",
":",
"A",
"log",
"level",
"as",
"specified",
"in",
"the",
"logging",
"module",
":",
"param",
"str",
"format_string",
":",
"Optional",
"format",
"st... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/__init__.py#L39-L60 |
gabstopper/smc-python | smc/__init__.py | set_file_logger | def set_file_logger(path, log_level=logging.DEBUG, format_string=None, logger_name='smc'):
"""
Convenience function to quickly configure any level of logging
to a file.
:param int log_level: A log level as specified in the `logging` module
:param str format_string: Optional format string as specifi... | python | def set_file_logger(path, log_level=logging.DEBUG, format_string=None, logger_name='smc'):
"""
Convenience function to quickly configure any level of logging
to a file.
:param int log_level: A log level as specified in the `logging` module
:param str format_string: Optional format string as specifi... | [
"def",
"set_file_logger",
"(",
"path",
",",
"log_level",
"=",
"logging",
".",
"DEBUG",
",",
"format_string",
"=",
"None",
",",
"logger_name",
"=",
"'smc'",
")",
":",
"if",
"format_string",
"is",
"None",
":",
"format_string",
"=",
"LOG_FORMAT",
"log",
"=",
... | Convenience function to quickly configure any level of logging
to a file.
:param int log_level: A log level as specified in the `logging` module
:param str format_string: Optional format string as specified in the
`logging` module
:param str path: Path to the log file. The file will be create... | [
"Convenience",
"function",
"to",
"quickly",
"configure",
"any",
"level",
"of",
"logging",
"to",
"a",
"file",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/__init__.py#L63-L88 |
gabstopper/smc-python | smc/administration/user_auth/users.py | ExternalLdapUserDomain.create | def create(cls, name, ldap_server, isdefault=False, auth_method=None, comment=None):
"""
Create an External LDAP user domain. These are used as containers for
retrieving user and groups from the configured LDAP server/s. If you
have multiple authentication methods supported for your LDAP... | python | def create(cls, name, ldap_server, isdefault=False, auth_method=None, comment=None):
"""
Create an External LDAP user domain. These are used as containers for
retrieving user and groups from the configured LDAP server/s. If you
have multiple authentication methods supported for your LDAP... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"ldap_server",
",",
"isdefault",
"=",
"False",
",",
"auth_method",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"return",
"ElementCreator",
"(",
"cls",
",",
"json",
"=",
"{",
"'name'",
":",
"name",
... | Create an External LDAP user domain. These are used as containers for
retrieving user and groups from the configured LDAP server/s. If you
have multiple authentication methods supported for your LDAP server,
or have none configured, you can set the `auth_method` to
a supported Authentica... | [
"Create",
"an",
"External",
"LDAP",
"user",
"domain",
".",
"These",
"are",
"used",
"as",
"containers",
"for",
"retrieving",
"user",
"and",
"groups",
"from",
"the",
"configured",
"LDAP",
"server",
"/",
"s",
".",
"If",
"you",
"have",
"multiple",
"authenticatio... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/user_auth/users.py#L117-L139 |
gabstopper/smc-python | smc/administration/user_auth/users.py | InternalUser.create | def create(cls, name, user_group=None, activation_date=None,
expiration_date=None, comment=None):
"""
Create an internal user.
Add a user example::
InternalUser.create(name='goog', comment='my comment')
:param str name: name of user that is disp... | python | def create(cls, name, user_group=None, activation_date=None,
expiration_date=None, comment=None):
"""
Create an internal user.
Add a user example::
InternalUser.create(name='goog', comment='my comment')
:param str name: name of user that is disp... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"user_group",
"=",
"None",
",",
"activation_date",
"=",
"None",
",",
"expiration_date",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'unique_id'",
":",... | Create an internal user.
Add a user example::
InternalUser.create(name='goog', comment='my comment')
:param str name: name of user that is displayed in SMC
:param list(str,InternalUserGroup) user_group: internal user groups
which to add this use... | [
"Create",
"an",
"internal",
"user",
".",
"Add",
"a",
"user",
"example",
"::",
"InternalUser",
".",
"create",
"(",
"name",
"=",
"goog",
"comment",
"=",
"my",
"comment",
")",
":",
"param",
"str",
"name",
":",
"name",
"of",
"user",
"that",
"is",
"displaye... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/user_auth/users.py#L186-L217 |
gabstopper/smc-python | smc/administration/user_auth/users.py | InternalUserGroup.create | def create(cls, name, member=None, comment=None):
"""
Create an internal group. An internal group will always be attached
to the default (and only) InternalUserDomain within the SMC.
Example of creating an internal user group::
InternalUserGroup.create(name=... | python | def create(cls, name, member=None, comment=None):
"""
Create an internal group. An internal group will always be attached
to the default (and only) InternalUserDomain within the SMC.
Example of creating an internal user group::
InternalUserGroup.create(name=... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"member",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'unique_id'",
":",
"'cn={},{}'",
".",
"format",
"(",
"name",
",",
"InternalUserDomain",
".",
"... | Create an internal group. An internal group will always be attached
to the default (and only) InternalUserDomain within the SMC.
Example of creating an internal user group::
InternalUserGroup.create(name='foogroup2', comment='mycomment')
:param str name: Name o... | [
"Create",
"an",
"internal",
"group",
".",
"An",
"internal",
"group",
"will",
"always",
"be",
"attached",
"to",
"the",
"default",
"(",
"and",
"only",
")",
"InternalUserDomain",
"within",
"the",
"SMC",
".",
"Example",
"of",
"creating",
"an",
"internal",
"user"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/user_auth/users.py#L238-L260 |
gabstopper/smc-python | smc/core/collection.py | get_all_loopbacks | def get_all_loopbacks(engine):
"""
Get all loopback interfaces for a given engine
"""
data = []
if 'fw_cluster' in engine.type:
for cvi in engine.data.get('loopback_cluster_virtual_interface', []):
data.append(
LoopbackClusterInterface(cvi, engine))
for node ... | python | def get_all_loopbacks(engine):
"""
Get all loopback interfaces for a given engine
"""
data = []
if 'fw_cluster' in engine.type:
for cvi in engine.data.get('loopback_cluster_virtual_interface', []):
data.append(
LoopbackClusterInterface(cvi, engine))
for node ... | [
"def",
"get_all_loopbacks",
"(",
"engine",
")",
":",
"data",
"=",
"[",
"]",
"if",
"'fw_cluster'",
"in",
"engine",
".",
"type",
":",
"for",
"cvi",
"in",
"engine",
".",
"data",
".",
"get",
"(",
"'loopback_cluster_virtual_interface'",
",",
"[",
"]",
")",
":... | Get all loopback interfaces for a given engine | [
"Get",
"all",
"loopback",
"interfaces",
"for",
"a",
"given",
"engine"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L107-L119 |
gabstopper/smc-python | smc/core/collection.py | LoopbackCollection.get | def get(self, address):
"""
Get a loopback address by it's address. Find all loopback addresses
by iterating at either the node level or the engine::
loopback = engine.loopback_interface.get('127.0.0.10')
:param str address: ip address of loopback
:r... | python | def get(self, address):
"""
Get a loopback address by it's address. Find all loopback addresses
by iterating at either the node level or the engine::
loopback = engine.loopback_interface.get('127.0.0.10')
:param str address: ip address of loopback
:r... | [
"def",
"get",
"(",
"self",
",",
"address",
")",
":",
"loopback",
"=",
"super",
"(",
"LoopbackCollection",
",",
"self",
")",
".",
"get",
"(",
"address",
"=",
"address",
")",
"if",
"loopback",
":",
"return",
"loopback",
"raise",
"InterfaceNotFound",
"(",
"... | Get a loopback address by it's address. Find all loopback addresses
by iterating at either the node level or the engine::
loopback = engine.loopback_interface.get('127.0.0.10')
:param str address: ip address of loopback
:raises InterfaceNotFound: invalid interface s... | [
"Get",
"a",
"loopback",
"address",
"by",
"it",
"s",
"address",
".",
"Find",
"all",
"loopback",
"addresses",
"by",
"iterating",
"at",
"either",
"the",
"node",
"level",
"or",
"the",
"engine",
"::",
"loopback",
"=",
"engine",
".",
"loopback_interface",
".",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L151-L165 |
gabstopper/smc-python | smc/core/collection.py | InterfaceCollection.update_or_create | def update_or_create(self, interface):
"""
Collections class update or create method that can be used as a
shortcut to updating or creating an interface. The interface must
first be defined and provided as the argument. The interface method
must have an `update_interface` method ... | python | def update_or_create(self, interface):
"""
Collections class update or create method that can be used as a
shortcut to updating or creating an interface. The interface must
first be defined and provided as the argument. The interface method
must have an `update_interface` method ... | [
"def",
"update_or_create",
"(",
"self",
",",
"interface",
")",
":",
"created",
",",
"modified",
"=",
"(",
"False",
",",
"False",
")",
"try",
":",
"intf",
"=",
"self",
".",
"_engine",
".",
"interface",
".",
"get",
"(",
"interface",
".",
"interface_id",
... | Collections class update or create method that can be used as a
shortcut to updating or creating an interface. The interface must
first be defined and provided as the argument. The interface method
must have an `update_interface` method which resolves differences and
adds as necessary.
... | [
"Collections",
"class",
"update",
"or",
"create",
"method",
"that",
"can",
"be",
"used",
"as",
"a",
"shortcut",
"to",
"updating",
"or",
"creating",
"an",
"interface",
".",
"The",
"interface",
"must",
"first",
"be",
"defined",
"and",
"provided",
"as",
"the",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L264-L292 |
gabstopper/smc-python | smc/core/collection.py | TunnelInterfaceCollection.add_cluster_virtual_interface | def add_cluster_virtual_interface(self, interface_id, cluster_virtual=None,
network_value=None, nodes=None, zone_ref=None, comment=None):
"""
Add a tunnel interface on a clustered engine. For tunnel interfaces
on a cluster, you can specify a CVI only, NDI interfaces, or both.... | python | def add_cluster_virtual_interface(self, interface_id, cluster_virtual=None,
network_value=None, nodes=None, zone_ref=None, comment=None):
"""
Add a tunnel interface on a clustered engine. For tunnel interfaces
on a cluster, you can specify a CVI only, NDI interfaces, or both.... | [
"def",
"add_cluster_virtual_interface",
"(",
"self",
",",
"interface_id",
",",
"cluster_virtual",
"=",
"None",
",",
"network_value",
"=",
"None",
",",
"nodes",
"=",
"None",
",",
"zone_ref",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"interfaces",
"=... | Add a tunnel interface on a clustered engine. For tunnel interfaces
on a cluster, you can specify a CVI only, NDI interfaces, or both.
This interface type is only supported on layer 3 firewall engines.
::
Add a tunnel CVI and NDI:
engine.tunnel_interface.add_cluster_vir... | [
"Add",
"a",
"tunnel",
"interface",
"on",
"a",
"clustered",
"engine",
".",
"For",
"tunnel",
"interfaces",
"on",
"a",
"cluster",
"you",
"can",
"specify",
"a",
"CVI",
"only",
"NDI",
"interfaces",
"or",
"both",
".",
"This",
"interface",
"type",
"is",
"only",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L303-L346 |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add | def add(self, interface_id, virtual_mapping=None,
virtual_resource_name=None, zone_ref=None, comment=None):
"""
Add single physical interface with interface_id. Use other methods
to fully add an interface configuration based on engine type.
Virtual mapping and resource are on... | python | def add(self, interface_id, virtual_mapping=None,
virtual_resource_name=None, zone_ref=None, comment=None):
"""
Add single physical interface with interface_id. Use other methods
to fully add an interface configuration based on engine type.
Virtual mapping and resource are on... | [
"def",
"add",
"(",
"self",
",",
"interface_id",
",",
"virtual_mapping",
"=",
"None",
",",
"virtual_resource_name",
"=",
"None",
",",
"zone_ref",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"interface",
"=",
"Layer3PhysicalInterface",
"(",
"engine",
"... | Add single physical interface with interface_id. Use other methods
to fully add an interface configuration based on engine type.
Virtual mapping and resource are only used in Virtual Engines.
:param str,int interface_id: interface identifier
:param int virtual_mapping: virtual firewall ... | [
"Add",
"single",
"physical",
"interface",
"with",
"interface_id",
".",
"Use",
"other",
"methods",
"to",
"fully",
"add",
"an",
"interface",
"configuration",
"based",
"on",
"engine",
"type",
".",
"Virtual",
"mapping",
"and",
"resource",
"are",
"only",
"used",
"i... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L377-L397 |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add_capture_interface | def add_capture_interface(self, interface_id, logical_interface_ref,
inspect_unspecified_vlans=True, zone_ref=None, comment=None):
"""
Add a capture interface. Capture interfaces are supported on
Layer 2 FW and IPS engines.
..note::
Capture interface are ... | python | def add_capture_interface(self, interface_id, logical_interface_ref,
inspect_unspecified_vlans=True, zone_ref=None, comment=None):
"""
Add a capture interface. Capture interfaces are supported on
Layer 2 FW and IPS engines.
..note::
Capture interface are ... | [
"def",
"add_capture_interface",
"(",
"self",
",",
"interface_id",
",",
"logical_interface_ref",
",",
"inspect_unspecified_vlans",
"=",
"True",
",",
"zone_ref",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"capture",
"=",
"{",
"'interface_id'",
":",
"inter... | Add a capture interface. Capture interfaces are supported on
Layer 2 FW and IPS engines.
..note::
Capture interface are supported on Layer 3 FW/clusters for NGFW engines
version >= 6.3 and SMC >= 6.3.
:param str,int interface_id: interface identifier
... | [
"Add",
"a",
"capture",
"interface",
".",
"Capture",
"interfaces",
"are",
"supported",
"on",
"Layer",
"2",
"FW",
"and",
"IPS",
"engines",
".",
"..",
"note",
"::",
"Capture",
"interface",
"are",
"supported",
"on",
"Layer",
"3",
"FW",
"/",
"clusters",
"for",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L399-L423 |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add_layer3_interface | def add_layer3_interface(self, interface_id, address, network_value,
zone_ref=None, comment=None, **kw):
"""
Add a layer 3 interface on a non-clustered engine.
For Layer 2 FW and IPS engines, this interface type represents
a layer 3 routed (node dedicated) in... | python | def add_layer3_interface(self, interface_id, address, network_value,
zone_ref=None, comment=None, **kw):
"""
Add a layer 3 interface on a non-clustered engine.
For Layer 2 FW and IPS engines, this interface type represents
a layer 3 routed (node dedicated) in... | [
"def",
"add_layer3_interface",
"(",
"self",
",",
"interface_id",
",",
"address",
",",
"network_value",
",",
"zone_ref",
"=",
"None",
",",
"comment",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"interfaces",
"=",
"{",
"'interface_id'",
":",
"interface_id",
... | Add a layer 3 interface on a non-clustered engine.
For Layer 2 FW and IPS engines, this interface type represents
a layer 3 routed (node dedicated) interface. For clusters, use the
cluster related methods such as :func:`add_cluster_virtual_interface`
:param str,int interface_id: interfa... | [
"Add",
"a",
"layer",
"3",
"interface",
"on",
"a",
"non",
"-",
"clustered",
"engine",
".",
"For",
"Layer",
"2",
"FW",
"and",
"IPS",
"engines",
"this",
"interface",
"type",
"represents",
"a",
"layer",
"3",
"routed",
"(",
"node",
"dedicated",
")",
"interfac... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L425-L465 |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add_layer3_vlan_interface | def add_layer3_vlan_interface(self, interface_id, vlan_id, address=None,
network_value=None, virtual_mapping=None, virtual_resource_name=None,
zone_ref=None, comment=None, **kw):
"""
Add a Layer 3 VLAN interface. Optionally specify an address and network if
assigning an IP to the... | python | def add_layer3_vlan_interface(self, interface_id, vlan_id, address=None,
network_value=None, virtual_mapping=None, virtual_resource_name=None,
zone_ref=None, comment=None, **kw):
"""
Add a Layer 3 VLAN interface. Optionally specify an address and network if
assigning an IP to the... | [
"def",
"add_layer3_vlan_interface",
"(",
"self",
",",
"interface_id",
",",
"vlan_id",
",",
"address",
"=",
"None",
",",
"network_value",
"=",
"None",
",",
"virtual_mapping",
"=",
"None",
",",
"virtual_resource_name",
"=",
"None",
",",
"zone_ref",
"=",
"None",
... | Add a Layer 3 VLAN interface. Optionally specify an address and network if
assigning an IP to the VLAN. This method will also assign an IP address to
an existing VLAN, or add an additional address to an existing VLAN. This
method may commonly be used on a Master Engine to create VLANs for virtua... | [
"Add",
"a",
"Layer",
"3",
"VLAN",
"interface",
".",
"Optionally",
"specify",
"an",
"address",
"and",
"network",
"if",
"assigning",
"an",
"IP",
"to",
"the",
"VLAN",
".",
"This",
"method",
"will",
"also",
"assign",
"an",
"IP",
"address",
"to",
"an",
"exist... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L467-L531 |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add_layer3_cluster_interface | def add_layer3_cluster_interface(self, interface_id, cluster_virtual=None,
network_value=None, macaddress=None, nodes=None, cvi_mode='packetdispatch',
zone_ref=None, comment=None, **kw):
"""
Add cluster virtual interface. A "CVI" interface is used as a VIP
address for clu... | python | def add_layer3_cluster_interface(self, interface_id, cluster_virtual=None,
network_value=None, macaddress=None, nodes=None, cvi_mode='packetdispatch',
zone_ref=None, comment=None, **kw):
"""
Add cluster virtual interface. A "CVI" interface is used as a VIP
address for clu... | [
"def",
"add_layer3_cluster_interface",
"(",
"self",
",",
"interface_id",
",",
"cluster_virtual",
"=",
"None",
",",
"network_value",
"=",
"None",
",",
"macaddress",
"=",
"None",
",",
"nodes",
"=",
"None",
",",
"cvi_mode",
"=",
"'packetdispatch'",
",",
"zone_ref",... | Add cluster virtual interface. A "CVI" interface is used as a VIP
address for clustered engines. Providing 'nodes' will create the
node specific interfaces. You can also add a cluster address with only
a CVI, or only NDI's.
Add CVI only::
engine.physic... | [
"Add",
"cluster",
"virtual",
"interface",
".",
"A",
"CVI",
"interface",
"is",
"used",
"as",
"a",
"VIP",
"address",
"for",
"clustered",
"engines",
".",
"Providing",
"nodes",
"will",
"create",
"the",
"node",
"specific",
"interfaces",
".",
"You",
"can",
"also",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L533-L599 |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add_layer3_vlan_cluster_interface | def add_layer3_vlan_cluster_interface(self, interface_id, vlan_id,
nodes=None, cluster_virtual=None, network_value=None, macaddress=None,
cvi_mode='packetdispatch', zone_ref=None, comment=None, **kw):
"""
Add IP addresses to VLANs on a firewall cluster. The minimum params
... | python | def add_layer3_vlan_cluster_interface(self, interface_id, vlan_id,
nodes=None, cluster_virtual=None, network_value=None, macaddress=None,
cvi_mode='packetdispatch', zone_ref=None, comment=None, **kw):
"""
Add IP addresses to VLANs on a firewall cluster. The minimum params
... | [
"def",
"add_layer3_vlan_cluster_interface",
"(",
"self",
",",
"interface_id",
",",
"vlan_id",
",",
"nodes",
"=",
"None",
",",
"cluster_virtual",
"=",
"None",
",",
"network_value",
"=",
"None",
",",
"macaddress",
"=",
"None",
",",
"cvi_mode",
"=",
"'packetdispatc... | Add IP addresses to VLANs on a firewall cluster. The minimum params
required are ``interface_id`` and ``vlan_id``.
To create a VLAN interface with a CVI, specify ``cluster_virtual``,
``cluster_mask`` and ``macaddress``.
To create a VLAN with only NDI, specify ``nodes`` parameter.
... | [
"Add",
"IP",
"addresses",
"to",
"VLANs",
"on",
"a",
"firewall",
"cluster",
".",
"The",
"minimum",
"params",
"required",
"are",
"interface_id",
"and",
"vlan_id",
".",
"To",
"create",
"a",
"VLAN",
"interface",
"with",
"a",
"CVI",
"specify",
"cluster_virtual",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L601-L665 |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add_inline_interface | def add_inline_interface(self, interface_id, second_interface_id,
logical_interface_ref=None, vlan_id=None, second_vlan_id=None, zone_ref=None,
second_zone_ref=None, failure_mode='normal', comment=None, **kw):
"""
Add an inline interface pair. This method is only for IPS or L2FW engine
... | python | def add_inline_interface(self, interface_id, second_interface_id,
logical_interface_ref=None, vlan_id=None, second_vlan_id=None, zone_ref=None,
second_zone_ref=None, failure_mode='normal', comment=None, **kw):
"""
Add an inline interface pair. This method is only for IPS or L2FW engine
... | [
"def",
"add_inline_interface",
"(",
"self",
",",
"interface_id",
",",
"second_interface_id",
",",
"logical_interface_ref",
"=",
"None",
",",
"vlan_id",
"=",
"None",
",",
"second_vlan_id",
"=",
"None",
",",
"zone_ref",
"=",
"None",
",",
"second_zone_ref",
"=",
"N... | Add an inline interface pair. This method is only for IPS or L2FW engine
types.
:param str interface_id: interface id of first interface
:param str second_interface_id: second interface pair id
:param str, href logical_interface_ref: logical interface by href or name
:pa... | [
"Add",
"an",
"inline",
"interface",
"pair",
".",
"This",
"method",
"is",
"only",
"for",
"IPS",
"or",
"L2FW",
"engine",
"types",
".",
":",
"param",
"str",
"interface_id",
":",
"interface",
"id",
"of",
"first",
"interface",
":",
"param",
"str",
"second_inter... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L667-L708 |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add_inline_ips_interface | def add_inline_ips_interface(self, interface_id, second_interface_id,
logical_interface_ref=None, vlan_id=None, failure_mode='normal',
zone_ref=None, second_zone_ref=None, comment=None):
"""
.. versionadded:: 0.5.6
Using an inline interface on a layer 3 FW requires SMC and en... | python | def add_inline_ips_interface(self, interface_id, second_interface_id,
logical_interface_ref=None, vlan_id=None, failure_mode='normal',
zone_ref=None, second_zone_ref=None, comment=None):
"""
.. versionadded:: 0.5.6
Using an inline interface on a layer 3 FW requires SMC and en... | [
"def",
"add_inline_ips_interface",
"(",
"self",
",",
"interface_id",
",",
"second_interface_id",
",",
"logical_interface_ref",
"=",
"None",
",",
"vlan_id",
"=",
"None",
",",
"failure_mode",
"=",
"'normal'",
",",
"zone_ref",
"=",
"None",
",",
"second_zone_ref",
"="... | .. versionadded:: 0.5.6
Using an inline interface on a layer 3 FW requires SMC and engine
version >= 6.3.
An inline IPS interface is a new interface type for Layer 3 NGFW
engines version >=6.3. Traffic passing an Inline IPS interface will
have a access rule d... | [
"..",
"versionadded",
"::",
"0",
".",
"5",
".",
"6",
"Using",
"an",
"inline",
"interface",
"on",
"a",
"layer",
"3",
"FW",
"requires",
"SMC",
"and",
"engine",
"version",
">",
"=",
"6",
".",
"3",
".",
"An",
"inline",
"IPS",
"interface",
"is",
"a",
"n... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L710-L752 |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add_inline_l2fw_interface | def add_inline_l2fw_interface(self, interface_id, second_interface_id,
logical_interface_ref=None, vlan_id=None, zone_ref=None,
second_zone_ref=None, comment=None):
"""
.. versionadded:: 0.5.6
Requires NGFW engine >=6.3 and layer 3 FW or cluster
An in... | python | def add_inline_l2fw_interface(self, interface_id, second_interface_id,
logical_interface_ref=None, vlan_id=None, zone_ref=None,
second_zone_ref=None, comment=None):
"""
.. versionadded:: 0.5.6
Requires NGFW engine >=6.3 and layer 3 FW or cluster
An in... | [
"def",
"add_inline_l2fw_interface",
"(",
"self",
",",
"interface_id",
",",
"second_interface_id",
",",
"logical_interface_ref",
"=",
"None",
",",
"vlan_id",
"=",
"None",
",",
"zone_ref",
"=",
"None",
",",
"second_zone_ref",
"=",
"None",
",",
"comment",
"=",
"Non... | .. versionadded:: 0.5.6
Requires NGFW engine >=6.3 and layer 3 FW or cluster
An inline L2 FW interface is a new interface type for Layer 3 NGFW
engines version >=6.3. Traffic passing an Inline Layer 2 Firewall
interface will have a default action in access rules of Discard.
... | [
"..",
"versionadded",
"::",
"0",
".",
"5",
".",
"6",
"Requires",
"NGFW",
"engine",
">",
"=",
"6",
".",
"3",
"and",
"layer",
"3",
"FW",
"or",
"cluster",
"An",
"inline",
"L2",
"FW",
"interface",
"is",
"a",
"new",
"interface",
"type",
"for",
"Layer",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L754-L792 |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add_dhcp_interface | def add_dhcp_interface(self, interface_id, dynamic_index, zone_ref=None,
vlan_id=None, comment=None):
"""
Add a DHCP interface on a single FW
:param int interface_id: interface id
:param int dynamic_index: index number for dhcp interface
:param bool primary_mgt: whet... | python | def add_dhcp_interface(self, interface_id, dynamic_index, zone_ref=None,
vlan_id=None, comment=None):
"""
Add a DHCP interface on a single FW
:param int interface_id: interface id
:param int dynamic_index: index number for dhcp interface
:param bool primary_mgt: whet... | [
"def",
"add_dhcp_interface",
"(",
"self",
",",
"interface_id",
",",
"dynamic_index",
",",
"zone_ref",
"=",
"None",
",",
"vlan_id",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"_interface",
"=",
"{",
"'interface_id'",
":",
"interface_id",
",",
"'inter... | Add a DHCP interface on a single FW
:param int interface_id: interface id
:param int dynamic_index: index number for dhcp interface
:param bool primary_mgt: whether to make this primary mgt
:param str zone_ref: zone reference, can be name, href or Zone
:raises EngineCommandFaile... | [
"Add",
"a",
"DHCP",
"interface",
"on",
"a",
"single",
"FW"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L794-L825 |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add_cluster_interface_on_master_engine | def add_cluster_interface_on_master_engine(self, interface_id, macaddress,
nodes, zone_ref=None, vlan_id=None, comment=None):
"""
Add a cluster address specific to a master engine. Master engine
clusters will not use "CVI" interfaces like normal layer 3 FW clusters,
instead e... | python | def add_cluster_interface_on_master_engine(self, interface_id, macaddress,
nodes, zone_ref=None, vlan_id=None, comment=None):
"""
Add a cluster address specific to a master engine. Master engine
clusters will not use "CVI" interfaces like normal layer 3 FW clusters,
instead e... | [
"def",
"add_cluster_interface_on_master_engine",
"(",
"self",
",",
"interface_id",
",",
"macaddress",
",",
"nodes",
",",
"zone_ref",
"=",
"None",
",",
"vlan_id",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"_interface",
"=",
"{",
"'interface_id'",
":",... | Add a cluster address specific to a master engine. Master engine
clusters will not use "CVI" interfaces like normal layer 3 FW clusters,
instead each node has a unique address and share a common macaddress.
Adding multiple addresses to an interface is not supported with this
method.
... | [
"Add",
"a",
"cluster",
"address",
"specific",
"to",
"a",
"master",
"engine",
".",
"Master",
"engine",
"clusters",
"will",
"not",
"use",
"CVI",
"interfaces",
"like",
"normal",
"layer",
"3",
"FW",
"clusters",
"instead",
"each",
"node",
"has",
"a",
"unique",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L827-L859 |
gabstopper/smc-python | smc/core/collection.py | VirtualPhysicalInterfaceCollection.add_tunnel_interface | def add_tunnel_interface(self, interface_id, address, network_value,
zone_ref=None, comment=None):
"""
Creates a tunnel interface for a virtual engine.
:param str,int interface_id: the tunnel id for the interface, used as nicid also
:param str address: ip ad... | python | def add_tunnel_interface(self, interface_id, address, network_value,
zone_ref=None, comment=None):
"""
Creates a tunnel interface for a virtual engine.
:param str,int interface_id: the tunnel id for the interface, used as nicid also
:param str address: ip ad... | [
"def",
"add_tunnel_interface",
"(",
"self",
",",
"interface_id",
",",
"address",
",",
"network_value",
",",
"zone_ref",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"interfaces",
"=",
"[",
"{",
"'nodes'",
":",
"[",
"{",
"'address'",
":",
"address",
... | Creates a tunnel interface for a virtual engine.
:param str,int interface_id: the tunnel id for the interface, used as nicid also
:param str address: ip address of interface
:param str network_value: network cidr for interface; format: 1.1.1.0/24
:param str zone_ref: zone reference for ... | [
"Creates",
"a",
"tunnel",
"interface",
"for",
"a",
"virtual",
"engine",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L903-L919 |
gabstopper/smc-python | smc/api/configloader.py | load_from_environ | def load_from_environ():
"""
Load the SMC URL, API KEY and optional SSL certificate from
the environment.
Fields are::
SMC_ADDRESS=http://1.1.1.1:8082
SMC_API_KEY=123abc
SMC_CLIENT_CERT=path/to/cert
SMC_TIMEOUT = 30 (seconds)
SMC_API_VERSION = 6.1 (optio... | python | def load_from_environ():
"""
Load the SMC URL, API KEY and optional SSL certificate from
the environment.
Fields are::
SMC_ADDRESS=http://1.1.1.1:8082
SMC_API_KEY=123abc
SMC_CLIENT_CERT=path/to/cert
SMC_TIMEOUT = 30 (seconds)
SMC_API_VERSION = 6.1 (optio... | [
"def",
"load_from_environ",
"(",
")",
":",
"try",
":",
"from",
"urllib",
".",
"parse",
"import",
"urlparse",
"except",
"ImportError",
":",
"from",
"urlparse",
"import",
"urlparse",
"smc_address",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'SMC_ADDRESS'",
"... | Load the SMC URL, API KEY and optional SSL certificate from
the environment.
Fields are::
SMC_ADDRESS=http://1.1.1.1:8082
SMC_API_KEY=123abc
SMC_CLIENT_CERT=path/to/cert
SMC_TIMEOUT = 30 (seconds)
SMC_API_VERSION = 6.1 (optional - uses latest by default)
... | [
"Load",
"the",
"SMC",
"URL",
"API",
"KEY",
"and",
"optional",
"SSL",
"certificate",
"from",
"the",
"environment",
".",
"Fields",
"are",
"::",
"SMC_ADDRESS",
"=",
"http",
":",
"//",
"1",
".",
"1",
".",
"1",
".",
"1",
":",
"8082",
"SMC_API_KEY",
"=",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/configloader.py#L15-L86 |
gabstopper/smc-python | smc/api/configloader.py | load_from_file | def load_from_file(alt_filepath=None):
""" Attempt to read the SMC configuration from a
dot(.) file in the users home directory. The order in
which credentials are parsed is:
- Passing credentials as parameters to the session login
- Shared credential file (~/.smcrc)
- Environment variables
... | python | def load_from_file(alt_filepath=None):
""" Attempt to read the SMC configuration from a
dot(.) file in the users home directory. The order in
which credentials are parsed is:
- Passing credentials as parameters to the session login
- Shared credential file (~/.smcrc)
- Environment variables
... | [
"def",
"load_from_file",
"(",
"alt_filepath",
"=",
"None",
")",
":",
"required",
"=",
"[",
"'smc_address'",
",",
"'smc_apikey'",
"]",
"bool_type",
"=",
"[",
"'smc_ssl'",
",",
"'verify_ssl'",
",",
"'retry_on_busy'",
"]",
"# boolean option flag",
"option_names",
"="... | Attempt to read the SMC configuration from a
dot(.) file in the users home directory. The order in
which credentials are parsed is:
- Passing credentials as parameters to the session login
- Shared credential file (~/.smcrc)
- Environment variables
:param alt_filepath: Specify a different file... | [
"Attempt",
"to",
"read",
"the",
"SMC",
"configuration",
"from",
"a",
"dot",
"(",
".",
")",
"file",
"in",
"the",
"users",
"home",
"directory",
".",
"The",
"order",
"in",
"which",
"credentials",
"are",
"parsed",
"is",
":"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/configloader.py#L89-L188 |
gabstopper/smc-python | smc/api/configloader.py | transform_login | def transform_login(config):
"""
Parse login data as dict. Called from load_from_file and
also can be used when collecting information from other
sources as well.
:param dict data: data representing the valid key/value pairs
from smcrc
:return: dict dict of settings that can be sent ... | python | def transform_login(config):
"""
Parse login data as dict. Called from load_from_file and
also can be used when collecting information from other
sources as well.
:param dict data: data representing the valid key/value pairs
from smcrc
:return: dict dict of settings that can be sent ... | [
"def",
"transform_login",
"(",
"config",
")",
":",
"verify",
"=",
"True",
"if",
"config",
".",
"pop",
"(",
"'smc_ssl'",
",",
"None",
")",
":",
"scheme",
"=",
"'https'",
"verify",
"=",
"config",
".",
"pop",
"(",
"'ssl_cert_file'",
",",
"None",
")",
"if"... | Parse login data as dict. Called from load_from_file and
also can be used when collecting information from other
sources as well.
:param dict data: data representing the valid key/value pairs
from smcrc
:return: dict dict of settings that can be sent into session.login | [
"Parse",
"login",
"data",
"as",
"dict",
".",
"Called",
"from",
"load_from_file",
"and",
"also",
"can",
"be",
"used",
"when",
"collecting",
"information",
"from",
"other",
"sources",
"as",
"well",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/configloader.py#L191-L249 |
gabstopper/smc-python | smc-monitoring/smc_monitoring/models/filters.py | TranslatedFilter.within_ipv4_network | def within_ipv4_network(self, field, values):
"""
This filter adds specified networks to a filter to check
for inclusion.
:param str field: name of field to filter on. Taken from 'Show Filter
Expression' within SMC.
:param list values: network definitions, in... | python | def within_ipv4_network(self, field, values):
"""
This filter adds specified networks to a filter to check
for inclusion.
:param str field: name of field to filter on. Taken from 'Show Filter
Expression' within SMC.
:param list values: network definitions, in... | [
"def",
"within_ipv4_network",
"(",
"self",
",",
"field",
",",
"values",
")",
":",
"v",
"=",
"[",
"'ipv4_net(\"%s\")'",
"%",
"net",
"for",
"net",
"in",
"values",
"]",
"self",
".",
"update_filter",
"(",
"'{} IN union({})'",
".",
"format",
"(",
"field",
",",
... | This filter adds specified networks to a filter to check
for inclusion.
:param str field: name of field to filter on. Taken from 'Show Filter
Expression' within SMC.
:param list values: network definitions, in cidr format, i.e: 1.1.1.0/24. | [
"This",
"filter",
"adds",
"specified",
"networks",
"to",
"a",
"filter",
"to",
"check",
"for",
"inclusion",
".",
":",
"param",
"str",
"field",
":",
"name",
"of",
"field",
"to",
"filter",
"on",
".",
"Taken",
"from",
"Show",
"Filter",
"Expression",
"within",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/filters.py#L264-L274 |
gabstopper/smc-python | smc-monitoring/smc_monitoring/models/filters.py | TranslatedFilter.within_ipv4_range | def within_ipv4_range(self, field, values):
"""
Add an IP range network filter for relevant address fields.
Range (between) filters allow only one range be provided.
:param str field: name of field to filter on. Taken from 'Show Filter
Expression' within SMC.
... | python | def within_ipv4_range(self, field, values):
"""
Add an IP range network filter for relevant address fields.
Range (between) filters allow only one range be provided.
:param str field: name of field to filter on. Taken from 'Show Filter
Expression' within SMC.
... | [
"def",
"within_ipv4_range",
"(",
"self",
",",
"field",
",",
"values",
")",
":",
"v",
"=",
"[",
"'ipv4(\"%s\")'",
"%",
"part",
"for",
"iprange",
"in",
"values",
"for",
"part",
"in",
"iprange",
".",
"split",
"(",
"'-'",
")",
"]",
"self",
".",
"update_fil... | Add an IP range network filter for relevant address fields.
Range (between) filters allow only one range be provided.
:param str field: name of field to filter on. Taken from 'Show Filter
Expression' within SMC.
:param list values: IP range values. Values would be a list of ... | [
"Add",
"an",
"IP",
"range",
"network",
"filter",
"for",
"relevant",
"address",
"fields",
".",
"Range",
"(",
"between",
")",
"filters",
"allow",
"only",
"one",
"range",
"be",
"provided",
".",
":",
"param",
"str",
"field",
":",
"name",
"of",
"field",
"to",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/filters.py#L276-L290 |
gabstopper/smc-python | smc-monitoring/smc_monitoring/models/filters.py | TranslatedFilter.exact_ipv4_match | def exact_ipv4_match(self, field, values):
"""
An exact IPv4 address match on relevant address fields.
:param str field: name of field to filter on. Taken from 'Show Filter
Expression' within SMC.
:param list values: value/s to add. If more than a single value is
... | python | def exact_ipv4_match(self, field, values):
"""
An exact IPv4 address match on relevant address fields.
:param str field: name of field to filter on. Taken from 'Show Filter
Expression' within SMC.
:param list values: value/s to add. If more than a single value is
... | [
"def",
"exact_ipv4_match",
"(",
"self",
",",
"field",
",",
"values",
")",
":",
"if",
"len",
"(",
"values",
")",
">",
"1",
":",
"v",
"=",
"[",
"'ipv4(\"%s\")'",
"%",
"ip",
"for",
"ip",
"in",
"values",
"]",
"value",
"=",
"'{} IN union({})'",
".",
"form... | An exact IPv4 address match on relevant address fields.
:param str field: name of field to filter on. Taken from 'Show Filter
Expression' within SMC.
:param list values: value/s to add. If more than a single value is
provided, the query is modified to use UNION vs. ==
... | [
"An",
"exact",
"IPv4",
"address",
"match",
"on",
"relevant",
"address",
"fields",
".",
":",
"param",
"str",
"field",
":",
"name",
"of",
"field",
"to",
"filter",
"on",
".",
"Taken",
"from",
"Show",
"Filter",
"Expression",
"within",
"SMC",
".",
":",
"param... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/filters.py#L292-L309 |
gabstopper/smc-python | smc/administration/updates.py | PackageMixin.download | def download(self, timeout=5, wait_for_finish=False):
"""
Download Package or Engine Update
:param int timeout: timeout between queries
:raises TaskRunFailed: failure during task status
:rtype: TaskOperationPoller
"""
return Task.execute(self, 'download', timeout... | python | def download(self, timeout=5, wait_for_finish=False):
"""
Download Package or Engine Update
:param int timeout: timeout between queries
:raises TaskRunFailed: failure during task status
:rtype: TaskOperationPoller
"""
return Task.execute(self, 'download', timeout... | [
"def",
"download",
"(",
"self",
",",
"timeout",
"=",
"5",
",",
"wait_for_finish",
"=",
"False",
")",
":",
"return",
"Task",
".",
"execute",
"(",
"self",
",",
"'download'",
",",
"timeout",
"=",
"timeout",
",",
"wait_for_finish",
"=",
"wait_for_finish",
")"
... | Download Package or Engine Update
:param int timeout: timeout between queries
:raises TaskRunFailed: failure during task status
:rtype: TaskOperationPoller | [
"Download",
"Package",
"or",
"Engine",
"Update"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/updates.py#L15-L24 |
gabstopper/smc-python | smc/administration/updates.py | PackageMixin.activate | def activate(self, resource=None, timeout=3, wait_for_finish=False):
"""
Activate this package on the SMC
:param list resource: node href's to activate on. Resource is only
required for software upgrades
:param int timeout: timeout between queries
:raises TaskRunF... | python | def activate(self, resource=None, timeout=3, wait_for_finish=False):
"""
Activate this package on the SMC
:param list resource: node href's to activate on. Resource is only
required for software upgrades
:param int timeout: timeout between queries
:raises TaskRunF... | [
"def",
"activate",
"(",
"self",
",",
"resource",
"=",
"None",
",",
"timeout",
"=",
"3",
",",
"wait_for_finish",
"=",
"False",
")",
":",
"return",
"Task",
".",
"execute",
"(",
"self",
",",
"'activate'",
",",
"json",
"=",
"{",
"'resource'",
":",
"resourc... | Activate this package on the SMC
:param list resource: node href's to activate on. Resource is only
required for software upgrades
:param int timeout: timeout between queries
:raises TaskRunFailed: failure during activation (downloading, etc)
:rtype: TaskOperationPoller | [
"Activate",
"this",
"package",
"on",
"the",
"SMC"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/updates.py#L26-L37 |
gabstopper/smc-python | smc/elements/profiles.py | DNSRule.all | def all(self):
"""
Return all entries
:rtype: list(dict)
"""
attribute = self._attr[0]
return self.profile.data.get(attribute, []) | python | def all(self):
"""
Return all entries
:rtype: list(dict)
"""
attribute = self._attr[0]
return self.profile.data.get(attribute, []) | [
"def",
"all",
"(",
"self",
")",
":",
"attribute",
"=",
"self",
".",
"_attr",
"[",
"0",
"]",
"return",
"self",
".",
"profile",
".",
"data",
".",
"get",
"(",
"attribute",
",",
"[",
"]",
")"
] | Return all entries
:rtype: list(dict) | [
"Return",
"all",
"entries",
":",
"rtype",
":",
"list",
"(",
"dict",
")"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/profiles.py#L66-L73 |
gabstopper/smc-python | smc/elements/profiles.py | SandboxService.create | def create(cls, name, sandbox_data_center, portal_username=None, comment=None):
"""
Create a Sandbox Service element
"""
json = {
'name': name,
'sandbox_data_center': element_resolver(sandbox_data_center),
'portal_username': portal_username if portal_u... | python | def create(cls, name, sandbox_data_center, portal_username=None, comment=None):
"""
Create a Sandbox Service element
"""
json = {
'name': name,
'sandbox_data_center': element_resolver(sandbox_data_center),
'portal_username': portal_username if portal_u... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"sandbox_data_center",
",",
"portal_username",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'sandbox_data_center'",
":",
"element_resolver",
"(",
"sandbox_da... | Create a Sandbox Service element | [
"Create",
"a",
"Sandbox",
"Service",
"element"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/profiles.py#L259-L268 |
gabstopper/smc-python | smc/api/session.py | available_api_versions | def available_api_versions(base_url, timeout=10, verify=True):
"""
Get all available API versions for this SMC
:return version numbers
:rtype: list
"""
try:
r = requests.get('%s/api' % base_url, timeout=timeout,
verify=verify) # no session required
... | python | def available_api_versions(base_url, timeout=10, verify=True):
"""
Get all available API versions for this SMC
:return version numbers
:rtype: list
"""
try:
r = requests.get('%s/api' % base_url, timeout=timeout,
verify=verify) # no session required
... | [
"def",
"available_api_versions",
"(",
"base_url",
",",
"timeout",
"=",
"10",
",",
"verify",
"=",
"True",
")",
":",
"try",
":",
"r",
"=",
"requests",
".",
"get",
"(",
"'%s/api'",
"%",
"base_url",
",",
"timeout",
"=",
"timeout",
",",
"verify",
"=",
"veri... | Get all available API versions for this SMC
:return version numbers
:rtype: list | [
"Get",
"all",
"available",
"API",
"versions",
"for",
"this",
"SMC"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L765-L788 |
gabstopper/smc-python | smc/api/session.py | get_api_version | def get_api_version(base_url, api_version=None, timeout=10, verify=True):
"""
Get the API version specified or resolve the latest version
:return api version
:rtype: float
"""
versions = available_api_versions(base_url, timeout, verify)
newest_version = max([float(i) for i in versions]... | python | def get_api_version(base_url, api_version=None, timeout=10, verify=True):
"""
Get the API version specified or resolve the latest version
:return api version
:rtype: float
"""
versions = available_api_versions(base_url, timeout, verify)
newest_version = max([float(i) for i in versions]... | [
"def",
"get_api_version",
"(",
"base_url",
",",
"api_version",
"=",
"None",
",",
"timeout",
"=",
"10",
",",
"verify",
"=",
"True",
")",
":",
"versions",
"=",
"available_api_versions",
"(",
"base_url",
",",
"timeout",
",",
"verify",
")",
"newest_version",
"="... | Get the API version specified or resolve the latest version
:return api version
:rtype: float | [
"Get",
"the",
"API",
"version",
"specified",
"or",
"resolve",
"the",
"latest",
"version"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L791-L807 |
gabstopper/smc-python | smc/api/session.py | SessionManager.create | def create(cls, sessions=None):
"""
A session manager will be mounted to the SMCRequest class through
this classmethod. If there is already an existing SessionManager,
that is returned instead.
:param list sessions: a list of Session objects
:rtype: SessionManage... | python | def create(cls, sessions=None):
"""
A session manager will be mounted to the SMCRequest class through
this classmethod. If there is already an existing SessionManager,
that is returned instead.
:param list sessions: a list of Session objects
:rtype: SessionManage... | [
"def",
"create",
"(",
"cls",
",",
"sessions",
"=",
"None",
")",
":",
"manager",
"=",
"getattr",
"(",
"SMCRequest",
",",
"'_session_manager'",
")",
"if",
"manager",
"is",
"not",
"None",
":",
"return",
"manager",
"manager",
"=",
"SessionManager",
"(",
"sessi... | A session manager will be mounted to the SMCRequest class through
this classmethod. If there is already an existing SessionManager,
that is returned instead.
:param list sessions: a list of Session objects
:rtype: SessionManager | [
"A",
"session",
"manager",
"will",
"be",
"mounted",
"to",
"the",
"SMCRequest",
"class",
"through",
"this",
"classmethod",
".",
"If",
"there",
"is",
"already",
"an",
"existing",
"SessionManager",
"that",
"is",
"returned",
"instead",
".",
":",
"param",
"list",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L90-L104 |
gabstopper/smc-python | smc/api/session.py | SessionManager.get_default_session | def get_default_session(self):
"""
The default session is nothing more than the first session added
into the session handler pool. This will likely change in the future
but for now each session identifies the domain and also manages
domain switching within a single session.
... | python | def get_default_session(self):
"""
The default session is nothing more than the first session added
into the session handler pool. This will likely change in the future
but for now each session identifies the domain and also manages
domain switching within a single session.
... | [
"def",
"get_default_session",
"(",
"self",
")",
":",
"if",
"self",
".",
"_sessions",
":",
"return",
"self",
".",
"get_session",
"(",
"next",
"(",
"iter",
"(",
"self",
".",
"_sessions",
")",
")",
")",
"return",
"self",
".",
"get_session",
"(",
")"
] | The default session is nothing more than the first session added
into the session handler pool. This will likely change in the future
but for now each session identifies the domain and also manages
domain switching within a single session.
:rtype: Session | [
"The",
"default",
"session",
"is",
"nothing",
"more",
"than",
"the",
"first",
"session",
"added",
"into",
"the",
"session",
"handler",
"pool",
".",
"This",
"will",
"likely",
"change",
"in",
"the",
"future",
"but",
"for",
"now",
"each",
"session",
"identifies... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L158-L169 |
gabstopper/smc-python | smc/api/session.py | SessionManager._register | def _register(self, session):
"""
Register a session
"""
if session.session_id:
self._sessions[session.name] = session | python | def _register(self, session):
"""
Register a session
"""
if session.session_id:
self._sessions[session.name] = session | [
"def",
"_register",
"(",
"self",
",",
"session",
")",
":",
"if",
"session",
".",
"session_id",
":",
"self",
".",
"_sessions",
"[",
"session",
".",
"name",
"]",
"=",
"session"
] | Register a session | [
"Register",
"a",
"session"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L195-L200 |
gabstopper/smc-python | smc/api/session.py | SessionManager._deregister | def _deregister(self, session):
"""
Deregister a session.
"""
if session in self:
self._sessions.pop(self._get_session_key(session), None) | python | def _deregister(self, session):
"""
Deregister a session.
"""
if session in self:
self._sessions.pop(self._get_session_key(session), None) | [
"def",
"_deregister",
"(",
"self",
",",
"session",
")",
":",
"if",
"session",
"in",
"self",
":",
"self",
".",
"_sessions",
".",
"pop",
"(",
"self",
".",
"_get_session_key",
"(",
"session",
")",
",",
"None",
")"
] | Deregister a session. | [
"Deregister",
"a",
"session",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L202-L207 |
gabstopper/smc-python | smc/api/session.py | Session.manager | def manager(self):
"""
Return the session manager for this session
:rtype: SessionManager
"""
manager = SMCRequest._session_manager if not self._manager \
else self._manager
if not manager:
raise SessionManagerNotFound('A session manager w... | python | def manager(self):
"""
Return the session manager for this session
:rtype: SessionManager
"""
manager = SMCRequest._session_manager if not self._manager \
else self._manager
if not manager:
raise SessionManagerNotFound('A session manager w... | [
"def",
"manager",
"(",
"self",
")",
":",
"manager",
"=",
"SMCRequest",
".",
"_session_manager",
"if",
"not",
"self",
".",
"_manager",
"else",
"self",
".",
"_manager",
"if",
"not",
"manager",
":",
"raise",
"SessionManagerNotFound",
"(",
"'A session manager was no... | Return the session manager for this session
:rtype: SessionManager | [
"Return",
"the",
"session",
"manager",
"for",
"this",
"session",
":",
"rtype",
":",
"SessionManager"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L239-L250 |
gabstopper/smc-python | smc/api/session.py | Session.session_id | def session_id(self):
"""
The session ID in header type format. Can be inserted into a
connection if necessary using::
{'Cookie': session.session_id}
:rtype: str
"""
return None if not self.session or 'JSESSIONID' not in \
self.se... | python | def session_id(self):
"""
The session ID in header type format. Can be inserted into a
connection if necessary using::
{'Cookie': session.session_id}
:rtype: str
"""
return None if not self.session or 'JSESSIONID' not in \
self.se... | [
"def",
"session_id",
"(",
"self",
")",
":",
"return",
"None",
"if",
"not",
"self",
".",
"session",
"or",
"'JSESSIONID'",
"not",
"in",
"self",
".",
"session",
".",
"cookies",
"else",
"'JSESSIONID={}'",
".",
"format",
"(",
"self",
".",
"session",
".",
"coo... | The session ID in header type format. Can be inserted into a
connection if necessary using::
{'Cookie': session.session_id}
:rtype: str | [
"The",
"session",
"ID",
"in",
"header",
"type",
"format",
".",
"Can",
"be",
"inserted",
"into",
"a",
"connection",
"if",
"necessary",
"using",
"::",
"{",
"Cookie",
":",
"session",
".",
"session_id",
"}",
":",
"rtype",
":",
"str"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L300-L311 |
gabstopper/smc-python | smc/api/session.py | Session.name | def name(self):
"""
Return the administrator name for this session. Can be None if
the session has not yet been established.
.. note:: The administrator name was introduced in SMC version
6.4. Previous versions will show the unique session
identifier for ... | python | def name(self):
"""
Return the administrator name for this session. Can be None if
the session has not yet been established.
.. note:: The administrator name was introduced in SMC version
6.4. Previous versions will show the unique session
identifier for ... | [
"def",
"name",
"(",
"self",
")",
":",
"if",
"self",
".",
"session",
":",
"# protect cached property from being set before session",
"try",
":",
"return",
"self",
".",
"current_user",
".",
"name",
"except",
"AttributeError",
":",
"# TODO: Catch ConnectionError? No sessio... | Return the administrator name for this session. Can be None if
the session has not yet been established.
.. note:: The administrator name was introduced in SMC version
6.4. Previous versions will show the unique session
identifier for this session.
:rtyp... | [
"Return",
"the",
"administrator",
"name",
"for",
"this",
"session",
".",
"Can",
"be",
"None",
"if",
"the",
"session",
"has",
"not",
"yet",
"been",
"established",
".",
"..",
"note",
"::",
"The",
"administrator",
"name",
"was",
"introduced",
"in",
"SMC",
"ve... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L363-L379 |
gabstopper/smc-python | smc/api/session.py | Session.current_user | def current_user(self):
"""
.. versionadded:: 0.6.0
Requires SMC version >= 6.4
Return the currently logged on API Client user element.
:raises UnsupportedEntryPoint: Current user is only supported with SMC
version >= 6.4
:rtype: Element
... | python | def current_user(self):
"""
.. versionadded:: 0.6.0
Requires SMC version >= 6.4
Return the currently logged on API Client user element.
:raises UnsupportedEntryPoint: Current user is only supported with SMC
version >= 6.4
:rtype: Element
... | [
"def",
"current_user",
"(",
"self",
")",
":",
"if",
"self",
".",
"session",
":",
"try",
":",
"response",
"=",
"self",
".",
"session",
".",
"get",
"(",
"self",
".",
"entry_points",
".",
"get",
"(",
"'current_user'",
")",
")",
"if",
"response",
".",
"s... | .. versionadded:: 0.6.0
Requires SMC version >= 6.4
Return the currently logged on API Client user element.
:raises UnsupportedEntryPoint: Current user is only supported with SMC
version >= 6.4
:rtype: Element | [
"..",
"versionadded",
"::",
"0",
".",
"6",
".",
"0",
"Requires",
"SMC",
"version",
">",
"=",
"6",
".",
"4",
"Return",
"the",
"currently",
"logged",
"on",
"API",
"Client",
"user",
"element",
".",
":",
"raises",
"UnsupportedEntryPoint",
":",
"Current",
"us... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L382-L402 |
gabstopper/smc-python | smc/api/session.py | Session.login | def login(self, url=None, api_key=None, login=None, pwd=None,
api_version=None, timeout=None, verify=True, alt_filepath=None,
domain=None, **kwargs):
"""
Login to SMC API and retrieve a valid session.
Sessions use a pool connection manager to provide dynamic scalability
... | python | def login(self, url=None, api_key=None, login=None, pwd=None,
api_version=None, timeout=None, verify=True, alt_filepath=None,
domain=None, **kwargs):
"""
Login to SMC API and retrieve a valid session.
Sessions use a pool connection manager to provide dynamic scalability
... | [
"def",
"login",
"(",
"self",
",",
"url",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"login",
"=",
"None",
",",
"pwd",
"=",
"None",
",",
"api_version",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"verify",
"=",
"True",
",",
"alt_filepath",
"=... | Login to SMC API and retrieve a valid session.
Sessions use a pool connection manager to provide dynamic scalability
during times of increased load. Each session is managed by a global
session manager making it possible to have more than one session per
interpreter.
An example l... | [
"Login",
"to",
"SMC",
"API",
"and",
"retrieve",
"a",
"valid",
"session",
".",
"Sessions",
"use",
"a",
"pool",
"connection",
"manager",
"to",
"provide",
"dynamic",
"scalability",
"during",
"times",
"of",
"increased",
"load",
".",
"Each",
"session",
"is",
"man... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L404-L516 |
gabstopper/smc-python | smc/api/session.py | Session._build_auth_request | def _build_auth_request(self, verify=False, **kwargs):
"""
Build the authentication request to SMC
"""
json = {
'domain': self.domain
}
credential = self.credential
params = {}
if credential.provider_name.startswith('lms'):
... | python | def _build_auth_request(self, verify=False, **kwargs):
"""
Build the authentication request to SMC
"""
json = {
'domain': self.domain
}
credential = self.credential
params = {}
if credential.provider_name.startswith('lms'):
... | [
"def",
"_build_auth_request",
"(",
"self",
",",
"verify",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"json",
"=",
"{",
"'domain'",
":",
"self",
".",
"domain",
"}",
"credential",
"=",
"self",
".",
"credential",
"params",
"=",
"{",
"}",
"if",
"cr... | Build the authentication request to SMC | [
"Build",
"the",
"authentication",
"request",
"to",
"SMC"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L521-L550 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.