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/api/session.py
Session._get_session
def _get_session(self, request): """ Authenticate the request dict :param dict request: request dict built from user input :raises SMCConnectionError: failure to connect :return: python requests session :rtype: requests.Session """ _session = requ...
python
def _get_session(self, request): """ Authenticate the request dict :param dict request: request dict built from user input :raises SMCConnectionError: failure to connect :return: python requests session :rtype: requests.Session """ _session = requ...
[ "def", "_get_session", "(", "self", ",", "request", ")", ":", "_session", "=", "requests", ".", "session", "(", ")", "# empty session", "response", "=", "_session", ".", "post", "(", "*", "*", "request", ")", "logger", ".", "info", "(", "'Using SMC API ver...
Authenticate the request dict :param dict request: request dict built from user input :raises SMCConnectionError: failure to connect :return: python requests session :rtype: requests.Session
[ "Authenticate", "the", "request", "dict", ":", "param", "dict", "request", ":", "request", "dict", "built", "from", "user", "input", ":", "raises", "SMCConnectionError", ":", "failure", "to", "connect", ":", "return", ":", "python", "requests", "session", ":",...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L552-L570
gabstopper/smc-python
smc/api/session.py
Session.logout
def logout(self): """ Logout session from SMC :return: None """ if not self.session: self.manager._deregister(self) return try: r = self.session.put(self.entry_points.get('logout')) if r.status_code == 204: ...
python
def logout(self): """ Logout session from SMC :return: None """ if not self.session: self.manager._deregister(self) return try: r = self.session.put(self.entry_points.get('logout')) if r.status_code == 204: ...
[ "def", "logout", "(", "self", ")", ":", "if", "not", "self", ".", "session", ":", "self", ".", "manager", ".", "_deregister", "(", "self", ")", "return", "try", ":", "r", "=", "self", ".", "session", ".", "put", "(", "self", ".", "entry_points", "....
Logout session from SMC :return: None
[ "Logout", "session", "from", "SMC", ":", "return", ":", "None" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L572-L603
gabstopper/smc-python
smc/api/session.py
Session.refresh
def refresh(self): """ Refresh session on 401. This is called automatically if your existing session times out and resends the operation/s which returned the error. :raises SMCConnectionError: Problem re-authenticating using existing api credentials """ ...
python
def refresh(self): """ Refresh session on 401. This is called automatically if your existing session times out and resends the operation/s which returned the error. :raises SMCConnectionError: Problem re-authenticating using existing api credentials """ ...
[ "def", "refresh", "(", "self", ")", ":", "if", "self", ".", "session", "and", "self", ".", "session_id", ":", "# Did session timeout?", "logger", ".", "info", "(", "'Session timed out, will try obtaining a new session using '", "'previously saved credential information.'", ...
Refresh session on 401. This is called automatically if your existing session times out and resends the operation/s which returned the error. :raises SMCConnectionError: Problem re-authenticating using existing api credentials
[ "Refresh", "session", "on", "401", ".", "This", "is", "called", "automatically", "if", "your", "existing", "session", "times", "out", "and", "resends", "the", "operation", "/", "s", "which", "returned", "the", "error", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L605-L619
gabstopper/smc-python
smc/api/session.py
Session.switch_domain
def switch_domain(self, domain): """ Switch from one domain to another. You can call session.login() with a domain key value to log directly into the domain of choice or alternatively switch from domain to domain. The user must have permissions to the domain or unauthorized will ...
python
def switch_domain(self, domain): """ Switch from one domain to another. You can call session.login() with a domain key value to log directly into the domain of choice or alternatively switch from domain to domain. The user must have permissions to the domain or unauthorized will ...
[ "def", "switch_domain", "(", "self", ",", "domain", ")", ":", "if", "self", ".", "domain", "!=", "domain", ":", "if", "self", "in", "self", ".", "manager", ":", "# Exit current domain", "self", ".", "logout", "(", ")", "logger", ".", "info", "(", "'Swi...
Switch from one domain to another. You can call session.login() with a domain key value to log directly into the domain of choice or alternatively switch from domain to domain. The user must have permissions to the domain or unauthorized will be returned. In addition, when switching domains, you...
[ "Switch", "from", "one", "domain", "to", "another", ".", "You", "can", "call", "session", ".", "login", "()", "with", "a", "domain", "key", "value", "to", "log", "directly", "into", "the", "domain", "of", "choice", "or", "alternatively", "switch", "from", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L621-L646
gabstopper/smc-python
smc/api/session.py
Session.set_retry_on_busy
def set_retry_on_busy(self, total=5, backoff_factor=0.1, status_forcelist=None, **kwargs): """ Mount a custom retry object on the current session that allows service level retries when the SMC might reply with a Service Unavailable (503) message. This can be possible in larger environmen...
python
def set_retry_on_busy(self, total=5, backoff_factor=0.1, status_forcelist=None, **kwargs): """ Mount a custom retry object on the current session that allows service level retries when the SMC might reply with a Service Unavailable (503) message. This can be possible in larger environmen...
[ "def", "set_retry_on_busy", "(", "self", ",", "total", "=", "5", ",", "backoff_factor", "=", "0.1", ",", "status_forcelist", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "session", ":", "from", "requests", ".", "adapters", "import",...
Mount a custom retry object on the current session that allows service level retries when the SMC might reply with a Service Unavailable (503) message. This can be possible in larger environments with higher database activity. You can all this on the existing session, or provide as a dict to the...
[ "Mount", "a", "custom", "retry", "object", "on", "the", "current", "session", "that", "allows", "service", "level", "retries", "when", "the", "SMC", "might", "reply", "with", "a", "Service", "Unavailable", "(", "503", ")", "message", ".", "This", "can", "b...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L648-L677
gabstopper/smc-python
smc/api/session.py
Session._get_log_schema
def _get_log_schema(self): """ Get the log schema for this SMC version. :return: dict """ if self.session and self.session_id: schema = '{}/{}/monitoring/log/schemas'.format(self.url, self.api_version) response = self.session.get( ...
python
def _get_log_schema(self): """ Get the log schema for this SMC version. :return: dict """ if self.session and self.session_id: schema = '{}/{}/monitoring/log/schemas'.format(self.url, self.api_version) response = self.session.get( ...
[ "def", "_get_log_schema", "(", "self", ")", ":", "if", "self", ".", "session", "and", "self", ".", "session_id", ":", "schema", "=", "'{}/{}/monitoring/log/schemas'", ".", "format", "(", "self", ".", "url", ",", "self", ".", "api_version", ")", "response", ...
Get the log schema for this SMC version. :return: dict
[ "Get", "the", "log", "schema", "for", "this", "SMC", "version", ".", ":", "return", ":", "dict" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L687-L702
gabstopper/smc-python
smc/api/session.py
Credential.has_credentials
def has_credentials(self): """ Does this session have valid credentials :rtype: bool """ return all([ getattr(self, '_%s' % field, None) is not None for field in self.CredentialMap.get(self.provider_name)])
python
def has_credentials(self): """ Does this session have valid credentials :rtype: bool """ return all([ getattr(self, '_%s' % field, None) is not None for field in self.CredentialMap.get(self.provider_name)])
[ "def", "has_credentials", "(", "self", ")", ":", "return", "all", "(", "[", "getattr", "(", "self", ",", "'_%s'", "%", "field", ",", "None", ")", "is", "not", "None", "for", "field", "in", "self", ".", "CredentialMap", ".", "get", "(", "self", ".", ...
Does this session have valid credentials :rtype: bool
[ "Does", "this", "session", "have", "valid", "credentials", ":", "rtype", ":", "bool" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L734-L742
gabstopper/smc-python
smc/policy/rule_elements.py
RuleElement.add
def add(self, data): """ Add a single entry to field. Entries can be added to a rule using the href of the element or by loading the element directly. Element should be of type :py:mod:`smc.elements.network`. After modifying rule, call :py:meth:`~.save`. Example...
python
def add(self, data): """ Add a single entry to field. Entries can be added to a rule using the href of the element or by loading the element directly. Element should be of type :py:mod:`smc.elements.network`. After modifying rule, call :py:meth:`~.save`. Example...
[ "def", "add", "(", "self", ",", "data", ")", ":", "if", "self", ".", "is_none", "or", "self", ".", "is_any", ":", "self", ".", "clear", "(", ")", "self", ".", "data", "[", "self", ".", "typeof", "]", "=", "[", "]", "try", ":", "self", ".", "g...
Add a single entry to field. Entries can be added to a rule using the href of the element or by loading the element directly. Element should be of type :py:mod:`smc.elements.network`. After modifying rule, call :py:meth:`~.save`. Example of adding entry by element:: ...
[ "Add", "a", "single", "entry", "to", "field", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_elements.py#L44-L74
gabstopper/smc-python
smc/policy/rule_elements.py
RuleElement.add_many
def add_many(self, data): """ Add multiple entries to field. Entries should be list format. Entries can be of types relavant to the field type. For example, for source and destination fields, elements may be of type :py:mod:`smc.elements.network` or be the elements direct href, ...
python
def add_many(self, data): """ Add multiple entries to field. Entries should be list format. Entries can be of types relavant to the field type. For example, for source and destination fields, elements may be of type :py:mod:`smc.elements.network` or be the elements direct href, ...
[ "def", "add_many", "(", "self", ",", "data", ")", ":", "assert", "isinstance", "(", "data", ",", "list", ")", ",", "\"Incorrect format. Expecting list.\"", "if", "self", ".", "is_none", "or", "self", ".", "is_any", ":", "self", ".", "clear", "(", ")", "s...
Add multiple entries to field. Entries should be list format. Entries can be of types relavant to the field type. For example, for source and destination fields, elements may be of type :py:mod:`smc.elements.network` or be the elements direct href, or a combination of both. Add...
[ "Add", "multiple", "entries", "to", "field", ".", "Entries", "should", "be", "list", "format", ".", "Entries", "can", "be", "of", "types", "relavant", "to", "the", "field", "type", ".", "For", "example", "for", "source", "and", "destination", "fields", "el...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_elements.py#L76-L104
gabstopper/smc-python
smc/policy/rule_elements.py
RuleElement.update_field
def update_field(self, elements): """ Update the field with a list of provided values but only if the values are different. Return a boolean indicating whether a change was made indicating whether `save` should be called. If the field is currently set to any or none, then no comp...
python
def update_field(self, elements): """ Update the field with a list of provided values but only if the values are different. Return a boolean indicating whether a change was made indicating whether `save` should be called. If the field is currently set to any or none, then no comp...
[ "def", "update_field", "(", "self", ",", "elements", ")", ":", "changed", "=", "False", "if", "isinstance", "(", "elements", ",", "list", ")", ":", "if", "self", ".", "is_any", "or", "self", ".", "is_none", ":", "self", ".", "add_many", "(", "elements"...
Update the field with a list of provided values but only if the values are different. Return a boolean indicating whether a change was made indicating whether `save` should be called. If the field is currently set to any or none, then no comparison is made and field is updated. ...
[ "Update", "the", "field", "with", "a", "list", "of", "provided", "values", "but", "only", "if", "the", "values", "are", "different", ".", "Return", "a", "boolean", "indicating", "whether", "a", "change", "was", "made", "indicating", "whether", "save", "shoul...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_elements.py#L121-L148
gabstopper/smc-python
smc/policy/rule_elements.py
RuleElement.all_as_href
def all_as_href(self): """ Return all elements without resolving to :class:`smc.elements.network` or :class:`smc.elements.service`. Just raw representation as href. :return: elements in href form :rtype: list """ if not self.is_any and not self.is_none: ...
python
def all_as_href(self): """ Return all elements without resolving to :class:`smc.elements.network` or :class:`smc.elements.service`. Just raw representation as href. :return: elements in href form :rtype: list """ if not self.is_any and not self.is_none: ...
[ "def", "all_as_href", "(", "self", ")", ":", "if", "not", "self", ".", "is_any", "and", "not", "self", ".", "is_none", ":", "return", "[", "element", "for", "element", "in", "self", ".", "get", "(", "self", ".", "typeof", ")", "]", "return", "[", "...
Return all elements without resolving to :class:`smc.elements.network` or :class:`smc.elements.service`. Just raw representation as href. :return: elements in href form :rtype: list
[ "Return", "all", "elements", "without", "resolving", "to", ":", "class", ":", "smc", ".", "elements", ".", "network", "or", ":", "class", ":", "smc", ".", "elements", ".", "service", ".", "Just", "raw", "representation", "as", "href", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_elements.py#L150-L160
gabstopper/smc-python
smc/policy/rule_elements.py
RuleElement.all
def all(self): """ Return all destinations for this rule. Elements returned are of the object type for the given element for further introspection. Search the fields in rule:: for sources in rule.sources.all(): print('My source: %s' % sources) ...
python
def all(self): """ Return all destinations for this rule. Elements returned are of the object type for the given element for further introspection. Search the fields in rule:: for sources in rule.sources.all(): print('My source: %s' % sources) ...
[ "def", "all", "(", "self", ")", ":", "if", "not", "self", ".", "is_any", "and", "not", "self", ".", "is_none", ":", "return", "[", "Element", ".", "from_href", "(", "href", ")", "for", "href", "in", "self", ".", "get", "(", "self", ".", "typeof", ...
Return all destinations for this rule. Elements returned are of the object type for the given element for further introspection. Search the fields in rule:: for sources in rule.sources.all(): print('My source: %s' % sources) :return: elements by resolved ob...
[ "Return", "all", "destinations", "for", "this", "rule", ".", "Elements", "returned", "are", "of", "the", "object", "type", "for", "the", "given", "element", "for", "further", "introspection", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_elements.py#L162-L179
gabstopper/smc-python
smc/policy/rule_elements.py
MatchExpression.create
def create(cls, name, user=None, network_element=None, domain_name=None, zone=None, executable=None): """ Create a match expression :param str name: name of match expression :param str user: name of user or user group :param Element network_element: valid network ...
python
def create(cls, name, user=None, network_element=None, domain_name=None, zone=None, executable=None): """ Create a match expression :param str name: name of match expression :param str user: name of user or user group :param Element network_element: valid network ...
[ "def", "create", "(", "cls", ",", "name", ",", "user", "=", "None", ",", "network_element", "=", "None", ",", "domain_name", "=", "None", ",", "zone", "=", "None", ",", "executable", "=", "None", ")", ":", "ref_list", "=", "[", "]", "if", "user", "...
Create a match expression :param str name: name of match expression :param str user: name of user or user group :param Element network_element: valid network element type, i.e. host, network, etc :param DomainName domain_name: domain name network element :param Zone zone: zone t...
[ "Create", "a", "match", "expression" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_elements.py#L836-L866
gabstopper/smc-python
smc/core/addon.py
AntiVirus.http_proxy
def http_proxy(self, proxy, proxy_port, user=None, password=None): """ .. versionadded:: 0.5.7 Requires SMC and engine version >= 6.4 Set http proxy settings for Antivirus updates. :param str proxy: proxy IP address :param str,int proxy_port: proxy p...
python
def http_proxy(self, proxy, proxy_port, user=None, password=None): """ .. versionadded:: 0.5.7 Requires SMC and engine version >= 6.4 Set http proxy settings for Antivirus updates. :param str proxy: proxy IP address :param str,int proxy_port: proxy p...
[ "def", "http_proxy", "(", "self", ",", "proxy", ",", "proxy_port", ",", "user", "=", "None", ",", "password", "=", "None", ")", ":", "self", ".", "update", "(", "antivirus_http_proxy", "=", "proxy", ",", "antivirus_proxy_port", "=", "proxy_port", ",", "ant...
.. versionadded:: 0.5.7 Requires SMC and engine version >= 6.4 Set http proxy settings for Antivirus updates. :param str proxy: proxy IP address :param str,int proxy_port: proxy port :param str user: optional user for authentication
[ "..", "versionadded", "::", "0", ".", "5", ".", "7", "Requires", "SMC", "and", "engine", "version", ">", "=", "6", ".", "4", "Set", "http", "proxy", "settings", "for", "Antivirus", "updates", ".", ":", "param", "str", "proxy", ":", "proxy", "IP", "ad...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/addon.py#L100-L116
gabstopper/smc-python
smc/core/addon.py
AntiVirus.enable
def enable(self): """ Enable antivirus on the engine """ self.update(antivirus_enabled=True, virus_mirror='update.nai.com/Products/CommonUpdater' if \ not self.get('virus_mirror') else self.virus_mirror, antivirus_update_tim...
python
def enable(self): """ Enable antivirus on the engine """ self.update(antivirus_enabled=True, virus_mirror='update.nai.com/Products/CommonUpdater' if \ not self.get('virus_mirror') else self.virus_mirror, antivirus_update_tim...
[ "def", "enable", "(", "self", ")", ":", "self", ".", "update", "(", "antivirus_enabled", "=", "True", ",", "virus_mirror", "=", "'update.nai.com/Products/CommonUpdater'", "if", "not", "self", ".", "get", "(", "'virus_mirror'", ")", "else", "self", ".", "virus_...
Enable antivirus on the engine
[ "Enable", "antivirus", "on", "the", "engine" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/addon.py#L133-L141
gabstopper/smc-python
smc/core/addon.py
UrlFiltering.enable
def enable(self, http_proxy=None): """ Enable URL Filtering on the engine. If proxy servers are needed, provide a list of HTTPProxy elements. :param http_proxy: list of proxies for GTI connections :type http_proxy: list(str,HttpProxy) """ self.update(ts_e...
python
def enable(self, http_proxy=None): """ Enable URL Filtering on the engine. If proxy servers are needed, provide a list of HTTPProxy elements. :param http_proxy: list of proxies for GTI connections :type http_proxy: list(str,HttpProxy) """ self.update(ts_e...
[ "def", "enable", "(", "self", ",", "http_proxy", "=", "None", ")", ":", "self", ".", "update", "(", "ts_enabled", "=", "True", ",", "http_proxy", "=", "get_proxy", "(", "http_proxy", ")", ")" ]
Enable URL Filtering on the engine. If proxy servers are needed, provide a list of HTTPProxy elements. :param http_proxy: list of proxies for GTI connections :type http_proxy: list(str,HttpProxy)
[ "Enable", "URL", "Filtering", "on", "the", "engine", ".", "If", "proxy", "servers", "are", "needed", "provide", "a", "list", "of", "HTTPProxy", "elements", ".", ":", "param", "http_proxy", ":", "list", "of", "proxies", "for", "GTI", "connections", ":", "ty...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/addon.py#L283-L291
gabstopper/smc-python
smc/core/addon.py
Sandbox.status
def status(self): """ Status of sandbox on this engine :rtype: bool """ if 'sandbox_type' in self.engine.data: if self.engine.sandbox_type == 'none': return False return True return False
python
def status(self): """ Status of sandbox on this engine :rtype: bool """ if 'sandbox_type' in self.engine.data: if self.engine.sandbox_type == 'none': return False return True return False
[ "def", "status", "(", "self", ")", ":", "if", "'sandbox_type'", "in", "self", ".", "engine", ".", "data", ":", "if", "self", ".", "engine", ".", "sandbox_type", "==", "'none'", ":", "return", "False", "return", "True", "return", "False" ]
Status of sandbox on this engine :rtype: bool
[ "Status", "of", "sandbox", "on", "this", "engine", ":", "rtype", ":", "bool" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/addon.py#L336-L346
gabstopper/smc-python
smc/core/addon.py
Sandbox.disable
def disable(self): """ Disable the sandbox on this engine. """ self.engine.data.update(sandbox_type='none') self.pop('cloud_sandbox_settings', None) #pre-6.3 self.pop('sandbox_settings', None)
python
def disable(self): """ Disable the sandbox on this engine. """ self.engine.data.update(sandbox_type='none') self.pop('cloud_sandbox_settings', None) #pre-6.3 self.pop('sandbox_settings', None)
[ "def", "disable", "(", "self", ")", ":", "self", ".", "engine", ".", "data", ".", "update", "(", "sandbox_type", "=", "'none'", ")", "self", ".", "pop", "(", "'cloud_sandbox_settings'", ",", "None", ")", "#pre-6.3", "self", ".", "pop", "(", "'sandbox_set...
Disable the sandbox on this engine.
[ "Disable", "the", "sandbox", "on", "this", "engine", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/addon.py#L348-L354
gabstopper/smc-python
smc/core/addon.py
Sandbox.enable
def enable(self, license_key, license_token, sandbox_type='cloud_sandbox', service='Automatic', http_proxy=None, sandbox_data_center='Automatic'): """ Enable sandbox on this engine. Provide a valid license key and license token obtained from your engine licensing. ...
python
def enable(self, license_key, license_token, sandbox_type='cloud_sandbox', service='Automatic', http_proxy=None, sandbox_data_center='Automatic'): """ Enable sandbox on this engine. Provide a valid license key and license token obtained from your engine licensing. ...
[ "def", "enable", "(", "self", ",", "license_key", ",", "license_token", ",", "sandbox_type", "=", "'cloud_sandbox'", ",", "service", "=", "'Automatic'", ",", "http_proxy", "=", "None", ",", "sandbox_data_center", "=", "'Automatic'", ")", ":", "service", "=", "...
Enable sandbox on this engine. Provide a valid license key and license token obtained from your engine licensing. Requires SMC version >= 6.3. .. note:: Cloud sandbox is a feature that requires an engine license. :param str license_key: license key for specific engine :...
[ "Enable", "sandbox", "on", "this", "engine", ".", "Provide", "a", "valid", "license", "key", "and", "license", "token", "obtained", "from", "your", "engine", "licensing", ".", "Requires", "SMC", "version", ">", "=", "6", ".", "3", ".", "..", "note", "::"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/addon.py#L356-L386
gabstopper/smc-python
smc/core/addon.py
TLSInspection.add_tls_credential
def add_tls_credential(self, credentials): """ Add a list of TLSServerCredential to this engine. TLSServerCredentials can be in element form or can also be the href for the element. :param credentials: list of pre-created TLSServerCredentials :type creden...
python
def add_tls_credential(self, credentials): """ Add a list of TLSServerCredential to this engine. TLSServerCredentials can be in element form or can also be the href for the element. :param credentials: list of pre-created TLSServerCredentials :type creden...
[ "def", "add_tls_credential", "(", "self", ",", "credentials", ")", ":", "for", "cred", "in", "credentials", ":", "href", "=", "element_resolver", "(", "cred", ")", "if", "href", "not", "in", "self", ".", "engine", ".", "server_credential", ":", "self", "."...
Add a list of TLSServerCredential to this engine. TLSServerCredentials can be in element form or can also be the href for the element. :param credentials: list of pre-created TLSServerCredentials :type credentials: list(str,TLSServerCredential) :return: None
[ "Add", "a", "list", "of", "TLSServerCredential", "to", "this", "engine", ".", "TLSServerCredentials", "can", "be", "in", "element", "form", "or", "can", "also", "be", "the", "href", "for", "the", "element", ".", ":", "param", "credentials", ":", "list", "o...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/addon.py#L426-L439
gabstopper/smc-python
smc/core/addon.py
TLSInspection.remove_tls_credential
def remove_tls_credential(self, credentials): """ Remove a list of TLSServerCredentials on this engine. :param credentials: list of credentials to remove from the engine :type credentials: list(str,TLSServerCredential) :return: None """ fo...
python
def remove_tls_credential(self, credentials): """ Remove a list of TLSServerCredentials on this engine. :param credentials: list of credentials to remove from the engine :type credentials: list(str,TLSServerCredential) :return: None """ fo...
[ "def", "remove_tls_credential", "(", "self", ",", "credentials", ")", ":", "for", "cred", "in", "credentials", ":", "href", "=", "element_resolver", "(", "cred", ")", "if", "href", "in", "self", ".", "engine", ".", "server_credential", ":", "self", ".", "e...
Remove a list of TLSServerCredentials on this engine. :param credentials: list of credentials to remove from the engine :type credentials: list(str,TLSServerCredential) :return: None
[ "Remove", "a", "list", "of", "TLSServerCredentials", "on", "this", "engine", ".", ":", "param", "credentials", ":", "list", "of", "credentials", "to", "remove", "from", "the", "engine", ":", "type", "credentials", ":", "list", "(", "str", "TLSServerCredential"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/addon.py#L441-L453
gabstopper/smc-python
smc/administration/scheduled_tasks.py
policy_validation_settings
def policy_validation_settings(**kwargs): """ Set policy validation settings. This is used when policy based tasks are created and `validate_policy` is set to True. The following kwargs can be overridden in the create constructor. :param bool configuration_validation_for_alert_chain: default Fa...
python
def policy_validation_settings(**kwargs): """ Set policy validation settings. This is used when policy based tasks are created and `validate_policy` is set to True. The following kwargs can be overridden in the create constructor. :param bool configuration_validation_for_alert_chain: default Fa...
[ "def", "policy_validation_settings", "(", "*", "*", "kwargs", ")", ":", "validation_settings", "=", "{", "'configuration_validation_for_alert_chain'", ":", "False", ",", "'duplicate_rule_check_settings'", ":", "False", ",", "'empty_rule_check_settings'", ":", "True", ",",...
Set policy validation settings. This is used when policy based tasks are created and `validate_policy` is set to True. The following kwargs can be overridden in the create constructor. :param bool configuration_validation_for_alert_chain: default False :param bool duplicate_rule_check_settings: def...
[ "Set", "policy", "validation", "settings", ".", "This", "is", "used", "when", "policy", "based", "tasks", "are", "created", "and", "validate_policy", "is", "set", "to", "True", ".", "The", "following", "kwargs", "can", "be", "overridden", "in", "the", "creat...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/scheduled_tasks.py#L100-L133
gabstopper/smc-python
smc/administration/scheduled_tasks.py
log_target_types
def log_target_types(all_logs=False, **kwargs): """ Log targets for log tasks. A log target defines the log types that will be affected by the operation. For example, when creating a DeleteLogTask, you can specify which log types are deleted. :param bool for_alert_event_log: alert events traces...
python
def log_target_types(all_logs=False, **kwargs): """ Log targets for log tasks. A log target defines the log types that will be affected by the operation. For example, when creating a DeleteLogTask, you can specify which log types are deleted. :param bool for_alert_event_log: alert events traces...
[ "def", "log_target_types", "(", "all_logs", "=", "False", ",", "*", "*", "kwargs", ")", ":", "log_types", "=", "{", "'for_alert_event_log'", ":", "False", ",", "'for_alert_log'", ":", "False", ",", "'for_audit_log'", ":", "False", ",", "'for_fw_log'", ":", "...
Log targets for log tasks. A log target defines the log types that will be affected by the operation. For example, when creating a DeleteLogTask, you can specify which log types are deleted. :param bool for_alert_event_log: alert events traces (default: False) :param bool for_alert_log: alerts (def...
[ "Log", "targets", "for", "log", "tasks", ".", "A", "log", "target", "defines", "the", "log", "types", "that", "will", "be", "affected", "by", "the", "operation", ".", "For", "example", "when", "creating", "a", "DeleteLogTask", "you", "can", "specify", "whi...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/scheduled_tasks.py#L136-L168
gabstopper/smc-python
smc/administration/scheduled_tasks.py
TaskSchedule.activate
def activate(self): """ If a task is suspended, this will re-activate the task. Usually it's best to check for activated before running this:: task = RefreshPolicyTask('mytask') for scheduler in task.task_schedule: if scheduler.activated: ...
python
def activate(self): """ If a task is suspended, this will re-activate the task. Usually it's best to check for activated before running this:: task = RefreshPolicyTask('mytask') for scheduler in task.task_schedule: if scheduler.activated: ...
[ "def", "activate", "(", "self", ")", ":", "if", "'activate'", "in", "self", ".", "data", ".", "links", ":", "self", ".", "make_request", "(", "ActionCommandFailed", ",", "method", "=", "'update'", ",", "etag", "=", "self", ".", "etag", ",", "resource", ...
If a task is suspended, this will re-activate the task. Usually it's best to check for activated before running this:: task = RefreshPolicyTask('mytask') for scheduler in task.task_schedule: if scheduler.activated: scheduler.suspend() ...
[ "If", "a", "task", "is", "suspended", "this", "will", "re", "-", "activate", "the", "task", ".", "Usually", "it", "s", "best", "to", "check", "for", "activated", "before", "running", "this", "::", "task", "=", "RefreshPolicyTask", "(", "mytask", ")", "fo...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/scheduled_tasks.py#L203-L225
gabstopper/smc-python
smc/administration/scheduled_tasks.py
ScheduledTaskMixin.add_schedule
def add_schedule(self, name, activation_date, day_period='one_time', final_action='ALERT_FAILURE', activated=True, minute_period='one_time', day_mask=None, repeat_until_date=None, comment=None): """ Add a schedule to an existing task. ...
python
def add_schedule(self, name, activation_date, day_period='one_time', final_action='ALERT_FAILURE', activated=True, minute_period='one_time', day_mask=None, repeat_until_date=None, comment=None): """ Add a schedule to an existing task. ...
[ "def", "add_schedule", "(", "self", ",", "name", ",", "activation_date", ",", "day_period", "=", "'one_time'", ",", "final_action", "=", "'ALERT_FAILURE'", ",", "activated", "=", "True", ",", "minute_period", "=", "'one_time'", ",", "day_mask", "=", "None", ",...
Add a schedule to an existing task. :param str name: name for this schedule :param int activation_date: when to start this task. Activation date should be a UTC time represented in milliseconds. :param str day_period: when this task should be run. Valid options: ...
[ "Add", "a", "schedule", "to", "an", "existing", "task", ".", ":", "param", "str", "name", ":", "name", "for", "this", "schedule", ":", "param", "int", "activation_date", ":", "when", "to", "start", "this", "task", ".", "Activation", "date", "should", "be...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/scheduled_tasks.py#L279-L330
gabstopper/smc-python
smc/administration/scheduled_tasks.py
RefreshPolicyTask.create
def create(cls, name, engines, comment=None, validate_policy=True, **kwargs): """ Create a refresh policy task associated with specific engines. A policy refresh task does not require a policy be specified. The policy used in the refresh will be the policy already ...
python
def create(cls, name, engines, comment=None, validate_policy=True, **kwargs): """ Create a refresh policy task associated with specific engines. A policy refresh task does not require a policy be specified. The policy used in the refresh will be the policy already ...
[ "def", "create", "(", "cls", ",", "name", ",", "engines", ",", "comment", "=", "None", ",", "validate_policy", "=", "True", ",", "*", "*", "kwargs", ")", ":", "json", "=", "{", "'resources'", ":", "[", "engine", ".", "href", "for", "engine", "in", ...
Create a refresh policy task associated with specific engines. A policy refresh task does not require a policy be specified. The policy used in the refresh will be the policy already assigned to the engine. :param str name: name of this task :param engines: list of Engin...
[ "Create", "a", "refresh", "policy", "task", "associated", "with", "specific", "engines", ".", "A", "policy", "refresh", "task", "does", "not", "require", "a", "policy", "be", "specified", ".", "The", "policy", "used", "in", "the", "refresh", "will", "be", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/scheduled_tasks.py#L359-L390
gabstopper/smc-python
smc/administration/scheduled_tasks.py
ValidatePolicyTask.create
def create(cls, name, engines, policy=None, comment=None, **kwargs): """ Create a new validate policy task. If a policy is not specified, the engines existing policy will be validated. Override default validation settings as kwargs. :param str name: name of task ...
python
def create(cls, name, engines, policy=None, comment=None, **kwargs): """ Create a new validate policy task. If a policy is not specified, the engines existing policy will be validated. Override default validation settings as kwargs. :param str name: name of task ...
[ "def", "create", "(", "cls", ",", "name", ",", "engines", ",", "policy", "=", "None", ",", "comment", "=", "None", ",", "*", "*", "kwargs", ")", ":", "json", "=", "{", "'name'", ":", "name", ",", "'resources'", ":", "[", "eng", ".", "href", "for"...
Create a new validate policy task. If a policy is not specified, the engines existing policy will be validated. Override default validation settings as kwargs. :param str name: name of task :param engines: list of engines to validate :type engines: list(Engine) :...
[ "Create", "a", "new", "validate", "policy", "task", ".", "If", "a", "policy", "is", "not", "specified", "the", "engines", "existing", "policy", "will", "be", "validated", ".", "Override", "default", "validation", "settings", "as", "kwargs", ".", ":", "param"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/scheduled_tasks.py#L456-L483
gabstopper/smc-python
smc/administration/scheduled_tasks.py
RefreshMasterEnginePolicyTask.create
def create(cls, name, master_engines, comment=None): """ Create a refresh task for master engines. :param str name: name of task :param master_engines: list of master engines for this task :type master_engines: list(MasterEngine) :param str comment: optional com...
python
def create(cls, name, master_engines, comment=None): """ Create a refresh task for master engines. :param str name: name of task :param master_engines: list of master engines for this task :type master_engines: list(MasterEngine) :param str comment: optional com...
[ "def", "create", "(", "cls", ",", "name", ",", "master_engines", ",", "comment", "=", "None", ")", ":", "json", "=", "{", "'name'", ":", "name", ",", "'comment'", ":", "comment", ",", "'resources'", ":", "[", "eng", ".", "href", "for", "eng", "in", ...
Create a refresh task for master engines. :param str name: name of task :param master_engines: list of master engines for this task :type master_engines: list(MasterEngine) :param str comment: optional comment :raises CreateElementFailed: failed to create the task ...
[ "Create", "a", "refresh", "task", "for", "master", "engines", ".", ":", "param", "str", "name", ":", "name", "of", "task", ":", "param", "master_engines", ":", "list", "of", "master", "engines", "for", "this", "task", ":", "type", "master_engines", ":", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/scheduled_tasks.py#L497-L515
gabstopper/smc-python
smc/administration/scheduled_tasks.py
DeleteLogTask.create
def create(cls, name, servers=None, time_range='yesterday', all_logs=False, filter_for_delete=None, comment=None, **kwargs): """ Create a new delete log task. Provide True to all_logs to delete all log types. Otherwise provide kwargs to specify each log by type of interest...
python
def create(cls, name, servers=None, time_range='yesterday', all_logs=False, filter_for_delete=None, comment=None, **kwargs): """ Create a new delete log task. Provide True to all_logs to delete all log types. Otherwise provide kwargs to specify each log by type of interest...
[ "def", "create", "(", "cls", ",", "name", ",", "servers", "=", "None", ",", "time_range", "=", "'yesterday'", ",", "all_logs", "=", "False", ",", "filter_for_delete", "=", "None", ",", "comment", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", ...
Create a new delete log task. Provide True to all_logs to delete all log types. Otherwise provide kwargs to specify each log by type of interest. :param str name: name for this task :param servers: servers to back up. Servers must be instances of management servers o...
[ "Create", "a", "new", "delete", "log", "task", ".", "Provide", "True", "to", "all_logs", "to", "delete", "all", "log", "types", ".", "Otherwise", "provide", "kwargs", "to", "specify", "each", "log", "by", "type", "of", "interest", ".", ":", "param", "str...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/scheduled_tasks.py#L532-L579
gabstopper/smc-python
smc/administration/scheduled_tasks.py
ServerBackupTask.create
def create(cls, name, servers, backup_log_data=False, encrypt_password=None, comment=None): """ Create a new server backup task. This task provides the ability to backup individual or all management and log servers under SMC management. :param str name: na...
python
def create(cls, name, servers, backup_log_data=False, encrypt_password=None, comment=None): """ Create a new server backup task. This task provides the ability to backup individual or all management and log servers under SMC management. :param str name: na...
[ "def", "create", "(", "cls", ",", "name", ",", "servers", ",", "backup_log_data", "=", "False", ",", "encrypt_password", "=", "None", ",", "comment", "=", "None", ")", ":", "if", "not", "servers", ":", "servers", "=", "[", "svr", ".", "href", "for", ...
Create a new server backup task. This task provides the ability to backup individual or all management and log servers under SMC management. :param str name: name of task :param servers: servers to back up. Servers must be instances of management servers or log serve...
[ "Create", "a", "new", "server", "backup", "task", ".", "This", "task", "provides", "the", "ability", "to", "backup", "individual", "or", "all", "management", "and", "log", "servers", "under", "SMC", "management", ".", ":", "param", "str", "name", ":", "nam...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/scheduled_tasks.py#L592-L627
gabstopper/smc-python
smc/administration/scheduled_tasks.py
SGInfoTask.create
def create(cls, name, engines, include_core_files=False, include_slapcat_output=False, comment=None): """ Create an sginfo task. :param str name: name of task :param engines: list of engines to apply the sginfo task :type engines: list(Engine) :pa...
python
def create(cls, name, engines, include_core_files=False, include_slapcat_output=False, comment=None): """ Create an sginfo task. :param str name: name of task :param engines: list of engines to apply the sginfo task :type engines: list(Engine) :pa...
[ "def", "create", "(", "cls", ",", "name", ",", "engines", ",", "include_core_files", "=", "False", ",", "include_slapcat_output", "=", "False", ",", "comment", "=", "None", ")", ":", "json", "=", "{", "'name'", ":", "name", ",", "'comment'", ":", "commen...
Create an sginfo task. :param str name: name of task :param engines: list of engines to apply the sginfo task :type engines: list(Engine) :param bool include_core_files: include core files in the sginfo backup (default: False) :param bool include_slapcat_out...
[ "Create", "an", "sginfo", "task", ".", ":", "param", "str", "name", ":", "name", "of", "task", ":", "param", "engines", ":", "list", "of", "engines", "to", "apply", "the", "sginfo", "task", ":", "type", "engines", ":", "list", "(", "Engine", ")", ":"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/scheduled_tasks.py#L647-L671
gabstopper/smc-python
smc/api/web.py
send_request
def send_request(user_session, method, request): """ Send request to SMC :param Session user_session: session object :param str method: method for request :param SMCRequest request: request object :raises SMCOperationFailure: failure with reason :rtype: SMCResult """ if user_ses...
python
def send_request(user_session, method, request): """ Send request to SMC :param Session user_session: session object :param str method: method for request :param SMCRequest request: request object :raises SMCOperationFailure: failure with reason :rtype: SMCResult """ if user_ses...
[ "def", "send_request", "(", "user_session", ",", "method", ",", "request", ")", ":", "if", "user_session", ".", "session", ":", "session", "=", "user_session", ".", "session", "# requests session", "try", ":", "method", "=", "method", ".", "upper", "(", ")",...
Send request to SMC :param Session user_session: session object :param str method: method for request :param SMCRequest request: request object :raises SMCOperationFailure: failure with reason :rtype: SMCResult
[ "Send", "request", "to", "SMC", ":", "param", "Session", "user_session", ":", "session", "object", ":", "param", "str", "method", ":", "method", "for", "request", ":", "param", "SMCRequest", "request", ":", "request", "object", ":", "raises", "SMCOperationFail...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/web.py#L33-L147
gabstopper/smc-python
smc/api/web.py
file_download
def file_download(user_session, request): """ Called when GET request specifies a filename to retrieve. :param Session user_session: session object :param SMCRequest request: request object :raises SMCOperationFailure: failure with reason :rtype: SMCResult """ logger.debug('Download...
python
def file_download(user_session, request): """ Called when GET request specifies a filename to retrieve. :param Session user_session: session object :param SMCRequest request: request object :raises SMCOperationFailure: failure with reason :rtype: SMCResult """ logger.debug('Download...
[ "def", "file_download", "(", "user_session", ",", "request", ")", ":", "logger", ".", "debug", "(", "'Download file: %s'", ",", "vars", "(", "request", ")", ")", "response", "=", "user_session", ".", "session", ".", "get", "(", "request", ".", "href", ",",...
Called when GET request specifies a filename to retrieve. :param Session user_session: session object :param SMCRequest request: request object :raises SMCOperationFailure: failure with reason :rtype: SMCResult
[ "Called", "when", "GET", "request", "specifies", "a", "filename", "to", "retrieve", ".", ":", "param", "Session", "user_session", ":", "session", "object", ":", "param", "SMCRequest", "request", ":", "request", "object", ":", "raises", "SMCOperationFailure", ":"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/web.py#L150-L184
gabstopper/smc-python
smc/api/web.py
file_upload
def file_upload(user_session, method, request): """ Perform a file upload PUT/POST to SMC. Request should have the files attribute set which will be an open handle to the file that will be binary transfer. :param Session user_session: session object :param str method: method to use, could b...
python
def file_upload(user_session, method, request): """ Perform a file upload PUT/POST to SMC. Request should have the files attribute set which will be an open handle to the file that will be binary transfer. :param Session user_session: session object :param str method: method to use, could b...
[ "def", "file_upload", "(", "user_session", ",", "method", ",", "request", ")", ":", "logger", ".", "debug", "(", "'Upload: %s'", ",", "vars", "(", "request", ")", ")", "http_command", "=", "getattr", "(", "user_session", ".", "session", ",", "method", ".",...
Perform a file upload PUT/POST to SMC. Request should have the files attribute set which will be an open handle to the file that will be binary transfer. :param Session user_session: session object :param str method: method to use, could be put or post :param SMCRequest request: request object ...
[ "Perform", "a", "file", "upload", "PUT", "/", "POST", "to", "SMC", ".", "Request", "should", "have", "the", "files", "attribute", "set", "which", "will", "be", "an", "open", "handle", "to", "the", "file", "that", "will", "be", "binary", "transfer", ".", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/web.py#L187-L214
gabstopper/smc-python
smc/core/node.py
Node.rename
def rename(self, name): """ Rename this node :param str name: new name for node """ self.update(name='{} node {}'.format(name, self.nodeid))
python
def rename(self, name): """ Rename this node :param str name: new name for node """ self.update(name='{} node {}'.format(name, self.nodeid))
[ "def", "rename", "(", "self", ",", "name", ")", ":", "self", ".", "update", "(", "name", "=", "'{} node {}'", ".", "format", "(", "name", ",", "self", ".", "nodeid", ")", ")" ]
Rename this node :param str name: new name for node
[ "Rename", "this", "node", ":", "param", "str", "name", ":", "new", "name", "for", "node" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L57-L63
gabstopper/smc-python
smc/core/node.py
Node._create
def _create(cls, name, node_type, nodeid=1, loopback_ndi=None): """ Create the node/s for the engine. This isn't called directly, instead it is used when engine.create() is called :param str name: name of node :param str node_type: based on engine type specified ...
python
def _create(cls, name, node_type, nodeid=1, loopback_ndi=None): """ Create the node/s for the engine. This isn't called directly, instead it is used when engine.create() is called :param str name: name of node :param str node_type: based on engine type specified ...
[ "def", "_create", "(", "cls", ",", "name", ",", "node_type", ",", "nodeid", "=", "1", ",", "loopback_ndi", "=", "None", ")", ":", "loopback", "=", "loopback_ndi", "if", "loopback_ndi", "else", "[", "]", "node", "=", "{", "node_type", ":", "{", "'activa...
Create the node/s for the engine. This isn't called directly, instead it is used when engine.create() is called :param str name: name of node :param str node_type: based on engine type specified :param int nodeid: used to identify which node :param list LoopbackInterface loopbac...
[ "Create", "the", "node", "/", "s", "for", "the", "engine", ".", "This", "isn", "t", "called", "directly", "instead", "it", "is", "used", "when", "engine", ".", "create", "()", "is", "called" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L78-L98
gabstopper/smc-python
smc/core/node.py
Node.loopback_interface
def loopback_interface(self): """ Loopback interfaces for this node. This will return empty if the engine is not a layer 3 firewall type:: >>> engine = Engine('dingo') >>> for node in engine.nodes: ... for loopback in node.loopback_interface: ...
python
def loopback_interface(self): """ Loopback interfaces for this node. This will return empty if the engine is not a layer 3 firewall type:: >>> engine = Engine('dingo') >>> for node in engine.nodes: ... for loopback in node.loopback_interface: ...
[ "def", "loopback_interface", "(", "self", ")", ":", "for", "lb", "in", "self", ".", "data", ".", "get", "(", "'loopback_node_dedicated_interface'", ",", "[", "]", ")", ":", "yield", "LoopbackInterface", "(", "lb", ",", "self", ".", "_engine", ")" ]
Loopback interfaces for this node. This will return empty if the engine is not a layer 3 firewall type:: >>> engine = Engine('dingo') >>> for node in engine.nodes: ... for loopback in node.loopback_interface: ... loopback ... ...
[ "Loopback", "interfaces", "for", "this", "node", ".", "This", "will", "return", "empty", "if", "the", "engine", "is", "not", "a", "layer", "3", "firewall", "type", "::", ">>>", "engine", "=", "Engine", "(", "dingo", ")", ">>>", "for", "node", "in", "en...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L101-L118
gabstopper/smc-python
smc/core/node.py
Node.bind_license
def bind_license(self, license_item_id=None): """ Auto bind license, uses dynamic if POS is not found :param str license_item_id: license id :raises LicenseError: binding license failed, possibly no licenses :return: None """ params = {'license_item_id': license_...
python
def bind_license(self, license_item_id=None): """ Auto bind license, uses dynamic if POS is not found :param str license_item_id: license id :raises LicenseError: binding license failed, possibly no licenses :return: None """ params = {'license_item_id': license_...
[ "def", "bind_license", "(", "self", ",", "license_item_id", "=", "None", ")", ":", "params", "=", "{", "'license_item_id'", ":", "license_item_id", "}", "self", ".", "make_request", "(", "LicenseError", ",", "method", "=", "'create'", ",", "resource", "=", "...
Auto bind license, uses dynamic if POS is not found :param str license_item_id: license id :raises LicenseError: binding license failed, possibly no licenses :return: None
[ "Auto", "bind", "license", "uses", "dynamic", "if", "POS", "is", "not", "found" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L132-L145
gabstopper/smc-python
smc/core/node.py
Node.initial_contact
def initial_contact(self, enable_ssh=True, time_zone=None, keyboard=None, install_on_server=None, filename=None, as_base64=False): """ Allows to save the initial contact for for the specified node :p...
python
def initial_contact(self, enable_ssh=True, time_zone=None, keyboard=None, install_on_server=None, filename=None, as_base64=False): """ Allows to save the initial contact for for the specified node :p...
[ "def", "initial_contact", "(", "self", ",", "enable_ssh", "=", "True", ",", "time_zone", "=", "None", ",", "keyboard", "=", "None", ",", "install_on_server", "=", "None", ",", "filename", "=", "None", ",", "as_base64", "=", "False", ")", ":", "result", "...
Allows to save the initial contact for for the specified node :param bool enable_ssh: flag to know if we allow the ssh daemon on the specified node :param str time_zone: optional time zone to set on the specified node :param str keyboard: optional keyboard to set on the specified...
[ "Allows", "to", "save", "the", "initial", "contact", "for", "for", "the", "specified", "node" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L171-L211
gabstopper/smc-python
smc/core/node.py
Node.interface_status
def interface_status(self): """ Obtain the interface status for this node. This will return an iterable that provides information about the existing interfaces. Retrieve a single interface status:: >>> node = engine.nodes[0] >>> node Node(name...
python
def interface_status(self): """ Obtain the interface status for this node. This will return an iterable that provides information about the existing interfaces. Retrieve a single interface status:: >>> node = engine.nodes[0] >>> node Node(name...
[ "def", "interface_status", "(", "self", ")", ":", "result", "=", "self", ".", "make_request", "(", "NodeCommandFailed", ",", "resource", "=", "'appliance_status'", ")", "return", "InterfaceStatus", "(", "result", ".", "get", "(", "'interface_statuses'", ",", "["...
Obtain the interface status for this node. This will return an iterable that provides information about the existing interfaces. Retrieve a single interface status:: >>> node = engine.nodes[0] >>> node Node(name=ngf-1065) >>> node.interface_status...
[ "Obtain", "the", "interface", "status", "for", "this", "node", ".", "This", "will", "return", "an", "iterable", "that", "provides", "information", "about", "the", "existing", "interfaces", ".", "Retrieve", "a", "single", "interface", "status", "::", ">>>", "no...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L224-L255
gabstopper/smc-python
smc/core/node.py
Node.hardware_status
def hardware_status(self): """ Obtain hardware statistics for various areas of this node. See :class:`~HardwareStatus` for usage. :raises NodeCommandFailed: failure to retrieve current status :rtype: HardwareStatus """ result = self.make_request(...
python
def hardware_status(self): """ Obtain hardware statistics for various areas of this node. See :class:`~HardwareStatus` for usage. :raises NodeCommandFailed: failure to retrieve current status :rtype: HardwareStatus """ result = self.make_request(...
[ "def", "hardware_status", "(", "self", ")", ":", "result", "=", "self", ".", "make_request", "(", "NodeCommandFailed", ",", "resource", "=", "'appliance_status'", ")", "return", "HardwareStatus", "(", "result", ".", "get", "(", "'hardware_statuses'", ",", "[", ...
Obtain hardware statistics for various areas of this node. See :class:`~HardwareStatus` for usage. :raises NodeCommandFailed: failure to retrieve current status :rtype: HardwareStatus
[ "Obtain", "hardware", "statistics", "for", "various", "areas", "of", "this", "node", ".", "See", ":", "class", ":", "~HardwareStatus", "for", "usage", ".", ":", "raises", "NodeCommandFailed", ":", "failure", "to", "retrieve", "current", "status", ":", "rtype",...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L258-L270
gabstopper/smc-python
smc/core/node.py
Node.go_online
def go_online(self, comment=None): """ Executes a Go-Online operation on the specified node typically done when the node has already been forced offline via :func:`go_offline` :param str comment: (optional) comment to audit :raises NodeCommandFailed: online not available...
python
def go_online(self, comment=None): """ Executes a Go-Online operation on the specified node typically done when the node has already been forced offline via :func:`go_offline` :param str comment: (optional) comment to audit :raises NodeCommandFailed: online not available...
[ "def", "go_online", "(", "self", ",", "comment", "=", "None", ")", ":", "self", ".", "make_request", "(", "NodeCommandFailed", ",", "method", "=", "'update'", ",", "resource", "=", "'go_online'", ",", "params", "=", "{", "'comment'", ":", "comment", "}", ...
Executes a Go-Online operation on the specified node typically done when the node has already been forced offline via :func:`go_offline` :param str comment: (optional) comment to audit :raises NodeCommandFailed: online not available :return: None
[ "Executes", "a", "Go", "-", "Online", "operation", "on", "the", "specified", "node", "typically", "done", "when", "the", "node", "has", "already", "been", "forced", "offline", "via", ":", "func", ":", "go_offline" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L317-L331
gabstopper/smc-python
smc/core/node.py
Node.go_offline
def go_offline(self, comment=None): """ Executes a Go-Offline operation on the specified node :param str comment: optional comment to audit :raises NodeCommandFailed: offline not available :return: None """ self.make_request( NodeCommandFailed, ...
python
def go_offline(self, comment=None): """ Executes a Go-Offline operation on the specified node :param str comment: optional comment to audit :raises NodeCommandFailed: offline not available :return: None """ self.make_request( NodeCommandFailed, ...
[ "def", "go_offline", "(", "self", ",", "comment", "=", "None", ")", ":", "self", ".", "make_request", "(", "NodeCommandFailed", ",", "method", "=", "'update'", ",", "resource", "=", "'go_offline'", ",", "params", "=", "{", "'comment'", ":", "comment", "}",...
Executes a Go-Offline operation on the specified node :param str comment: optional comment to audit :raises NodeCommandFailed: offline not available :return: None
[ "Executes", "a", "Go", "-", "Offline", "operation", "on", "the", "specified", "node" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L333-L345
gabstopper/smc-python
smc/core/node.py
Node.go_standby
def go_standby(self, comment=None): """ Executes a Go-Standby operation on the specified node. To get the status of the current node/s, run :func:`status` :param str comment: optional comment to audit :raises NodeCommandFailed: engine cannot go standby :return: None ...
python
def go_standby(self, comment=None): """ Executes a Go-Standby operation on the specified node. To get the status of the current node/s, run :func:`status` :param str comment: optional comment to audit :raises NodeCommandFailed: engine cannot go standby :return: None ...
[ "def", "go_standby", "(", "self", ",", "comment", "=", "None", ")", ":", "self", ".", "make_request", "(", "NodeCommandFailed", ",", "method", "=", "'update'", ",", "resource", "=", "'go_standby'", ",", "params", "=", "{", "'comment'", ":", "comment", "}",...
Executes a Go-Standby operation on the specified node. To get the status of the current node/s, run :func:`status` :param str comment: optional comment to audit :raises NodeCommandFailed: engine cannot go standby :return: None
[ "Executes", "a", "Go", "-", "Standby", "operation", "on", "the", "specified", "node", ".", "To", "get", "the", "status", "of", "the", "current", "node", "/", "s", "run", ":", "func", ":", "status" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L347-L360
gabstopper/smc-python
smc/core/node.py
Node.lock_online
def lock_online(self, comment=None): """ Executes a Lock-Online operation on the specified node :param str comment: comment for audit :raises NodeCommandFailed: cannot lock online :return: None """ self.make_request( NodeCommandFailed, met...
python
def lock_online(self, comment=None): """ Executes a Lock-Online operation on the specified node :param str comment: comment for audit :raises NodeCommandFailed: cannot lock online :return: None """ self.make_request( NodeCommandFailed, met...
[ "def", "lock_online", "(", "self", ",", "comment", "=", "None", ")", ":", "self", ".", "make_request", "(", "NodeCommandFailed", ",", "method", "=", "'update'", ",", "resource", "=", "'lock_online'", ",", "params", "=", "{", "'comment'", ":", "comment", "}...
Executes a Lock-Online operation on the specified node :param str comment: comment for audit :raises NodeCommandFailed: cannot lock online :return: None
[ "Executes", "a", "Lock", "-", "Online", "operation", "on", "the", "specified", "node" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L362-L374
gabstopper/smc-python
smc/core/node.py
Node.lock_offline
def lock_offline(self, comment=None): """ Executes a Lock-Offline operation on the specified node Bring back online by running :func:`go_online`. :param str comment: comment for audit :raises NodeCommandFailed: lock offline failed :return: None """ self.m...
python
def lock_offline(self, comment=None): """ Executes a Lock-Offline operation on the specified node Bring back online by running :func:`go_online`. :param str comment: comment for audit :raises NodeCommandFailed: lock offline failed :return: None """ self.m...
[ "def", "lock_offline", "(", "self", ",", "comment", "=", "None", ")", ":", "self", ".", "make_request", "(", "NodeCommandFailed", ",", "method", "=", "'update'", ",", "resource", "=", "'lock_offline'", ",", "params", "=", "{", "'comment'", ":", "comment", ...
Executes a Lock-Offline operation on the specified node Bring back online by running :func:`go_online`. :param str comment: comment for audit :raises NodeCommandFailed: lock offline failed :return: None
[ "Executes", "a", "Lock", "-", "Offline", "operation", "on", "the", "specified", "node", "Bring", "back", "online", "by", "running", ":", "func", ":", "go_online", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L376-L389
gabstopper/smc-python
smc/core/node.py
Node.reset_user_db
def reset_user_db(self, comment=None): """ Executes a Send Reset LDAP User DB Request operation on this node. :param str comment: comment to audit :raises NodeCommandFailed: failure resetting db :return: None """ self.make_request( NodeCommand...
python
def reset_user_db(self, comment=None): """ Executes a Send Reset LDAP User DB Request operation on this node. :param str comment: comment to audit :raises NodeCommandFailed: failure resetting db :return: None """ self.make_request( NodeCommand...
[ "def", "reset_user_db", "(", "self", ",", "comment", "=", "None", ")", ":", "self", ".", "make_request", "(", "NodeCommandFailed", ",", "method", "=", "'update'", ",", "resource", "=", "'reset_user_db'", ",", "params", "=", "{", "'comment'", ":", "comment", ...
Executes a Send Reset LDAP User DB Request operation on this node. :param str comment: comment to audit :raises NodeCommandFailed: failure resetting db :return: None
[ "Executes", "a", "Send", "Reset", "LDAP", "User", "DB", "Request", "operation", "on", "this", "node", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L391-L404
gabstopper/smc-python
smc/core/node.py
Node.debug
def debug(self, filter_enabled=False): """ View all debug settings for this node. This will return a debug object. View the debug object repr to identify settings to enable or disable and submit the object to :meth:`set_debug` to enable settings. Add filter_enabl...
python
def debug(self, filter_enabled=False): """ View all debug settings for this node. This will return a debug object. View the debug object repr to identify settings to enable or disable and submit the object to :meth:`set_debug` to enable settings. Add filter_enabl...
[ "def", "debug", "(", "self", ",", "filter_enabled", "=", "False", ")", ":", "params", "=", "{", "'filter_enabled'", ":", "filter_enabled", "}", "result", "=", "self", ".", "make_request", "(", "NodeCommandFailed", ",", "resource", "=", "'diagnostic'", ",", "...
View all debug settings for this node. This will return a debug object. View the debug object repr to identify settings to enable or disable and submit the object to :meth:`set_debug` to enable settings. Add filter_enabled=True argument to see only enabled settings :par...
[ "View", "all", "debug", "settings", "for", "this", "node", ".", "This", "will", "return", "a", "debug", "object", ".", "View", "the", "debug", "object", "repr", "to", "identify", "settings", "to", "enable", "or", "disable", "and", "submit", "the", "object"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L406-L426
gabstopper/smc-python
smc/core/node.py
Node.set_debug
def set_debug(self, debug): """ Set the debug settings for this node. This should be a modified :class:`~Debug` instance. This will take effect immediately on the specified node. :param Debug debug: debug object with specified settings :raises NodeCommandFailed: ...
python
def set_debug(self, debug): """ Set the debug settings for this node. This should be a modified :class:`~Debug` instance. This will take effect immediately on the specified node. :param Debug debug: debug object with specified settings :raises NodeCommandFailed: ...
[ "def", "set_debug", "(", "self", ",", "debug", ")", ":", "self", ".", "make_request", "(", "NodeCommandFailed", ",", "method", "=", "'create'", ",", "resource", "=", "'send_diagnostic'", ",", "json", "=", "debug", ".", "serialize", "(", ")", ")" ]
Set the debug settings for this node. This should be a modified :class:`~Debug` instance. This will take effect immediately on the specified node. :param Debug debug: debug object with specified settings :raises NodeCommandFailed: fail to communicate with node :return: N...
[ "Set", "the", "debug", "settings", "for", "this", "node", ".", "This", "should", "be", "a", "modified", ":", "class", ":", "~Debug", "instance", ".", "This", "will", "take", "effect", "immediately", "on", "the", "specified", "node", ".", ":", "param", "D...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L428-L444
gabstopper/smc-python
smc/core/node.py
Node.reboot
def reboot(self, comment=None): """ Send reboot command to this node. :param str comment: comment to audit :raises NodeCommandFailed: reboot failed with reason :return: None """ self.make_request( NodeCommandFailed, method='update', ...
python
def reboot(self, comment=None): """ Send reboot command to this node. :param str comment: comment to audit :raises NodeCommandFailed: reboot failed with reason :return: None """ self.make_request( NodeCommandFailed, method='update', ...
[ "def", "reboot", "(", "self", ",", "comment", "=", "None", ")", ":", "self", ".", "make_request", "(", "NodeCommandFailed", ",", "method", "=", "'update'", ",", "resource", "=", "'reboot'", ",", "params", "=", "{", "'comment'", ":", "comment", "}", ")" ]
Send reboot command to this node. :param str comment: comment to audit :raises NodeCommandFailed: reboot failed with reason :return: None
[ "Send", "reboot", "command", "to", "this", "node", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L446-L458
gabstopper/smc-python
smc/core/node.py
Node.sginfo
def sginfo(self, include_core_files=False, include_slapcat_output=False, filename='sginfo.gz'): """ Get the SG Info of the specified node. Optionally provide a filename, otherwise default to 'sginfo.gz'. Once you run gzip -d <filename>, the inner contents wi...
python
def sginfo(self, include_core_files=False, include_slapcat_output=False, filename='sginfo.gz'): """ Get the SG Info of the specified node. Optionally provide a filename, otherwise default to 'sginfo.gz'. Once you run gzip -d <filename>, the inner contents wi...
[ "def", "sginfo", "(", "self", ",", "include_core_files", "=", "False", ",", "include_slapcat_output", "=", "False", ",", "filename", "=", "'sginfo.gz'", ")", ":", "params", "=", "{", "'include_core_files'", ":", "include_core_files", ",", "'include_slapcat_output'",...
Get the SG Info of the specified node. Optionally provide a filename, otherwise default to 'sginfo.gz'. Once you run gzip -d <filename>, the inner contents will be in .tar format. :param include_core_files: flag to include or not core files :param include_slapcat_output: flag to include...
[ "Get", "the", "SG", "Info", "of", "the", "specified", "node", ".", "Optionally", "provide", "a", "filename", "otherwise", "default", "to", "sginfo", ".", "gz", ".", "Once", "you", "run", "gzip", "-", "d", "<filename", ">", "the", "inner", "contents", "wi...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L490-L515
gabstopper/smc-python
smc/core/node.py
Node.ssh
def ssh(self, enable=True, comment=None): """ Enable or disable SSH :param bool enable: enable or disable SSH daemon :param str comment: optional comment for audit :raises NodeCommandFailed: cannot enable SSH daemon :return: None """ self.make_request( ...
python
def ssh(self, enable=True, comment=None): """ Enable or disable SSH :param bool enable: enable or disable SSH daemon :param str comment: optional comment for audit :raises NodeCommandFailed: cannot enable SSH daemon :return: None """ self.make_request( ...
[ "def", "ssh", "(", "self", ",", "enable", "=", "True", ",", "comment", "=", "None", ")", ":", "self", ".", "make_request", "(", "NodeCommandFailed", ",", "method", "=", "'update'", ",", "resource", "=", "'ssh'", ",", "params", "=", "{", "'enable'", ":"...
Enable or disable SSH :param bool enable: enable or disable SSH daemon :param str comment: optional comment for audit :raises NodeCommandFailed: cannot enable SSH daemon :return: None
[ "Enable", "or", "disable", "SSH" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L517-L530
gabstopper/smc-python
smc/core/node.py
Node.change_ssh_pwd
def change_ssh_pwd(self, pwd=None, comment=None): """ Executes a change SSH password operation on the specified node :param str pwd: changed password value :param str comment: optional comment for audit log :raises NodeCommandFailed: cannot change ssh password :return: N...
python
def change_ssh_pwd(self, pwd=None, comment=None): """ Executes a change SSH password operation on the specified node :param str pwd: changed password value :param str comment: optional comment for audit log :raises NodeCommandFailed: cannot change ssh password :return: N...
[ "def", "change_ssh_pwd", "(", "self", ",", "pwd", "=", "None", ",", "comment", "=", "None", ")", ":", "self", ".", "make_request", "(", "NodeCommandFailed", ",", "method", "=", "'update'", ",", "resource", "=", "'change_ssh_pwd'", ",", "params", "=", "{", ...
Executes a change SSH password operation on the specified node :param str pwd: changed password value :param str comment: optional comment for audit log :raises NodeCommandFailed: cannot change ssh password :return: None
[ "Executes", "a", "change", "SSH", "password", "operation", "on", "the", "specified", "node" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L532-L546
gabstopper/smc-python
smc/core/node.py
HardwareStatus.logging_subsystem
def logging_subsystem(self): """ A collection of logging subsystem statuses :rtype: Status """ for item in self: if item.name.startswith('Logging'): for s in item_status(item): yield s
python
def logging_subsystem(self): """ A collection of logging subsystem statuses :rtype: Status """ for item in self: if item.name.startswith('Logging'): for s in item_status(item): yield s
[ "def", "logging_subsystem", "(", "self", ")", ":", "for", "item", "in", "self", ":", "if", "item", ".", "name", ".", "startswith", "(", "'Logging'", ")", ":", "for", "s", "in", "item_status", "(", "item", ")", ":", "yield", "s" ]
A collection of logging subsystem statuses :rtype: Status
[ "A", "collection", "of", "logging", "subsystem", "statuses", ":", "rtype", ":", "Status" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L742-L751
gabstopper/smc-python
smc/core/node.py
HardwareStatus.filesystem
def filesystem(self): """ A collection of filesystem related statuses :rtype: Status """ for item in self: if item.name.startswith('File System'): for s in item_status(item): yield s
python
def filesystem(self): """ A collection of filesystem related statuses :rtype: Status """ for item in self: if item.name.startswith('File System'): for s in item_status(item): yield s
[ "def", "filesystem", "(", "self", ")", ":", "for", "item", "in", "self", ":", "if", "item", ".", "name", ".", "startswith", "(", "'File System'", ")", ":", "for", "s", "in", "item_status", "(", "item", ")", ":", "yield", "s" ]
A collection of filesystem related statuses :rtype: Status
[ "A", "collection", "of", "filesystem", "related", "statuses", ":", "rtype", ":", "Status" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L754-L763
gabstopper/smc-python
smc/core/contact_address.py
ContactAddressNode.delete
def delete(self, location_name): """ Remove a given location by location name. This operation is performed only if the given location is valid, and if so, `update` is called automatically. :param str location: location name or location ref :raises UpdateElementFa...
python
def delete(self, location_name): """ Remove a given location by location name. This operation is performed only if the given location is valid, and if so, `update` is called automatically. :param str location: location name or location ref :raises UpdateElementFa...
[ "def", "delete", "(", "self", ",", "location_name", ")", ":", "updated", "=", "False", "location_ref", "=", "location_helper", "(", "location_name", ",", "search_only", "=", "True", ")", "if", "location_ref", "in", "self", ":", "self", ".", "_cas", "[", ":...
Remove a given location by location name. This operation is performed only if the given location is valid, and if so, `update` is called automatically. :param str location: location name or location ref :raises UpdateElementFailed: failed to update element with reason :r...
[ "Remove", "a", "given", "location", "by", "location", "name", ".", "This", "operation", "is", "performed", "only", "if", "the", "given", "location", "is", "valid", "and", "if", "so", "update", "is", "called", "automatically", ".", ":", "param", "str", "loc...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/contact_address.py#L92-L109
gabstopper/smc-python
smc/core/contact_address.py
ContactAddressNode.update_or_create
def update_or_create(self, location, contact_address, with_status=False, **kw): """ Update an existing contact address or create if the location does not exist. :param str location: name of the location, the location will be added if it doesn't exist :param s...
python
def update_or_create(self, location, contact_address, with_status=False, **kw): """ Update an existing contact address or create if the location does not exist. :param str location: name of the location, the location will be added if it doesn't exist :param s...
[ "def", "update_or_create", "(", "self", ",", "location", ",", "contact_address", ",", "with_status", "=", "False", ",", "*", "*", "kw", ")", ":", "updated", ",", "created", "=", "False", ",", "False", "location_ref", "=", "location_helper", "(", "location", ...
Update an existing contact address or create if the location does not exist. :param str location: name of the location, the location will be added if it doesn't exist :param str contact_address: contact address IP. Can be the string 'dynamic' if this should be a ...
[ "Update", "an", "existing", "contact", "address", "or", "create", "if", "the", "location", "does", "not", "exist", ".", ":", "param", "str", "location", ":", "name", "of", "the", "location", "the", "location", "will", "be", "added", "if", "it", "doesn", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/contact_address.py#L111-L148
gabstopper/smc-python
smc/core/contact_address.py
ContactAddressCollection.get
def get(self, interface_id, interface_ip=None): """ Get will return a list of interface references based on the specified interface id. Multiple references can be returned if a single interface has multiple IP addresses assigned. :return: If interface_ip is provided, a s...
python
def get(self, interface_id, interface_ip=None): """ Get will return a list of interface references based on the specified interface id. Multiple references can be returned if a single interface has multiple IP addresses assigned. :return: If interface_ip is provided, a s...
[ "def", "get", "(", "self", ",", "interface_id", ",", "interface_ip", "=", "None", ")", ":", "interfaces", "=", "[", "]", "for", "interface", "in", "iter", "(", "self", ")", ":", "if", "interface", ".", "interface_id", "==", "str", "(", "interface_id", ...
Get will return a list of interface references based on the specified interface id. Multiple references can be returned if a single interface has multiple IP addresses assigned. :return: If interface_ip is provided, a single ContactAddressNode element is returned if found. O...
[ "Get", "will", "return", "a", "list", "of", "interface", "references", "based", "on", "the", "specified", "interface", "id", ".", "Multiple", "references", "can", "be", "returned", "if", "a", "single", "interface", "has", "multiple", "IP", "addresses", "assign...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/contact_address.py#L217-L236
gabstopper/smc-python
smc/core/sub_interfaces.py
SubInterface.change_interface_id
def change_interface_id(self, interface_id): """ Generic change interface ID for VLAN interfaces that are not Inline Interfaces (non-VLAN sub interfaces do not have an interface_id field). :param str, int interface_id: interface ID value """ _, second = s...
python
def change_interface_id(self, interface_id): """ Generic change interface ID for VLAN interfaces that are not Inline Interfaces (non-VLAN sub interfaces do not have an interface_id field). :param str, int interface_id: interface ID value """ _, second = s...
[ "def", "change_interface_id", "(", "self", ",", "interface_id", ")", ":", "_", ",", "second", "=", "self", ".", "nicid", ".", "split", "(", "'.'", ")", "self", ".", "update", "(", "nicid", "=", "'{}.{}'", ".", "format", "(", "str", "(", "interface_id",...
Generic change interface ID for VLAN interfaces that are not Inline Interfaces (non-VLAN sub interfaces do not have an interface_id field). :param str, int interface_id: interface ID value
[ "Generic", "change", "interface", "ID", "for", "VLAN", "interfaces", "that", "are", "not", "Inline", "Interfaces", "(", "non", "-", "VLAN", "sub", "interfaces", "do", "not", "have", "an", "interface_id", "field", ")", ".", ":", "param", "str", "int", "inte...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L34-L43
gabstopper/smc-python
smc/core/sub_interfaces.py
SubInterface.change_vlan_id
def change_vlan_id(self, vlan_id): """ Change a VLAN id :param str vlan_id: new vlan """ first, _ = self.nicid.split('.') self.update(nicid='{}.{}'.format(first, str(vlan_id)))
python
def change_vlan_id(self, vlan_id): """ Change a VLAN id :param str vlan_id: new vlan """ first, _ = self.nicid.split('.') self.update(nicid='{}.{}'.format(first, str(vlan_id)))
[ "def", "change_vlan_id", "(", "self", ",", "vlan_id", ")", ":", "first", ",", "_", "=", "self", ".", "nicid", ".", "split", "(", "'.'", ")", "self", ".", "update", "(", "nicid", "=", "'{}.{}'", ".", "format", "(", "first", ",", "str", "(", "vlan_id...
Change a VLAN id :param str vlan_id: new vlan
[ "Change", "a", "VLAN", "id", ":", "param", "str", "vlan_id", ":", "new", "vlan" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L45-L52
gabstopper/smc-python
smc/core/sub_interfaces.py
ClusterVirtualInterface.vlan_id
def vlan_id(self): """ VLAN ID for this interface, if any :return: VLAN identifier :rtype: str """ nicid = self.nicid if nicid: v = nicid.split('.') if len(v) > 1: return nicid.split('.')[1]
python
def vlan_id(self): """ VLAN ID for this interface, if any :return: VLAN identifier :rtype: str """ nicid = self.nicid if nicid: v = nicid.split('.') if len(v) > 1: return nicid.split('.')[1]
[ "def", "vlan_id", "(", "self", ")", ":", "nicid", "=", "self", ".", "nicid", "if", "nicid", ":", "v", "=", "nicid", ".", "split", "(", "'.'", ")", "if", "len", "(", "v", ")", ">", "1", ":", "return", "nicid", ".", "split", "(", "'.'", ")", "[...
VLAN ID for this interface, if any :return: VLAN identifier :rtype: str
[ "VLAN", "ID", "for", "this", "interface", "if", "any", ":", "return", ":", "VLAN", "identifier", ":", "rtype", ":", "str" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L99-L110
gabstopper/smc-python
smc/core/sub_interfaces.py
InlineInterface.create
def create(cls, interface_id, logical_interface_ref, second_interface_id=None, zone_ref=None, **kwargs): """ :param str interface_id: two interfaces, i.e. '1-2', '4-5', '7-10', etc :param str logical_ref: logical interface reference :param str zone_ref: reference to zone, set...
python
def create(cls, interface_id, logical_interface_ref, second_interface_id=None, zone_ref=None, **kwargs): """ :param str interface_id: two interfaces, i.e. '1-2', '4-5', '7-10', etc :param str logical_ref: logical interface reference :param str zone_ref: reference to zone, set...
[ "def", "create", "(", "cls", ",", "interface_id", ",", "logical_interface_ref", ",", "second_interface_id", "=", "None", ",", "zone_ref", "=", "None", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "'inspect_unspecified_vlans'", ":", "True", ",", "'nic...
:param str interface_id: two interfaces, i.e. '1-2', '4-5', '7-10', etc :param str logical_ref: logical interface reference :param str zone_ref: reference to zone, set on second inline pair :rtype: dict
[ ":", "param", "str", "interface_id", ":", "two", "interfaces", "i", ".", "e", ".", "1", "-", "2", "4", "-", "5", "7", "-", "10", "etc", ":", "param", "str", "logical_ref", ":", "logical", "interface", "reference", ":", "param", "str", "zone_ref", ":"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L144-L161
gabstopper/smc-python
smc/core/sub_interfaces.py
InlineInterface.change_vlan_id
def change_vlan_id(self, vlan_id): """ Change a VLAN id for an inline interface. :param str vlan_id: New VLAN id. Can be in format '1-2' or a single numerical value. If in '1-2' format, this specifies the vlan ID for the first inline interface and the rightmost ...
python
def change_vlan_id(self, vlan_id): """ Change a VLAN id for an inline interface. :param str vlan_id: New VLAN id. Can be in format '1-2' or a single numerical value. If in '1-2' format, this specifies the vlan ID for the first inline interface and the rightmost ...
[ "def", "change_vlan_id", "(", "self", ",", "vlan_id", ")", ":", "first", ",", "second", "=", "self", ".", "nicid", ".", "split", "(", "'-'", ")", "firstintf", "=", "first", ".", "split", "(", "'.'", ")", "[", "0", "]", "secondintf", "=", "second", ...
Change a VLAN id for an inline interface. :param str vlan_id: New VLAN id. Can be in format '1-2' or a single numerical value. If in '1-2' format, this specifies the vlan ID for the first inline interface and the rightmost for the second. :return: None
[ "Change", "a", "VLAN", "id", "for", "an", "inline", "interface", ".", ":", "param", "str", "vlan_id", ":", "New", "VLAN", "id", ".", "Can", "be", "in", "format", "1", "-", "2", "or", "a", "single", "numerical", "value", ".", "If", "in", "1", "-", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L163-L178
gabstopper/smc-python
smc/core/sub_interfaces.py
InlineInterface.change_interface_id
def change_interface_id(self, newid): """ Change the inline interface ID. The current format is nicid='1-2', where '1' is the top level interface ID (first), and '2' is the second interface in the pair. Consider the existing nicid in case this is a VLAN. :param s...
python
def change_interface_id(self, newid): """ Change the inline interface ID. The current format is nicid='1-2', where '1' is the top level interface ID (first), and '2' is the second interface in the pair. Consider the existing nicid in case this is a VLAN. :param s...
[ "def", "change_interface_id", "(", "self", ",", "newid", ")", ":", "try", ":", "newleft", ",", "newright", "=", "newid", ".", "split", "(", "'-'", ")", "except", "ValueError", ":", "raise", "EngineCommandFailed", "(", "'You must provide two parts when changing '",...
Change the inline interface ID. The current format is nicid='1-2', where '1' is the top level interface ID (first), and '2' is the second interface in the pair. Consider the existing nicid in case this is a VLAN. :param str newid: string defining new pair, i.e. '3-4' :re...
[ "Change", "the", "inline", "interface", "ID", ".", "The", "current", "format", "is", "nicid", "=", "1", "-", "2", "where", "1", "is", "the", "top", "level", "interface", "ID", "(", "first", ")", "and", "2", "is", "the", "second", "interface", "in", "...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L180-L203
gabstopper/smc-python
smc/core/sub_interfaces.py
InlineInterface.vlan_id
def vlan_id(self): """ VLAN ID for this interface, if any :return: VLAN identifier :rtype: str """ nicids = self.nicid.split('-') if nicids: u = [] for vlan in nicids: if vlan.split('.')[-1] not in u: ...
python
def vlan_id(self): """ VLAN ID for this interface, if any :return: VLAN identifier :rtype: str """ nicids = self.nicid.split('-') if nicids: u = [] for vlan in nicids: if vlan.split('.')[-1] not in u: ...
[ "def", "vlan_id", "(", "self", ")", ":", "nicids", "=", "self", ".", "nicid", ".", "split", "(", "'-'", ")", "if", "nicids", ":", "u", "=", "[", "]", "for", "vlan", "in", "nicids", ":", "if", "vlan", ".", "split", "(", "'.'", ")", "[", "-", "...
VLAN ID for this interface, if any :return: VLAN identifier :rtype: str
[ "VLAN", "ID", "for", "this", "interface", "if", "any", ":", "return", ":", "VLAN", "identifier", ":", "rtype", ":", "str" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L206-L219
gabstopper/smc-python
smc/core/sub_interfaces.py
CaptureInterface.create
def create(cls, interface_id, logical_interface_ref, **kw): """ :param int interface_id: the interface id :param str logical_ref: logical interface reference, must be unique from inline intfs :rtype: dict """ data = {'inspect_unspecified_vlans': True, ...
python
def create(cls, interface_id, logical_interface_ref, **kw): """ :param int interface_id: the interface id :param str logical_ref: logical interface reference, must be unique from inline intfs :rtype: dict """ data = {'inspect_unspecified_vlans': True, ...
[ "def", "create", "(", "cls", ",", "interface_id", ",", "logical_interface_ref", ",", "*", "*", "kw", ")", ":", "data", "=", "{", "'inspect_unspecified_vlans'", ":", "True", ",", "'logical_interface_ref'", ":", "logical_interface_ref", ",", "'nicid'", ":", "str",...
:param int interface_id: the interface id :param str logical_ref: logical interface reference, must be unique from inline intfs :rtype: dict
[ ":", "param", "int", "interface_id", ":", "the", "interface", "id", ":", "param", "str", "logical_ref", ":", "logical", "interface", "reference", "must", "be", "unique", "from", "inline", "intfs", ":", "rtype", ":", "dict" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L284-L298
gabstopper/smc-python
smc/core/sub_interfaces.py
NodeInterface.create
def create(cls, interface_id, address, network_value, nodeid=1, **kwargs): """ :param int interface_id: interface id :param str address: ip address of the interface :param str network_value: network/netmask, i.e. x.x.x.x/24 :param int nodeid: for clusters, used to ...
python
def create(cls, interface_id, address, network_value, nodeid=1, **kwargs): """ :param int interface_id: interface id :param str address: ip address of the interface :param str network_value: network/netmask, i.e. x.x.x.x/24 :param int nodeid: for clusters, used to ...
[ "def", "create", "(", "cls", ",", "interface_id", ",", "address", ",", "network_value", ",", "nodeid", "=", "1", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "'address'", ":", "address", ",", "'network_value'", ":", "network_value", ",", "'nicid'...
:param int interface_id: interface id :param str address: ip address of the interface :param str network_value: network/netmask, i.e. x.x.x.x/24 :param int nodeid: for clusters, used to identify the node number :rtype: dict
[ ":", "param", "int", "interface_id", ":", "interface", "id", ":", "param", "str", "address", ":", "ip", "address", "of", "the", "interface", ":", "param", "str", "network_value", ":", "network", "/", "netmask", "i", ".", "e", ".", "x", ".", "x", ".", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L362-L384
gabstopper/smc-python
smc/core/sub_interfaces.py
SingleNodeInterface.create
def create(cls, interface_id, address=None, network_value=None, nodeid=1, **kw): """ :param int interface_id: interface id :param str address: address of this interface :param str network_value: network of this interface in cidr x.x.x.x/24 :param int nodeid: if a c...
python
def create(cls, interface_id, address=None, network_value=None, nodeid=1, **kw): """ :param int interface_id: interface id :param str address: address of this interface :param str network_value: network of this interface in cidr x.x.x.x/24 :param int nodeid: if a c...
[ "def", "create", "(", "cls", ",", "interface_id", ",", "address", "=", "None", ",", "network_value", "=", "None", ",", "nodeid", "=", "1", ",", "*", "*", "kw", ")", ":", "data", "=", "{", "'address'", ":", "address", ",", "'auth_request'", ":", "Fals...
:param int interface_id: interface id :param str address: address of this interface :param str network_value: network of this interface in cidr x.x.x.x/24 :param int nodeid: if a cluster, identifies which node this is for :rtype: dict
[ ":", "param", "int", "interface_id", ":", "interface", "id", ":", "param", "str", "address", ":", "address", "of", "this", "interface", ":", "param", "str", "network_value", ":", "network", "of", "this", "interface", "in", "cidr", "x", ".", "x", ".", "x"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L426-L462
gabstopper/smc-python
smc/core/sub_interfaces.py
LoopbackClusterInterface.create
def create(cls, address, ospf_area=None, **kwargs): """ Create a loopback interface. Uses parent constructor :rtype: LoopbackClusterInterface """ return super(LoopbackClusterInterface, cls).create( address=address, network_value='{}/32'.format(add...
python
def create(cls, address, ospf_area=None, **kwargs): """ Create a loopback interface. Uses parent constructor :rtype: LoopbackClusterInterface """ return super(LoopbackClusterInterface, cls).create( address=address, network_value='{}/32'.format(add...
[ "def", "create", "(", "cls", ",", "address", ",", "ospf_area", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "LoopbackClusterInterface", ",", "cls", ")", ".", "create", "(", "address", "=", "address", ",", "network_value", "=", ...
Create a loopback interface. Uses parent constructor :rtype: LoopbackClusterInterface
[ "Create", "a", "loopback", "interface", ".", "Uses", "parent", "constructor", ":", "rtype", ":", "LoopbackClusterInterface" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L478-L489
gabstopper/smc-python
smc/core/sub_interfaces.py
LoopbackClusterInterface.delete
def delete(self): """ Delete a loopback cluster virtual interface from this engine. Changes to the engine configuration are done immediately. You can find cluster virtual loopbacks by iterating at the engine level:: for loopbacks in engine.loopback_...
python
def delete(self): """ Delete a loopback cluster virtual interface from this engine. Changes to the engine configuration are done immediately. You can find cluster virtual loopbacks by iterating at the engine level:: for loopbacks in engine.loopback_...
[ "def", "delete", "(", "self", ")", ":", "self", ".", "_engine", ".", "data", "[", "self", ".", "typeof", "]", "=", "[", "loopback", "for", "loopback", "in", "self", ".", "_engine", ".", "data", ".", "get", "(", "self", ".", "typeof", ",", "[", "]...
Delete a loopback cluster virtual interface from this engine. Changes to the engine configuration are done immediately. You can find cluster virtual loopbacks by iterating at the engine level:: for loopbacks in engine.loopback_interface: ... ...
[ "Delete", "a", "loopback", "cluster", "virtual", "interface", "from", "this", "engine", ".", "Changes", "to", "the", "engine", "configuration", "are", "done", "immediately", ".", "You", "can", "find", "cluster", "virtual", "loopbacks", "by", "iterating", "at", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L491-L509
gabstopper/smc-python
smc/core/sub_interfaces.py
LoopbackClusterInterface.add_cvi_loopback
def add_cvi_loopback(self, address, ospf_area=None, **kw): """ Add a loopback interface as a cluster virtual loopback. This enables the loopback to 'float' between cluster members. Changes are committed immediately. :param str address: ip address for loopback :pa...
python
def add_cvi_loopback(self, address, ospf_area=None, **kw): """ Add a loopback interface as a cluster virtual loopback. This enables the loopback to 'float' between cluster members. Changes are committed immediately. :param str address: ip address for loopback :pa...
[ "def", "add_cvi_loopback", "(", "self", ",", "address", ",", "ospf_area", "=", "None", ",", "*", "*", "kw", ")", ":", "lb", "=", "self", ".", "create", "(", "address", ",", "ospf_area", ",", "*", "*", "kw", ")", "if", "self", ".", "typeof", "in", ...
Add a loopback interface as a cluster virtual loopback. This enables the loopback to 'float' between cluster members. Changes are committed immediately. :param str address: ip address for loopback :param int rank: rank of this entry :param str,Element ospf_area: optional...
[ "Add", "a", "loopback", "interface", "as", "a", "cluster", "virtual", "loopback", ".", "This", "enables", "the", "loopback", "to", "float", "between", "cluster", "members", ".", "Changes", "are", "committed", "immediately", ".", ":", "param", "str", "address",...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L528-L547
gabstopper/smc-python
smc/core/sub_interfaces.py
LoopbackInterface.add_single
def add_single(self, address, rank=1, nodeid=1, ospf_area=None, **kwargs): """ Add a single loopback interface to this engine. This is used for single or virtual FW engines. :param str address: ip address for loopback :param int nodeid: nodeid to apply. Default to 1 for ...
python
def add_single(self, address, rank=1, nodeid=1, ospf_area=None, **kwargs): """ Add a single loopback interface to this engine. This is used for single or virtual FW engines. :param str address: ip address for loopback :param int nodeid: nodeid to apply. Default to 1 for ...
[ "def", "add_single", "(", "self", ",", "address", ",", "rank", "=", "1", ",", "nodeid", "=", "1", ",", "ospf_area", "=", "None", ",", "*", "*", "kwargs", ")", ":", "lb", "=", "self", ".", "create", "(", "address", ",", "rank", ",", "nodeid", ",",...
Add a single loopback interface to this engine. This is used for single or virtual FW engines. :param str address: ip address for loopback :param int nodeid: nodeid to apply. Default to 1 for single FW :param str, Element ospf_area: ospf area href or element :raises Upda...
[ "Add", "a", "single", "loopback", "interface", "to", "this", "engine", ".", "This", "is", "used", "for", "single", "or", "virtual", "FW", "engines", ".", ":", "param", "str", "address", ":", "ip", "address", "for", "loopback", ":", "param", "int", "nodei...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L578-L591
gabstopper/smc-python
smc/core/sub_interfaces.py
LoopbackInterface.delete
def delete(self): """ Delete a loopback interface from this engine. Changes to the engine configuration are done immediately. A simple way to obtain an existing loopback is to iterate the loopbacks or to get by address:: lb = engine.loopback_interfac...
python
def delete(self): """ Delete a loopback interface from this engine. Changes to the engine configuration are done immediately. A simple way to obtain an existing loopback is to iterate the loopbacks or to get by address:: lb = engine.loopback_interfac...
[ "def", "delete", "(", "self", ")", ":", "nodes", "=", "[", "]", "for", "node", "in", "self", ".", "_engine", ".", "nodes", ":", "node", ".", "data", "[", "self", ".", "typeof", "]", "=", "[", "lb", "for", "lb", "in", "node", ".", "loopback_node_d...
Delete a loopback interface from this engine. Changes to the engine configuration are done immediately. A simple way to obtain an existing loopback is to iterate the loopbacks or to get by address:: lb = engine.loopback_interface.get('127.0.0.10') lb.del...
[ "Delete", "a", "loopback", "interface", "from", "this", "engine", ".", "Changes", "to", "the", "engine", "configuration", "are", "done", "immediately", ".", "A", "simple", "way", "to", "obtain", "an", "existing", "loopback", "is", "to", "iterate", "the", "lo...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/sub_interfaces.py#L593-L618
gabstopper/smc-python
smc/administration/user_auth/servers.py
ActiveDirectoryServer.create
def create(cls, name, address, base_dn, bind_user_id=None, bind_password=None, port=389, protocol='ldap', tls_profile=None, tls_identity=None, domain_controller=None, supported_method=None, timeout=10, max_search_result=0, page_size=0, internet_auth_service_enabled=False, **kwargs): """ ...
python
def create(cls, name, address, base_dn, bind_user_id=None, bind_password=None, port=389, protocol='ldap', tls_profile=None, tls_identity=None, domain_controller=None, supported_method=None, timeout=10, max_search_result=0, page_size=0, internet_auth_service_enabled=False, **kwargs): """ ...
[ "def", "create", "(", "cls", ",", "name", ",", "address", ",", "base_dn", ",", "bind_user_id", "=", "None", ",", "bind_password", "=", "None", ",", "port", "=", "389", ",", "protocol", "=", "'ldap'", ",", "tls_profile", "=", "None", ",", "tls_identity", ...
Create an AD server element using basic settings. You can also provide additional kwargs documented in the class description:: ActiveDirectoryServer.create(name='somedirectory', address='10.10.10.10', base_dn='dc=domain,dc=net', bind_user_id='...
[ "Create", "an", "AD", "server", "element", "using", "basic", "settings", ".", "You", "can", "also", "provide", "additional", "kwargs", "documented", "in", "the", "class", "description", "::", "ActiveDirectoryServer", ".", "create", "(", "name", "=", "somedirecto...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/user_auth/servers.py#L136-L214
gabstopper/smc-python
smc/administration/user_auth/servers.py
ActiveDirectoryServer.update_or_create
def update_or_create(cls, with_status=False, **kwargs): """ Update or create active directory configuration. :param dict kwargs: kwargs to satisfy the `create` constructor arguments if the element doesn't exist or attributes to change :raises CreateElementFailed: fai...
python
def update_or_create(cls, with_status=False, **kwargs): """ Update or create active directory configuration. :param dict kwargs: kwargs to satisfy the `create` constructor arguments if the element doesn't exist or attributes to change :raises CreateElementFailed: fai...
[ "def", "update_or_create", "(", "cls", ",", "with_status", "=", "False", ",", "*", "*", "kwargs", ")", ":", "element", ",", "updated", ",", "created", "=", "super", "(", "ActiveDirectoryServer", ",", "cls", ")", ".", "update_or_create", "(", "defer_update", ...
Update or create active directory configuration. :param dict kwargs: kwargs to satisfy the `create` constructor arguments if the element doesn't exist or attributes to change :raises CreateElementFailed: failed creating element :return: element instance by type or 3-tuple if...
[ "Update", "or", "create", "active", "directory", "configuration", ".", ":", "param", "dict", "kwargs", ":", "kwargs", "to", "satisfy", "the", "create", "constructor", "arguments", "if", "the", "element", "doesn", "t", "exist", "or", "attributes", "to", "change...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/user_auth/servers.py#L217-L242
gabstopper/smc-python
smc/routing/access_list.py
AccessList.create
def create(cls, name, entries=None, comment=None, **kw): """ Create an Access List Entry. Depending on the access list type you are creating (IPAccessList, IPv6AccessList, IPPrefixList, IPv6PrefixList, CommunityAccessList, ExtendedCommunityAccessList), entries will define a dict...
python
def create(cls, name, entries=None, comment=None, **kw): """ Create an Access List Entry. Depending on the access list type you are creating (IPAccessList, IPv6AccessList, IPPrefixList, IPv6PrefixList, CommunityAccessList, ExtendedCommunityAccessList), entries will define a dict...
[ "def", "create", "(", "cls", ",", "name", ",", "entries", "=", "None", ",", "comment", "=", "None", ",", "*", "*", "kw", ")", ":", "access_list_entry", "=", "[", "]", "if", "entries", ":", "for", "entry", "in", "entries", ":", "access_list_entry", "....
Create an Access List Entry. Depending on the access list type you are creating (IPAccessList, IPv6AccessList, IPPrefixList, IPv6PrefixList, CommunityAccessList, ExtendedCommunityAccessList), entries will define a dict of the valid attributes for that ACL type. Each class has a defined ...
[ "Create", "an", "Access", "List", "Entry", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/access_list.py#L34-L65
gabstopper/smc-python
smc/routing/access_list.py
AccessList.add_entry
def add_entry(self, **kw): """ Add an entry to an AccessList. Use the supported arguments for the inheriting class for keyword arguments. :raises UpdateElementFailed: failure to modify with reason :return: None """ self.data.setdefault('entries', []).append( ...
python
def add_entry(self, **kw): """ Add an entry to an AccessList. Use the supported arguments for the inheriting class for keyword arguments. :raises UpdateElementFailed: failure to modify with reason :return: None """ self.data.setdefault('entries', []).append( ...
[ "def", "add_entry", "(", "self", ",", "*", "*", "kw", ")", ":", "self", ".", "data", ".", "setdefault", "(", "'entries'", ",", "[", "]", ")", ".", "append", "(", "{", "'{}_entry'", ".", "format", "(", "self", ".", "typeof", ")", ":", "kw", "}", ...
Add an entry to an AccessList. Use the supported arguments for the inheriting class for keyword arguments. :raises UpdateElementFailed: failure to modify with reason :return: None
[ "Add", "an", "entry", "to", "an", "AccessList", ".", "Use", "the", "supported", "arguments", "for", "the", "inheriting", "class", "for", "keyword", "arguments", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/access_list.py#L78-L87
gabstopper/smc-python
smc/routing/access_list.py
AccessList.remove_entry
def remove_entry(self, **field_value): """ Remove an AccessList entry by field specified. Use the supported arguments for the inheriting class for keyword arguments. :raises UpdateElementFailed: failed to modify with reason :return: None """ field, value = next(i...
python
def remove_entry(self, **field_value): """ Remove an AccessList entry by field specified. Use the supported arguments for the inheriting class for keyword arguments. :raises UpdateElementFailed: failed to modify with reason :return: None """ field, value = next(i...
[ "def", "remove_entry", "(", "self", ",", "*", "*", "field_value", ")", ":", "field", ",", "value", "=", "next", "(", "iter", "(", "field_value", ".", "items", "(", ")", ")", ")", "self", ".", "data", "[", "'entries'", "]", "[", ":", "]", "=", "["...
Remove an AccessList entry by field specified. Use the supported arguments for the inheriting class for keyword arguments. :raises UpdateElementFailed: failed to modify with reason :return: None
[ "Remove", "an", "AccessList", "entry", "by", "field", "specified", ".", "Use", "the", "supported", "arguments", "for", "the", "inheriting", "class", "for", "keyword", "arguments", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/access_list.py#L89-L101
gabstopper/smc-python
smc/routing/access_list.py
AccessList.update_or_create
def update_or_create(cls, with_status=False, overwrite_existing=False, **kw): """ Update or create the Access List. This method will not attempt to evaluate whether the access list has differences, instead it will update with the contents of the payload entirely. If the intent is ...
python
def update_or_create(cls, with_status=False, overwrite_existing=False, **kw): """ Update or create the Access List. This method will not attempt to evaluate whether the access list has differences, instead it will update with the contents of the payload entirely. If the intent is ...
[ "def", "update_or_create", "(", "cls", ",", "with_status", "=", "False", ",", "overwrite_existing", "=", "False", ",", "*", "*", "kw", ")", ":", "created", "=", "False", "modified", "=", "False", "try", ":", "element", "=", "cls", ".", "get", "(", "kw"...
Update or create the Access List. This method will not attempt to evaluate whether the access list has differences, instead it will update with the contents of the payload entirely. If the intent is to only add or remove a single entry, use `~add_entry` and `~remove_entry` methods. ...
[ "Update", "or", "create", "the", "Access", "List", ".", "This", "method", "will", "not", "attempt", "to", "evaluate", "whether", "the", "access", "list", "has", "differences", "instead", "it", "will", "update", "with", "the", "contents", "of", "the", "payloa...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/access_list.py#L104-L147
gabstopper/smc-python
smc/administration/tasks.py
Task.update_status
def update_status(self): """ Gets the current status of this task and returns a new task object. :raises TaskRunFailed: fail to update task status """ task = self.make_request( TaskRunFailed, href=self.href) return Task(task)
python
def update_status(self): """ Gets the current status of this task and returns a new task object. :raises TaskRunFailed: fail to update task status """ task = self.make_request( TaskRunFailed, href=self.href) return Task(task)
[ "def", "update_status", "(", "self", ")", ":", "task", "=", "self", ".", "make_request", "(", "TaskRunFailed", ",", "href", "=", "self", ".", "href", ")", "return", "Task", "(", "task", ")" ]
Gets the current status of this task and returns a new task object. :raises TaskRunFailed: fail to update task status
[ "Gets", "the", "current", "status", "of", "this", "task", "and", "returns", "a", "new", "task", "object", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/tasks.py#L146-L157
gabstopper/smc-python
smc/administration/tasks.py
Task.execute
def execute(self, resource, **kw): """ Execute the task and return a TaskOperationPoller. :rtype: TaskOperationPoller """ params = kw.pop('params', {}) json = kw.pop('json', None) task = self.make_request( TaskRunFailed, method='cr...
python
def execute(self, resource, **kw): """ Execute the task and return a TaskOperationPoller. :rtype: TaskOperationPoller """ params = kw.pop('params', {}) json = kw.pop('json', None) task = self.make_request( TaskRunFailed, method='cr...
[ "def", "execute", "(", "self", ",", "resource", ",", "*", "*", "kw", ")", ":", "params", "=", "kw", ".", "pop", "(", "'params'", ",", "{", "}", ")", "json", "=", "kw", ".", "pop", "(", "'json'", ",", "None", ")", "task", "=", "self", ".", "ma...
Execute the task and return a TaskOperationPoller. :rtype: TaskOperationPoller
[ "Execute", "the", "task", "and", "return", "a", "TaskOperationPoller", ".", ":", "rtype", ":", "TaskOperationPoller" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/tasks.py#L163-L184
gabstopper/smc-python
smc/administration/tasks.py
Task.download
def download(self, resource, filename, **kw): """ Start and return a Download Task :rtype: DownloadTask(TaskOperationPoller) """ params = kw.pop('params', {}) task = self.make_request( TaskRunFailed, method='create', resource=r...
python
def download(self, resource, filename, **kw): """ Start and return a Download Task :rtype: DownloadTask(TaskOperationPoller) """ params = kw.pop('params', {}) task = self.make_request( TaskRunFailed, method='create', resource=r...
[ "def", "download", "(", "self", ",", "resource", ",", "filename", ",", "*", "*", "kw", ")", ":", "params", "=", "kw", ".", "pop", "(", "'params'", ",", "{", "}", ")", "task", "=", "self", ".", "make_request", "(", "TaskRunFailed", ",", "method", "=...
Start and return a Download Task :rtype: DownloadTask(TaskOperationPoller)
[ "Start", "and", "return", "a", "Download", "Task", ":", "rtype", ":", "DownloadTask", "(", "TaskOperationPoller", ")" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/tasks.py#L187-L201
gabstopper/smc-python
smc/administration/tasks.py
TaskOperationPoller.add_done_callback
def add_done_callback(self, callback): """ Add a callback to run after the task completes. The callable must take 1 argument which will be the completed Task. :param callback: a callable that takes a single argument which will be the completed Task. """ ...
python
def add_done_callback(self, callback): """ Add a callback to run after the task completes. The callable must take 1 argument which will be the completed Task. :param callback: a callable that takes a single argument which will be the completed Task. """ ...
[ "def", "add_done_callback", "(", "self", ",", "callback", ")", ":", "if", "self", ".", "_done", "is", "None", "or", "self", ".", "_done", ".", "is_set", "(", ")", ":", "raise", "ValueError", "(", "'Task has already finished'", ")", "if", "callable", "(", ...
Add a callback to run after the task completes. The callable must take 1 argument which will be the completed Task. :param callback: a callable that takes a single argument which will be the completed Task.
[ "Add", "a", "callback", "to", "run", "after", "the", "task", "completes", ".", "The", "callable", "must", "take", "1", "argument", "which", "will", "be", "the", "completed", "Task", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/tasks.py#L245-L257
gabstopper/smc-python
smc/administration/tasks.py
TaskOperationPoller.wait
def wait(self, timeout=None): """ Blocking wait for task status. """ if self._thread is None: return self._thread.join(timeout=timeout)
python
def wait(self, timeout=None): """ Blocking wait for task status. """ if self._thread is None: return self._thread.join(timeout=timeout)
[ "def", "wait", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "self", ".", "_thread", "is", "None", ":", "return", "self", ".", "_thread", ".", "join", "(", "timeout", "=", "timeout", ")" ]
Blocking wait for task status.
[ "Blocking", "wait", "for", "task", "status", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/tasks.py#L268-L274
gabstopper/smc-python
smc/administration/tasks.py
TaskOperationPoller.last_message
def last_message(self, timeout=5): """ Wait a specified amount of time and return the last message from the task :rtype: str """ if self._thread is not None: self._thread.join(timeout=timeout) return self._task.last_message
python
def last_message(self, timeout=5): """ Wait a specified amount of time and return the last message from the task :rtype: str """ if self._thread is not None: self._thread.join(timeout=timeout) return self._task.last_message
[ "def", "last_message", "(", "self", ",", "timeout", "=", "5", ")", ":", "if", "self", ".", "_thread", "is", "not", "None", ":", "self", ".", "_thread", ".", "join", "(", "timeout", "=", "timeout", ")", "return", "self", ".", "_task", ".", "last_messa...
Wait a specified amount of time and return the last message from the task :rtype: str
[ "Wait", "a", "specified", "amount", "of", "time", "and", "return", "the", "last", "message", "from", "the", "task" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/tasks.py#L276-L285
gabstopper/smc-python
smc/administration/tasks.py
TaskOperationPoller.stop
def stop(self): """ Stop the running task """ if self._thread is not None and self._thread.isAlive(): self._done.set()
python
def stop(self): """ Stop the running task """ if self._thread is not None and self._thread.isAlive(): self._done.set()
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "_thread", "is", "not", "None", "and", "self", ".", "_thread", ".", "isAlive", "(", ")", ":", "self", ".", "_done", ".", "set", "(", ")" ]
Stop the running task
[ "Stop", "the", "running", "task" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/tasks.py#L304-L309
gabstopper/smc-python
smc/administration/access_rights.py
AccessControlList.create
def create(cls, name, granted_element=None): """ Create a new ACL :param str name: Name of ACL :param list granted_elements: Elements to grant access to. Can be engines, policies or other acl's. :type granted_elements: list(str,Element) :raises Create...
python
def create(cls, name, granted_element=None): """ Create a new ACL :param str name: Name of ACL :param list granted_elements: Elements to grant access to. Can be engines, policies or other acl's. :type granted_elements: list(str,Element) :raises Create...
[ "def", "create", "(", "cls", ",", "name", ",", "granted_element", "=", "None", ")", ":", "granted_element", "=", "element_resolver", "(", "granted_element", ")", "json", "=", "{", "'name'", ":", "name", ",", "'granted_element'", ":", "granted_element", "}", ...
Create a new ACL :param str name: Name of ACL :param list granted_elements: Elements to grant access to. Can be engines, policies or other acl's. :type granted_elements: list(str,Element) :raises CreateElementFailed: failed creating ACL :return: instance with...
[ "Create", "a", "new", "ACL", ":", "param", "str", "name", ":", "Name", "of", "ACL", ":", "param", "list", "granted_elements", ":", "Elements", "to", "grant", "access", "to", ".", "Can", "be", "engines", "policies", "or", "other", "acl", "s", ".", ":", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/access_rights.py#L27-L43
gabstopper/smc-python
smc/administration/access_rights.py
AccessControlList.add_permission
def add_permission(self, elements): """ Add permission/s to this ACL. By default this change is committed after the method is called. :param list elements: Elements to grant access to. Can be engines, policies, or other ACLs :type elements: list(str,Element) ...
python
def add_permission(self, elements): """ Add permission/s to this ACL. By default this change is committed after the method is called. :param list elements: Elements to grant access to. Can be engines, policies, or other ACLs :type elements: list(str,Element) ...
[ "def", "add_permission", "(", "self", ",", "elements", ")", ":", "elements", "=", "element_resolver", "(", "elements", ")", "self", ".", "data", "[", "'granted_element'", "]", ".", "extend", "(", "elements", ")", "self", ".", "update", "(", ")" ]
Add permission/s to this ACL. By default this change is committed after the method is called. :param list elements: Elements to grant access to. Can be engines, policies, or other ACLs :type elements: list(str,Element) :raises UpdateElementFailed: Failed updating per...
[ "Add", "permission", "/", "s", "to", "this", "ACL", ".", "By", "default", "this", "change", "is", "committed", "after", "the", "method", "is", "called", ".", ":", "param", "list", "elements", ":", "Elements", "to", "grant", "access", "to", ".", "Can", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/access_rights.py#L55-L68
gabstopper/smc-python
smc/administration/access_rights.py
AccessControlList.remove_permission
def remove_permission(self, elements): """ Remove permission/s to this ACL. Change is committed at end of method call. :param list elements: list of element/s to remove :type elements: list(str,Element) :raises UpdateElementFailed: Failed modifying permission...
python
def remove_permission(self, elements): """ Remove permission/s to this ACL. Change is committed at end of method call. :param list elements: list of element/s to remove :type elements: list(str,Element) :raises UpdateElementFailed: Failed modifying permission...
[ "def", "remove_permission", "(", "self", ",", "elements", ")", ":", "elements", "=", "element_resolver", "(", "elements", ")", "for", "element", "in", "elements", ":", "if", "element", "in", "self", ".", "granted_element", ":", "self", ".", "data", "[", "'...
Remove permission/s to this ACL. Change is committed at end of method call. :param list elements: list of element/s to remove :type elements: list(str,Element) :raises UpdateElementFailed: Failed modifying permissions :return: None
[ "Remove", "permission", "/", "s", "to", "this", "ACL", ".", "Change", "is", "committed", "at", "end", "of", "method", "call", ".", ":", "param", "list", "elements", ":", "list", "of", "element", "/", "s", "to", "remove", ":", "type", "elements", ":", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/access_rights.py#L70-L84
gabstopper/smc-python
smc/administration/access_rights.py
Permission.create
def create(cls, elements, role, domain=None): """ Create a permission. :param list granted_elements: Elements for this permission. Can be engines, policies or ACLs :type granted_elements: list(str,Element) :param str,Role role: role for this permission ...
python
def create(cls, elements, role, domain=None): """ Create a permission. :param list granted_elements: Elements for this permission. Can be engines, policies or ACLs :type granted_elements: list(str,Element) :param str,Role role: role for this permission ...
[ "def", "create", "(", "cls", ",", "elements", ",", "role", ",", "domain", "=", "None", ")", ":", "if", "not", "domain", ":", "domain", "=", "AdminDomain", "(", "'Shared Domain'", ")", "return", "Permission", "(", "granted_elements", "=", "elements", ",", ...
Create a permission. :param list granted_elements: Elements for this permission. Can be engines, policies or ACLs :type granted_elements: list(str,Element) :param str,Role role: role for this permission :param str,Element domain: domain to apply (default: Shared Doma...
[ "Create", "a", "permission", ".", ":", "param", "list", "granted_elements", ":", "Elements", "for", "this", "permission", ".", "Can", "be", "engines", "policies", "or", "ACLs", ":", "type", "granted_elements", ":", "list", "(", "str", "Element", ")", ":", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/access_rights.py#L111-L126
gabstopper/smc-python
smc/base/util.py
save_to_file
def save_to_file(filename, content): """ Save content to file. Used by node initial contact but can be used anywhere. :param str filename: name of file to save to :param str content: content to save :return: None :raises IOError: permissions issue saving, invalid directory, etc """ ...
python
def save_to_file(filename, content): """ Save content to file. Used by node initial contact but can be used anywhere. :param str filename: name of file to save to :param str content: content to save :return: None :raises IOError: permissions issue saving, invalid directory, etc """ ...
[ "def", "save_to_file", "(", "filename", ",", "content", ")", ":", "import", "os", ".", "path", "path", "=", "os", ".", "path", ".", "abspath", "(", "filename", ")", "with", "open", "(", "path", ",", "\"w\"", ")", "as", "text_file", ":", "text_file", ...
Save content to file. Used by node initial contact but can be used anywhere. :param str filename: name of file to save to :param str content: content to save :return: None :raises IOError: permissions issue saving, invalid directory, etc
[ "Save", "content", "to", "file", ".", "Used", "by", "node", "initial", "contact", "but", "can", "be", "used", "anywhere", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/util.py#L55-L68
gabstopper/smc-python
smc/base/util.py
element_resolver
def element_resolver(elements, do_raise=True): """ Element resolver takes either a single class instance or a list of elements to resolve the href. It does not assume a specific interface, instead if it's a class, it just needs an 'href' attribute that should hold the http url for the resource. ...
python
def element_resolver(elements, do_raise=True): """ Element resolver takes either a single class instance or a list of elements to resolve the href. It does not assume a specific interface, instead if it's a class, it just needs an 'href' attribute that should hold the http url for the resource. ...
[ "def", "element_resolver", "(", "elements", ",", "do_raise", "=", "True", ")", ":", "if", "isinstance", "(", "elements", ",", "list", ")", ":", "e", "=", "[", "]", "for", "element", "in", "elements", ":", "try", ":", "e", ".", "append", "(", "element...
Element resolver takes either a single class instance or a list of elements to resolve the href. It does not assume a specific interface, instead if it's a class, it just needs an 'href' attribute that should hold the http url for the resource. If a list is provided, a list is returned. If you want ...
[ "Element", "resolver", "takes", "either", "a", "single", "class", "instance", "or", "a", "list", "of", "elements", "to", "resolve", "the", "href", ".", "It", "does", "not", "assume", "a", "specific", "interface", "instead", "if", "it", "s", "a", "class", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/util.py#L71-L103
gabstopper/smc-python
smc/base/util.py
merge_dicts
def merge_dicts(dict1, dict2, append_lists=False): """ Merge the second dict into the first Not intended to merge list of dicts. :param append_lists: If true, instead of clobbering a list with the new value, append all of the new values onto the original list. """ for key in dict2: ...
python
def merge_dicts(dict1, dict2, append_lists=False): """ Merge the second dict into the first Not intended to merge list of dicts. :param append_lists: If true, instead of clobbering a list with the new value, append all of the new values onto the original list. """ for key in dict2: ...
[ "def", "merge_dicts", "(", "dict1", ",", "dict2", ",", "append_lists", "=", "False", ")", ":", "for", "key", "in", "dict2", ":", "if", "isinstance", "(", "dict2", "[", "key", "]", ",", "dict", ")", ":", "if", "key", "in", "dict1", "and", "key", "in...
Merge the second dict into the first Not intended to merge list of dicts. :param append_lists: If true, instead of clobbering a list with the new value, append all of the new values onto the original list.
[ "Merge", "the", "second", "dict", "into", "the", "first", "Not", "intended", "to", "merge", "list", "of", "dicts", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/util.py#L106-L131
gabstopper/smc-python
smc/base/util.py
unicode_to_bytes
def unicode_to_bytes(s, encoding='utf-8', errors='replace'): """ Helper to convert unicode strings to bytes for data that needs to be written to on output stream (i.e. terminal) For Python 3 this should be called str_to_bytes :param str s: string to encode :param str encoding: utf-8 by default ...
python
def unicode_to_bytes(s, encoding='utf-8', errors='replace'): """ Helper to convert unicode strings to bytes for data that needs to be written to on output stream (i.e. terminal) For Python 3 this should be called str_to_bytes :param str s: string to encode :param str encoding: utf-8 by default ...
[ "def", "unicode_to_bytes", "(", "s", ",", "encoding", "=", "'utf-8'", ",", "errors", "=", "'replace'", ")", ":", "return", "s", "if", "isinstance", "(", "s", ",", "str", ")", "else", "s", ".", "encode", "(", "encoding", ",", "errors", ")" ]
Helper to convert unicode strings to bytes for data that needs to be written to on output stream (i.e. terminal) For Python 3 this should be called str_to_bytes :param str s: string to encode :param str encoding: utf-8 by default :param str errors: what to do when encoding fails :return: byte s...
[ "Helper", "to", "convert", "unicode", "strings", "to", "bytes", "for", "data", "that", "needs", "to", "be", "written", "to", "on", "output", "stream", "(", "i", ".", "e", ".", "terminal", ")", "For", "Python", "3", "this", "should", "be", "called", "st...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/util.py#L134-L145
gabstopper/smc-python
smc/base/util.py
b64encode
def b64encode(source): """ Base64 encoding for python 2 and 3 :rtype: base64 content """ if compat.PY3: source = source.encode('utf-8') return base64.b64encode(source).decode('utf-8')
python
def b64encode(source): """ Base64 encoding for python 2 and 3 :rtype: base64 content """ if compat.PY3: source = source.encode('utf-8') return base64.b64encode(source).decode('utf-8')
[ "def", "b64encode", "(", "source", ")", ":", "if", "compat", ".", "PY3", ":", "source", "=", "source", ".", "encode", "(", "'utf-8'", ")", "return", "base64", ".", "b64encode", "(", "source", ")", ".", "decode", "(", "'utf-8'", ")" ]
Base64 encoding for python 2 and 3 :rtype: base64 content
[ "Base64", "encoding", "for", "python", "2", "and", "3", ":", "rtype", ":", "base64", "content" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/util.py#L148-L156
gabstopper/smc-python
smc/base/util.py
bytes_to_unicode
def bytes_to_unicode(s, encoding='utf-8', errors='replace'): """ Helper to convert byte string to unicode string for user based input :param str s: string to decode :param str encoding: utf-8 by default :param str errors: what to do when decoding fails :return: unicode utf-8 string """ ...
python
def bytes_to_unicode(s, encoding='utf-8', errors='replace'): """ Helper to convert byte string to unicode string for user based input :param str s: string to decode :param str encoding: utf-8 by default :param str errors: what to do when decoding fails :return: unicode utf-8 string """ ...
[ "def", "bytes_to_unicode", "(", "s", ",", "encoding", "=", "'utf-8'", ",", "errors", "=", "'replace'", ")", ":", "if", "compat", ".", "PY3", ":", "return", "str", "(", "s", ",", "'utf-8'", ")", "if", "isinstance", "(", "s", ",", "bytes", ")", "else",...
Helper to convert byte string to unicode string for user based input :param str s: string to decode :param str encoding: utf-8 by default :param str errors: what to do when decoding fails :return: unicode utf-8 string
[ "Helper", "to", "convert", "byte", "string", "to", "unicode", "string", "for", "user", "based", "input" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/util.py#L159-L170
gabstopper/smc-python
smc/base/collection.py
create_collection
def create_collection(href, cls): """ This collection type inserts a ``create`` method into the collection. This will proxy to the sub elements create method while restricting access to other attributes that wouldn't be initialized yet. .. py:method:: create(...) Create method is inser...
python
def create_collection(href, cls): """ This collection type inserts a ``create`` method into the collection. This will proxy to the sub elements create method while restricting access to other attributes that wouldn't be initialized yet. .. py:method:: create(...) Create method is inser...
[ "def", "create_collection", "(", "href", ",", "cls", ")", ":", "instance", "=", "cls", "(", "href", "=", "href", ")", "meth", "=", "getattr", "(", "instance", ",", "'create'", ")", "return", "type", "(", "cls", ".", "__name__", ",", "(", "SubElementCol...
This collection type inserts a ``create`` method into the collection. This will proxy to the sub elements create method while restricting access to other attributes that wouldn't be initialized yet. .. py:method:: create(...) Create method is inserted dynamically for the collection class type....
[ "This", "collection", "type", "inserts", "a", "create", "method", "into", "the", "collection", ".", "This", "will", "proxy", "to", "the", "sub", "elements", "create", "method", "while", "restricting", "access", "to", "other", "attributes", "that", "wouldn", "t...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L266-L282
gabstopper/smc-python
smc/base/collection.py
rule_collection
def rule_collection(href, cls): """ Rule collections insert a ``create`` and ``create_rule_section`` method into the collection. This collection type is returned when accessing rules through a reference, as:: policy = FirewallPolicy('mypolicy') policy.fw_ipv4_access_rules.create(....) ...
python
def rule_collection(href, cls): """ Rule collections insert a ``create`` and ``create_rule_section`` method into the collection. This collection type is returned when accessing rules through a reference, as:: policy = FirewallPolicy('mypolicy') policy.fw_ipv4_access_rules.create(....) ...
[ "def", "rule_collection", "(", "href", ",", "cls", ")", ":", "instance", "=", "cls", "(", "href", "=", "href", ")", "meth", "=", "getattr", "(", "instance", ",", "'create'", ")", "return", "type", "(", "cls", ".", "__name__", ",", "(", "SubElementColle...
Rule collections insert a ``create`` and ``create_rule_section`` method into the collection. This collection type is returned when accessing rules through a reference, as:: policy = FirewallPolicy('mypolicy') policy.fw_ipv4_access_rules.create(....) policy.fw_ipv4_access_rules.create_ru...
[ "Rule", "collections", "insert", "a", "create", "and", "create_rule_section", "method", "into", "the", "collection", ".", "This", "collection", "type", "is", "returned", "when", "accessing", "rules", "through", "a", "reference", "as", "::" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L285-L306
gabstopper/smc-python
smc/base/collection.py
_strip_metachars
def _strip_metachars(val): """ When a filter uses a / or - in the search, only the elements name and comment field is searched. This can cause issues if searching a network element, i.e. 1.1.1.0/24 where the /24 portion is not present in the name and only the elements ipv4_network attribute. If ...
python
def _strip_metachars(val): """ When a filter uses a / or - in the search, only the elements name and comment field is searched. This can cause issues if searching a network element, i.e. 1.1.1.0/24 where the /24 portion is not present in the name and only the elements ipv4_network attribute. If ...
[ "def", "_strip_metachars", "(", "val", ")", ":", "ignore_metachar", "=", "r'(.+)([/-].+)'", "match", "=", "re", ".", "search", "(", "ignore_metachar", ",", "str", "(", "val", ")", ")", "if", "match", ":", "left_half", "=", "match", ".", "group", "(", "1"...
When a filter uses a / or - in the search, only the elements name and comment field is searched. This can cause issues if searching a network element, i.e. 1.1.1.0/24 where the /24 portion is not present in the name and only the elements ipv4_network attribute. If exact_match is not specified, strip off...
[ "When", "a", "filter", "uses", "a", "/", "or", "-", "in", "the", "search", "only", "the", "elements", "name", "and", "comment", "field", "is", "searched", ".", "This", "can", "cause", "issues", "if", "searching", "a", "network", "element", "i", ".", "e...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L309-L324
gabstopper/smc-python
smc/base/collection.py
SubElementCollection.get
def get(self, index): """ Get the element by index. If index is out of bounds for the internal list, None is returned. Indexes cannot be negative. :param int index: retrieve element by positive index in list :rtype: SubElement or None """ if self ...
python
def get(self, index): """ Get the element by index. If index is out of bounds for the internal list, None is returned. Indexes cannot be negative. :param int index: retrieve element by positive index in list :rtype: SubElement or None """ if self ...
[ "def", "get", "(", "self", ",", "index", ")", ":", "if", "self", "and", "(", "index", "<=", "len", "(", "self", ")", "-", "1", ")", ":", "return", "self", ".", "_result_cache", "[", "index", "]" ]
Get the element by index. If index is out of bounds for the internal list, None is returned. Indexes cannot be negative. :param int index: retrieve element by positive index in list :rtype: SubElement or None
[ "Get", "the", "element", "by", "index", ".", "If", "index", "is", "out", "of", "bounds", "for", "the", "internal", "list", "None", "is", "returned", ".", "Indexes", "cannot", "be", "negative", ".", ":", "param", "int", "index", ":", "retrieve", "element"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L116-L126