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/base/collection.py
SubElementCollection.get_contains
def get_contains(self, value, case_sensitive=True): """ A partial match on the name field. Does an `in` comparsion to elements by the meta `name` field. Sub elements created by SMC will generally have a descriptive name that helps to identify their purpose. Returns only the first...
python
def get_contains(self, value, case_sensitive=True): """ A partial match on the name field. Does an `in` comparsion to elements by the meta `name` field. Sub elements created by SMC will generally have a descriptive name that helps to identify their purpose. Returns only the first...
[ "def", "get_contains", "(", "self", ",", "value", ",", "case_sensitive", "=", "True", ")", ":", "for", "element", "in", "self", ":", "if", "not", "case_sensitive", ":", "if", "value", ".", "lower", "(", ")", "in", "element", ".", "name", ".", "lower", ...
A partial match on the name field. Does an `in` comparsion to elements by the meta `name` field. Sub elements created by SMC will generally have a descriptive name that helps to identify their purpose. Returns only the first entry matched even if there are multiple. .. s...
[ "A", "partial", "match", "on", "the", "name", "field", ".", "Does", "an", "in", "comparsion", "to", "elements", "by", "the", "meta", "name", "field", ".", "Sub", "elements", "created", "by", "SMC", "will", "generally", "have", "a", "descriptive", "name", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L144-L164
gabstopper/smc-python
smc/base/collection.py
SubElementCollection.get_all_contains
def get_all_contains(self, value, case_sensitive=True): """ A partial match on the name field. Does an `in` comparsion to elements by the meta `name` field. Returns all elements that match the specified value. .. seealso:: :meth:`get_contains` for returning only a single...
python
def get_all_contains(self, value, case_sensitive=True): """ A partial match on the name field. Does an `in` comparsion to elements by the meta `name` field. Returns all elements that match the specified value. .. seealso:: :meth:`get_contains` for returning only a single...
[ "def", "get_all_contains", "(", "self", ",", "value", ",", "case_sensitive", "=", "True", ")", ":", "elements", "=", "[", "]", "for", "element", "in", "self", ":", "if", "not", "case_sensitive", ":", "if", "value", ".", "lower", "(", ")", "in", "elemen...
A partial match on the name field. Does an `in` comparsion to elements by the meta `name` field. Returns all elements that match the specified value. .. seealso:: :meth:`get_contains` for returning only a single item. :param str value: searchable string for contains mat...
[ "A", "partial", "match", "on", "the", "name", "field", ".", "Does", "an", "in", "comparsion", "to", "elements", "by", "the", "meta", "name", "field", ".", "Returns", "all", "elements", "that", "match", "the", "specified", "value", ".", "..", "seealso", "...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L166-L187
gabstopper/smc-python
smc/base/collection.py
ElementCollection._clone
def _clone(self, **kwargs): """ Create a clone of this collection. The only param in the initial collection is the filter context. Each chainable filter is added to the clone and returned to preserve previous iterators and their returned elements. :return: :class...
python
def _clone(self, **kwargs): """ Create a clone of this collection. The only param in the initial collection is the filter context. Each chainable filter is added to the clone and returned to preserve previous iterators and their returned elements. :return: :class...
[ "def", "_clone", "(", "self", ",", "*", "*", "kwargs", ")", ":", "params", "=", "copy", ".", "deepcopy", "(", "self", ".", "_params", ")", "if", "self", ".", "_iexact", ":", "params", ".", "update", "(", "iexact", "=", "self", ".", "_iexact", ")", ...
Create a clone of this collection. The only param in the initial collection is the filter context. Each chainable filter is added to the clone and returned to preserve previous iterators and their returned elements. :return: :class:`.ElementCollection`
[ "Create", "a", "clone", "of", "this", "collection", ".", "The", "only", "param", "in", "the", "initial", "collection", "is", "the", "filter", "context", ".", "Each", "chainable", "filter", "is", "added", "to", "the", "clone", "and", "returned", "to", "pres...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L437-L451
gabstopper/smc-python
smc/base/collection.py
ElementCollection.filter
def filter(self, *filter, **kw): # @ReservedAssignment """ Filter results for specific element type. keyword arguments can be used to specify a match against the elements attribute directly. It's important to note that if the search filter contains a / or -, the SMC...
python
def filter(self, *filter, **kw): # @ReservedAssignment """ Filter results for specific element type. keyword arguments can be used to specify a match against the elements attribute directly. It's important to note that if the search filter contains a / or -, the SMC...
[ "def", "filter", "(", "self", ",", "*", "filter", ",", "*", "*", "kw", ")", ":", "# @ReservedAssignment", "iexact", "=", "None", "if", "filter", ":", "_filter", "=", "filter", "[", "0", "]", "exact_match", "=", "kw", ".", "pop", "(", "'exact_match'", ...
Filter results for specific element type. keyword arguments can be used to specify a match against the elements attribute directly. It's important to note that if the search filter contains a / or -, the SMC will only search the name and comment fields. Otherwise other key f...
[ "Filter", "results", "for", "specific", "element", "type", ".", "keyword", "arguments", "can", "be", "used", "to", "specify", "a", "match", "against", "the", "elements", "attribute", "directly", ".", "It", "s", "important", "to", "note", "that", "if", "the",...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L472-L522
gabstopper/smc-python
smc/base/collection.py
ElementCollection.batch
def batch(self, num): """ Iterator returning results in batches. When making more general queries that might have larger results, specify a batch result that should be returned with each iteration. :param int num: number of results per iteration :return: iterator...
python
def batch(self, num): """ Iterator returning results in batches. When making more general queries that might have larger results, specify a batch result that should be returned with each iteration. :param int num: number of results per iteration :return: iterator...
[ "def", "batch", "(", "self", ",", "num", ")", ":", "self", ".", "_params", ".", "pop", "(", "'limit'", ",", "None", ")", "# Limit and batch are mutually exclusive", "it", "=", "iter", "(", "self", ")", "while", "True", ":", "chunk", "=", "list", "(", "...
Iterator returning results in batches. When making more general queries that might have larger results, specify a batch result that should be returned with each iteration. :param int num: number of results per iteration :return: iterator holding list of results
[ "Iterator", "returning", "results", "in", "batches", ".", "When", "making", "more", "general", "queries", "that", "might", "have", "larger", "results", "specify", "a", "batch", "result", "that", "should", "be", "returned", "with", "each", "iteration", ".", ":"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L524-L539
gabstopper/smc-python
smc/base/collection.py
ElementCollection.first
def first(self): """ Returns the first object matched or None if there is no matching object. :: >>> iterator = Host.objects.iterator() >>> c = iterator.filter('kali') >>> if c.exists(): >>> print(c.count()) ...
python
def first(self): """ Returns the first object matched or None if there is no matching object. :: >>> iterator = Host.objects.iterator() >>> c = iterator.filter('kali') >>> if c.exists(): >>> print(c.count()) ...
[ "def", "first", "(", "self", ")", ":", "if", "len", "(", "self", ")", ":", "self", ".", "_params", ".", "update", "(", "limit", "=", "1", ")", "if", "'filter'", "not", "in", "self", ".", "_params", ":", "return", "list", "(", "self", ")", "[", ...
Returns the first object matched or None if there is no matching object. :: >>> iterator = Host.objects.iterator() >>> c = iterator.filter('kali') >>> if c.exists(): >>> print(c.count()) >>> print(c.first()) 7...
[ "Returns", "the", "first", "object", "matched", "or", "None", "if", "there", "is", "no", "matching", "object", ".", "::", ">>>", "iterator", "=", "Host", ".", "objects", ".", "iterator", "()", ">>>", "c", "=", "iterator", ".", "filter", "(", "kali", ")...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L541-L570
gabstopper/smc-python
smc/base/collection.py
ElementCollection.last
def last(self): """ Returns the last object matched or None if there is no matching object. :: >>> iterator = Host.objects.iterator() >>> c = iterator.filter('kali') >>> if c.exists(): >>> print(c.last()) Hos...
python
def last(self): """ Returns the last object matched or None if there is no matching object. :: >>> iterator = Host.objects.iterator() >>> c = iterator.filter('kali') >>> if c.exists(): >>> print(c.last()) Hos...
[ "def", "last", "(", "self", ")", ":", "if", "len", "(", "self", ")", ":", "self", ".", "_params", ".", "update", "(", "limit", "=", "1", ")", "if", "'filter'", "not", "in", "self", ".", "_params", ":", "return", "list", "(", "self", ")", "[", "...
Returns the last object matched or None if there is no matching object. :: >>> iterator = Host.objects.iterator() >>> c = iterator.filter('kali') >>> if c.exists(): >>> print(c.last()) Host(name=kali-foo) :r...
[ "Returns", "the", "last", "object", "matched", "or", "None", "if", "there", "is", "no", "matching", "object", ".", "::", ">>>", "iterator", "=", "Host", ".", "objects", ".", "iterator", "()", ">>>", "c", "=", "iterator", ".", "filter", "(", "kali", ")"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L572-L593
gabstopper/smc-python
smc/base/collection.py
CollectionManager.iterator
def iterator(self, **kwargs): """ Return an iterator from the collection manager. The iterator can be re-used to chain together filters, each chaining event will be it's own unique element collection. :return: :class:`ElementCollection` """ cls_name = '{0}Collect...
python
def iterator(self, **kwargs): """ Return an iterator from the collection manager. The iterator can be re-used to chain together filters, each chaining event will be it's own unique element collection. :return: :class:`ElementCollection` """ cls_name = '{0}Collect...
[ "def", "iterator", "(", "self", ",", "*", "*", "kwargs", ")", ":", "cls_name", "=", "'{0}Collection'", ".", "format", "(", "self", ".", "_cls", ".", "__name__", ")", "collection_cls", "=", "type", "(", "str", "(", "cls_name", ")", ",", "(", "ElementCol...
Return an iterator from the collection manager. The iterator can be re-used to chain together filters, each chaining event will be it's own unique element collection. :return: :class:`ElementCollection`
[ "Return", "an", "iterator", "from", "the", "collection", "manager", ".", "The", "iterator", "can", "be", "re", "-", "used", "to", "chain", "together", "filters", "each", "chaining", "event", "will", "be", "it", "s", "own", "unique", "element", "collection", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L654-L667
gabstopper/smc-python
smc/base/collection.py
Search.entry_point
def entry_point(self, entry_point): """ Provide an entry point for element types to search. :param str entry_point: valid entry point. Use `~object_types()` to find all available entry points. """ if len(entry_point.split(',')) == 1: self._params....
python
def entry_point(self, entry_point): """ Provide an entry point for element types to search. :param str entry_point: valid entry point. Use `~object_types()` to find all available entry points. """ if len(entry_point.split(',')) == 1: self._params....
[ "def", "entry_point", "(", "self", ",", "entry_point", ")", ":", "if", "len", "(", "entry_point", ".", "split", "(", "','", ")", ")", "==", "1", ":", "self", ".", "_params", ".", "update", "(", "href", "=", "self", ".", "_resource", ".", "get", "("...
Provide an entry point for element types to search. :param str entry_point: valid entry point. Use `~object_types()` to find all available entry points.
[ "Provide", "an", "entry", "point", "for", "element", "types", "to", "search", ".", ":", "param", "str", "entry_point", ":", "valid", "entry", "point", ".", "Use", "~object_types", "()", "to", "find", "all", "available", "entry", "points", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L769-L783
gabstopper/smc-python
smc/base/collection.py
Search.context_filter
def context_filter(self, context): """ Provide a context filter to search. :param str context: Context filter by name """ if context in CONTEXTS: self._params.update(filter_context=context) return self raise InvalidSearchFilter( ...
python
def context_filter(self, context): """ Provide a context filter to search. :param str context: Context filter by name """ if context in CONTEXTS: self._params.update(filter_context=context) return self raise InvalidSearchFilter( ...
[ "def", "context_filter", "(", "self", ",", "context", ")", ":", "if", "context", "in", "CONTEXTS", ":", "self", ".", "_params", ".", "update", "(", "filter_context", "=", "context", ")", "return", "self", "raise", "InvalidSearchFilter", "(", "'Context filter %...
Provide a context filter to search. :param str context: Context filter by name
[ "Provide", "a", "context", "filter", "to", "search", ".", ":", "param", "str", "context", ":", "Context", "filter", "by", "name" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L785-L796
gabstopper/smc-python
smc/base/collection.py
Search.unused
def unused(self): """ Return unused user-created elements. :rtype: list(Element) """ self._params.update( href=self._resource.get('search_unused')) return self
python
def unused(self): """ Return unused user-created elements. :rtype: list(Element) """ self._params.update( href=self._resource.get('search_unused')) return self
[ "def", "unused", "(", "self", ")", ":", "self", ".", "_params", ".", "update", "(", "href", "=", "self", ".", "_resource", ".", "get", "(", "'search_unused'", ")", ")", "return", "self" ]
Return unused user-created elements. :rtype: list(Element)
[ "Return", "unused", "user", "-", "created", "elements", ".", ":", "rtype", ":", "list", "(", "Element", ")" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L798-L806
gabstopper/smc-python
smc/base/collection.py
Search.duplicates
def duplicates(self): """ Return duplicate user-created elements. :rtype: list(Element) """ self._params.update( href=self._resource.get('search_duplicate')) return self
python
def duplicates(self): """ Return duplicate user-created elements. :rtype: list(Element) """ self._params.update( href=self._resource.get('search_duplicate')) return self
[ "def", "duplicates", "(", "self", ")", ":", "self", ".", "_params", ".", "update", "(", "href", "=", "self", ".", "_resource", ".", "get", "(", "'search_duplicate'", ")", ")", "return", "self" ]
Return duplicate user-created elements. :rtype: list(Element)
[ "Return", "duplicate", "user", "-", "created", "elements", ".", ":", "rtype", ":", "list", "(", "Element", ")" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L808-L816
gabstopper/smc-python
smc/base/collection.py
Search.object_types
def object_types(): """ Show all available 'entry points' available for searching. An entry point defines a uri that provides unfiltered access to all elements of the entry point type. :return: list of entry points by name :rtype: list(str) """ # Return a...
python
def object_types(): """ Show all available 'entry points' available for searching. An entry point defines a uri that provides unfiltered access to all elements of the entry point type. :return: list of entry points by name :rtype: list(str) """ # Return a...
[ "def", "object_types", "(", ")", ":", "# Return all elements from the root of the API nested under elements URI", "#element_uri = str(", "types", "=", "[", "element", ".", "rel", "for", "element", "in", "entry_point", "(", ")", "]", "types", ".", "extend", "(", "list"...
Show all available 'entry points' available for searching. An entry point defines a uri that provides unfiltered access to all elements of the entry point type. :return: list of entry points by name :rtype: list(str)
[ "Show", "all", "available", "entry", "points", "available", "for", "searching", ".", "An", "entry", "point", "defines", "a", "uri", "that", "provides", "unfiltered", "access", "to", "all", "elements", "of", "the", "entry", "point", "type", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L819-L833
gabstopper/smc-python
smc-monitoring/smc_monitoring/monitors/connections.py
ConnectionQuery.fetch_as_element
def fetch_as_element(self, **kw): """ Fetch the results and return as a Connection element. The original query is not modified. :return: generator of elements :rtype: :class:`.Connection` """ clone = self.copy() clone.format.field_format('id') ...
python
def fetch_as_element(self, **kw): """ Fetch the results and return as a Connection element. The original query is not modified. :return: generator of elements :rtype: :class:`.Connection` """ clone = self.copy() clone.format.field_format('id') ...
[ "def", "fetch_as_element", "(", "self", ",", "*", "*", "kw", ")", ":", "clone", "=", "self", ".", "copy", "(", ")", "clone", ".", "format", ".", "field_format", "(", "'id'", ")", "for", "custom_field", "in", "[", "'field_ids'", ",", "'field_names'", "]...
Fetch the results and return as a Connection element. The original query is not modified. :return: generator of elements :rtype: :class:`.Connection`
[ "Fetch", "the", "results", "and", "return", "as", "a", "Connection", "element", ".", "The", "original", "query", "is", "not", "modified", ".", ":", "return", ":", "generator", "of", "elements", ":", "rtype", ":", ":", "class", ":", ".", "Connection" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/monitors/connections.py#L70-L85
gabstopper/smc-python
smc/examples/ospf_routing.py
create_ospf_area_with_message_digest_auth
def create_ospf_area_with_message_digest_auth(): """ If you require message-digest authentication for your OSPFArea, you must create an OSPF key chain configuration. """ OSPFKeyChain.create(name='secure-keychain', key_chain_entry=[{'key': 'fookey', ...
python
def create_ospf_area_with_message_digest_auth(): """ If you require message-digest authentication for your OSPFArea, you must create an OSPF key chain configuration. """ OSPFKeyChain.create(name='secure-keychain', key_chain_entry=[{'key': 'fookey', ...
[ "def", "create_ospf_area_with_message_digest_auth", "(", ")", ":", "OSPFKeyChain", ".", "create", "(", "name", "=", "'secure-keychain'", ",", "key_chain_entry", "=", "[", "{", "'key'", ":", "'fookey'", ",", "'key_id'", ":", "10", ",", "'send_key'", ":", "True", ...
If you require message-digest authentication for your OSPFArea, you must create an OSPF key chain configuration.
[ "If", "you", "require", "message", "-", "digest", "authentication", "for", "your", "OSPFArea", "you", "must", "create", "an", "OSPF", "key", "chain", "configuration", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/examples/ospf_routing.py#L25-L57
gabstopper/smc-python
smc/examples/ospf_routing.py
create_ospf_profile
def create_ospf_profile(): """ An OSPF Profile contains administrative distance and redistribution settings. An OSPF Profile is applied at the engine level. When creating an OSPF Profile, you must reference a OSPFDomainSetting. An OSPFDomainSetting holds the settings of the area border router (AB...
python
def create_ospf_profile(): """ An OSPF Profile contains administrative distance and redistribution settings. An OSPF Profile is applied at the engine level. When creating an OSPF Profile, you must reference a OSPFDomainSetting. An OSPFDomainSetting holds the settings of the area border router (AB...
[ "def", "create_ospf_profile", "(", ")", ":", "OSPFDomainSetting", ".", "create", "(", "name", "=", "'custom'", ",", "abr_type", "=", "'cisco'", ")", "ospf_domain", "=", "OSPFDomainSetting", "(", "'custom'", ")", "# obtain resource", "ospf_profile", "=", "OSPFProfi...
An OSPF Profile contains administrative distance and redistribution settings. An OSPF Profile is applied at the engine level. When creating an OSPF Profile, you must reference a OSPFDomainSetting. An OSPFDomainSetting holds the settings of the area border router (ABR) type, throttle timer settings, ...
[ "An", "OSPF", "Profile", "contains", "administrative", "distance", "and", "redistribution", "settings", ".", "An", "OSPF", "Profile", "is", "applied", "at", "the", "engine", "level", ".", "When", "creating", "an", "OSPF", "Profile", "you", "must", "reference", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/examples/ospf_routing.py#L60-L77
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/formats.py
TextFormat.timezone
def timezone(self, tz): """ Set timezone on the audit records. Timezone can be in formats: 'US/Eastern', 'PST', 'Europe/Helsinki' See SMC Log Viewer settings for more examples. :param str tz: timezone, i.e. CST """ self.data['resolving'].update( ...
python
def timezone(self, tz): """ Set timezone on the audit records. Timezone can be in formats: 'US/Eastern', 'PST', 'Europe/Helsinki' See SMC Log Viewer settings for more examples. :param str tz: timezone, i.e. CST """ self.data['resolving'].update( ...
[ "def", "timezone", "(", "self", ",", "tz", ")", ":", "self", ".", "data", "[", "'resolving'", "]", ".", "update", "(", "timezone", "=", "tz", ",", "time_show_zone", "=", "True", ")" ]
Set timezone on the audit records. Timezone can be in formats: 'US/Eastern', 'PST', 'Europe/Helsinki' See SMC Log Viewer settings for more examples. :param str tz: timezone, i.e. CST
[ "Set", "timezone", "on", "the", "audit", "records", ".", "Timezone", "can", "be", "in", "formats", ":", "US", "/", "Eastern", "PST", "Europe", "/", "Helsinki", "See", "SMC", "Log", "Viewer", "settings", "for", "more", "examples", ".", ":", "param", "str"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/formats.py#L88-L99
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/formats.py
TextFormat.set_resolving
def set_resolving(self, **kw): """ Certain log fields can be individually resolved. Use this method to set these fields. Valid keyword arguments: :param str timezone: string value to set timezone for audits :param bool time_show_zone: show the time zone in the audit. ...
python
def set_resolving(self, **kw): """ Certain log fields can be individually resolved. Use this method to set these fields. Valid keyword arguments: :param str timezone: string value to set timezone for audits :param bool time_show_zone: show the time zone in the audit. ...
[ "def", "set_resolving", "(", "self", ",", "*", "*", "kw", ")", ":", "if", "'timezone'", "in", "kw", "and", "'time_show_zone'", "not", "in", "kw", ":", "kw", ".", "update", "(", "time_show_zone", "=", "True", ")", "self", ".", "data", "[", "'resolving'"...
Certain log fields can be individually resolved. Use this method to set these fields. Valid keyword arguments: :param str timezone: string value to set timezone for audits :param bool time_show_zone: show the time zone in the audit. :param bool time_show_millis: show timezone in...
[ "Certain", "log", "fields", "can", "be", "individually", "resolved", ".", "Use", "this", "method", "to", "set", "these", "fields", ".", "Valid", "keyword", "arguments", ":", ":", "param", "str", "timezone", ":", "string", "value", "to", "set", "timezone", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/formats.py#L101-L116
gabstopper/smc-python
smc-monitoring/smc_monitoring/monitors/logs.py
LogQuery.fetch_raw
def fetch_raw(self): """ Execute the query and return by batches. Optional keyword arguments are passed to Query.execute(). Whether this is real-time or stored logs is dependent on the value of ``fetch_type``. :return: generator of dict results """ ...
python
def fetch_raw(self): """ Execute the query and return by batches. Optional keyword arguments are passed to Query.execute(). Whether this is real-time or stored logs is dependent on the value of ``fetch_type``. :return: generator of dict results """ ...
[ "def", "fetch_raw", "(", "self", ")", ":", "for", "results", "in", "super", "(", "LogQuery", ",", "self", ")", ".", "execute", "(", ")", ":", "if", "'records'", "in", "results", "and", "results", "[", "'records'", "]", ":", "yield", "results", "[", "...
Execute the query and return by batches. Optional keyword arguments are passed to Query.execute(). Whether this is real-time or stored logs is dependent on the value of ``fetch_type``. :return: generator of dict results
[ "Execute", "the", "query", "and", "return", "by", "batches", ".", "Optional", "keyword", "arguments", "are", "passed", "to", "Query", ".", "execute", "()", ".", "Whether", "this", "is", "real", "-", "time", "or", "stored", "logs", "is", "dependent", "on", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/monitors/logs.py#L153-L164
gabstopper/smc-python
smc-monitoring/smc_monitoring/monitors/logs.py
LogQuery.fetch_batch
def fetch_batch(self, formatter=TableFormat): """ Fetch a batch of logs and return using the specified formatter. Formatter is class type defined in :py:mod:`smc_monitoring.models.formatters`. This fetch type will be a single shot fetch (this method forces ``fetch_type='stored'`...
python
def fetch_batch(self, formatter=TableFormat): """ Fetch a batch of logs and return using the specified formatter. Formatter is class type defined in :py:mod:`smc_monitoring.models.formatters`. This fetch type will be a single shot fetch (this method forces ``fetch_type='stored'`...
[ "def", "fetch_batch", "(", "self", ",", "formatter", "=", "TableFormat", ")", ":", "clone", "=", "self", ".", "copy", "(", ")", "clone", ".", "update_query", "(", "type", "=", "'stored'", ")", "if", "not", "clone", ".", "fetch_size", "or", "clone", "."...
Fetch a batch of logs and return using the specified formatter. Formatter is class type defined in :py:mod:`smc_monitoring.models.formatters`. This fetch type will be a single shot fetch (this method forces ``fetch_type='stored'``). If ``fetch_size`` is not already set on the query, the...
[ "Fetch", "a", "batch", "of", "logs", "and", "return", "using", "the", "specified", "formatter", ".", "Formatter", "is", "class", "type", "defined", "in", ":", "py", ":", "mod", ":", "smc_monitoring", ".", "models", ".", "formatters", ".", "This", "fetch", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/monitors/logs.py#L166-L185
gabstopper/smc-python
smc-monitoring/smc_monitoring/monitors/logs.py
LogQuery.fetch_live
def fetch_live(self, formatter=TableFormat): """ View logs in real-time. If previous filters were already set on this query, they will be preserved on the original instance (this method forces ``fetch_type='current'``). :param formatter: Formatter type for data represent...
python
def fetch_live(self, formatter=TableFormat): """ View logs in real-time. If previous filters were already set on this query, they will be preserved on the original instance (this method forces ``fetch_type='current'``). :param formatter: Formatter type for data represent...
[ "def", "fetch_live", "(", "self", ",", "formatter", "=", "TableFormat", ")", ":", "clone", "=", "self", ".", "copy", "(", ")", "clone", ".", "update_query", "(", "type", "=", "'current'", ")", "fmt", "=", "formatter", "(", "clone", ")", "for", "result"...
View logs in real-time. If previous filters were already set on this query, they will be preserved on the original instance (this method forces ``fetch_type='current'``). :param formatter: Formatter type for data representation. Any type in :py:mod:`smc_monitoring.models.for...
[ "View", "logs", "in", "real", "-", "time", ".", "If", "previous", "filters", "were", "already", "set", "on", "this", "query", "they", "will", "be", "preserved", "on", "the", "original", "instance", "(", "this", "method", "forces", "fetch_type", "=", "curre...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/monitors/logs.py#L187-L201
gabstopper/smc-python
smc/core/engine_vss.py
VSSContainer.create
def create(cls, name, vss_def=None): """ Create a VSS Container. This maps to the Service Manager within NSX. vss_def is optional and has the following definition: {"isc_ovf_appliance_model": 'virtual', "isc_ovf_appliance_version": '', "isc_ip_addr...
python
def create(cls, name, vss_def=None): """ Create a VSS Container. This maps to the Service Manager within NSX. vss_def is optional and has the following definition: {"isc_ovf_appliance_model": 'virtual', "isc_ovf_appliance_version": '', "isc_ip_addr...
[ "def", "create", "(", "cls", ",", "name", ",", "vss_def", "=", "None", ")", ":", "vss_def", "=", "{", "}", "if", "vss_def", "is", "None", "else", "vss_def", "json", "=", "{", "'master_type'", ":", "'dcl2fw'", ",", "'name'", ":", "name", ",", "'vss_is...
Create a VSS Container. This maps to the Service Manager within NSX. vss_def is optional and has the following definition: {"isc_ovf_appliance_model": 'virtual', "isc_ovf_appliance_version": '', "isc_ip_address": '192.168.4.84', # IP of manager, i.e. OSC ...
[ "Create", "a", "VSS", "Container", ".", "This", "maps", "to", "the", "Service", "Manager", "within", "NSX", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L21-L45
gabstopper/smc-python
smc/core/engine_vss.py
VSSContainer.nodes
def nodes(self): """ Return the nodes for this VSS Container :rtype: SubElementCollection(VSSContainerNode) """ resource = sub_collection( self.get_relation('vss_container_node'), VSSContainerNode) resource._load_from_engine(self, 'nodes...
python
def nodes(self): """ Return the nodes for this VSS Container :rtype: SubElementCollection(VSSContainerNode) """ resource = sub_collection( self.get_relation('vss_container_node'), VSSContainerNode) resource._load_from_engine(self, 'nodes...
[ "def", "nodes", "(", "self", ")", ":", "resource", "=", "sub_collection", "(", "self", ".", "get_relation", "(", "'vss_container_node'", ")", ",", "VSSContainerNode", ")", "resource", ".", "_load_from_engine", "(", "self", ",", "'nodes'", ")", "return", "resou...
Return the nodes for this VSS Container :rtype: SubElementCollection(VSSContainerNode)
[ "Return", "the", "nodes", "for", "this", "VSS", "Container", ":", "rtype", ":", "SubElementCollection", "(", "VSSContainerNode", ")" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L48-L58
gabstopper/smc-python
smc/core/engine_vss.py
VSSContainer.vss_contexts
def vss_contexts(self): """ Return all virtual contexts for this VSS Container. :return list VSSContext """ result = self.make_request( href=fetch_entry_point('visible_virtual_engine_mapping'), params={'filter': self.name}) if result.get('mapping'...
python
def vss_contexts(self): """ Return all virtual contexts for this VSS Container. :return list VSSContext """ result = self.make_request( href=fetch_entry_point('visible_virtual_engine_mapping'), params={'filter': self.name}) if result.get('mapping'...
[ "def", "vss_contexts", "(", "self", ")", ":", "result", "=", "self", ".", "make_request", "(", "href", "=", "fetch_entry_point", "(", "'visible_virtual_engine_mapping'", ")", ",", "params", "=", "{", "'filter'", ":", "self", ".", "name", "}", ")", "if", "r...
Return all virtual contexts for this VSS Container. :return list VSSContext
[ "Return", "all", "virtual", "contexts", "for", "this", "VSS", "Container", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L86-L98
gabstopper/smc-python
smc/core/engine_vss.py
VSSContainer.remove_security_group
def remove_security_group(self, name): """ Remove a security group from container """ for group in self.security_groups: if group.isc_name == name: group.delete()
python
def remove_security_group(self, name): """ Remove a security group from container """ for group in self.security_groups: if group.isc_name == name: group.delete()
[ "def", "remove_security_group", "(", "self", ",", "name", ")", ":", "for", "group", "in", "self", ".", "security_groups", ":", "if", "group", ".", "isc_name", "==", "name", ":", "group", ".", "delete", "(", ")" ]
Remove a security group from container
[ "Remove", "a", "security", "group", "from", "container" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L111-L117
gabstopper/smc-python
smc/core/engine_vss.py
VSSContainer.add_security_group
def add_security_group(self, name, isc_id, comment=None): """ Create a new security group. :param str name: NSX security group name :param str isc_id: NSX Security Group objectId i.e. (securitygroup-14) :raises CreateElementFailed: failed to create :rtype: Se...
python
def add_security_group(self, name, isc_id, comment=None): """ Create a new security group. :param str name: NSX security group name :param str isc_id: NSX Security Group objectId i.e. (securitygroup-14) :raises CreateElementFailed: failed to create :rtype: Se...
[ "def", "add_security_group", "(", "self", ",", "name", ",", "isc_id", ",", "comment", "=", "None", ")", ":", "return", "SecurityGroup", ".", "create", "(", "name", "=", "name", ",", "isc_id", "=", "isc_id", ",", "vss_container", "=", "self", ",", "commen...
Create a new security group. :param str name: NSX security group name :param str isc_id: NSX Security Group objectId i.e. (securitygroup-14) :raises CreateElementFailed: failed to create :rtype: SecurityGroup
[ "Create", "a", "new", "security", "group", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L119-L133
gabstopper/smc-python
smc/core/engine_vss.py
VSSContainer.add_context
def add_context(self, isc_name, isc_policy_id, isc_traffic_tag): """ Create the VSS Context within the VSSContainer :param str isc_name: ISC name, possibly append policy name?? :param str isc_policy_id: Policy ID in SMC (the 'key' attribute) :param str isc_traffic_tag: NSX group...
python
def add_context(self, isc_name, isc_policy_id, isc_traffic_tag): """ Create the VSS Context within the VSSContainer :param str isc_name: ISC name, possibly append policy name?? :param str isc_policy_id: Policy ID in SMC (the 'key' attribute) :param str isc_traffic_tag: NSX group...
[ "def", "add_context", "(", "self", ",", "isc_name", ",", "isc_policy_id", ",", "isc_traffic_tag", ")", ":", "if", "'add_context'", "in", "self", ".", "data", ".", "links", ":", "# SMC >=6.5", "element", "=", "ElementCreator", "(", "VSSContext", ",", "href", ...
Create the VSS Context within the VSSContainer :param str isc_name: ISC name, possibly append policy name?? :param str isc_policy_id: Policy ID in SMC (the 'key' attribute) :param str isc_traffic_tag: NSX groupId (serviceprofile-145) :raises CreateElementFailed: failed to create ...
[ "Create", "the", "VSS", "Context", "within", "the", "VSSContainer" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L135-L167
gabstopper/smc-python
smc/core/engine_vss.py
VSSContainerNode.create
def create(cls, name, vss_container, vss_node_def, comment=None): """ Create VSS node. This is the engines dvFilter management interface within the NSX agent. .. seealso:: `~.isc_settings` for documentation on the vss_node_def dict :param str ...
python
def create(cls, name, vss_container, vss_node_def, comment=None): """ Create VSS node. This is the engines dvFilter management interface within the NSX agent. .. seealso:: `~.isc_settings` for documentation on the vss_node_def dict :param str ...
[ "def", "create", "(", "cls", ",", "name", ",", "vss_container", ",", "vss_node_def", ",", "comment", "=", "None", ")", ":", "element", "=", "ElementCreator", "(", "cls", ",", "href", "=", "vss_container", ".", "get_relation", "(", "'vss_container_node'", ")"...
Create VSS node. This is the engines dvFilter management interface within the NSX agent. .. seealso:: `~.isc_settings` for documentation on the vss_node_def dict :param str name: name of node :param VSSContainer vss_container: container to nest this node :pa...
[ "Create", "VSS", "node", ".", "This", "is", "the", "engines", "dvFilter", "management", "interface", "within", "the", "NSX", "agent", ".", "..", "seealso", "::", "~", ".", "isc_settings", "for", "documentation", "on", "the", "vss_node_def", "dict" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L181-L204
gabstopper/smc-python
smc/core/engine_vss.py
VSSContext.create
def create(cls, isc_name, isc_policy_id, isc_traffic_tag, vss_container): """ Create the VSS Context within the VSSContainer :param str name: ISC name, possibly append policy name?? :param str isc_policy_id: Policy ID in SMC (the 'key' attribute) :param str isc_traffic_tag: NSX ...
python
def create(cls, isc_name, isc_policy_id, isc_traffic_tag, vss_container): """ Create the VSS Context within the VSSContainer :param str name: ISC name, possibly append policy name?? :param str isc_policy_id: Policy ID in SMC (the 'key' attribute) :param str isc_traffic_tag: NSX ...
[ "def", "create", "(", "cls", ",", "isc_name", ",", "isc_policy_id", ",", "isc_traffic_tag", ",", "vss_container", ")", ":", "container", "=", "element_resolver", "(", "vss_container", ")", "return", "ElementCreator", "(", "cls", ",", "href", "=", "container", ...
Create the VSS Context within the VSSContainer :param str name: ISC name, possibly append policy name?? :param str isc_policy_id: Policy ID in SMC (the 'key' attribute) :param str isc_traffic_tag: NSX groupId (serviceprofile-145) :param VSSContainer vss_container: VSS Container to get c...
[ "Create", "the", "VSS", "Context", "within", "the", "VSSContainer" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L236-L257
gabstopper/smc-python
smc/core/engine_vss.py
VSSContext.remove_from_master_node
def remove_from_master_node(self, wait_for_finish=False, timeout=20, **kw): """ Remove this VSS Context from it's parent VSS Container. This is required before calling VSSContext.delete(). It preps the engine for removal. :param bool wait_for_finish: wait for the task to...
python
def remove_from_master_node(self, wait_for_finish=False, timeout=20, **kw): """ Remove this VSS Context from it's parent VSS Container. This is required before calling VSSContext.delete(). It preps the engine for removal. :param bool wait_for_finish: wait for the task to...
[ "def", "remove_from_master_node", "(", "self", ",", "wait_for_finish", "=", "False", ",", "timeout", "=", "20", ",", "*", "*", "kw", ")", ":", "return", "Task", ".", "execute", "(", "self", ",", "'remove_from_master_node'", ",", "timeout", "=", "timeout", ...
Remove this VSS Context from it's parent VSS Container. This is required before calling VSSContext.delete(). It preps the engine for removal. :param bool wait_for_finish: wait for the task to finish :param int timeout: how long to wait if delay :type: TaskOperationPoller
[ "Remove", "this", "VSS", "Context", "from", "it", "s", "parent", "VSS", "Container", ".", "This", "is", "required", "before", "calling", "VSSContext", ".", "delete", "()", ".", "It", "preps", "the", "engine", "for", "removal", ".", ":", "param", "bool", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L259-L270
gabstopper/smc-python
smc/core/engine_vss.py
SecurityGroup.create
def create(cls, name, isc_id, vss_container, comment=None): """ Create a new security group. Find a security group:: SecurityGroup.objects.filter(name) .. note:: The isc_id (securitygroup-10, etc) represents the internal NSX reference fo...
python
def create(cls, name, isc_id, vss_container, comment=None): """ Create a new security group. Find a security group:: SecurityGroup.objects.filter(name) .. note:: The isc_id (securitygroup-10, etc) represents the internal NSX reference fo...
[ "def", "create", "(", "cls", ",", "name", ",", "isc_id", ",", "vss_container", ",", "comment", "=", "None", ")", ":", "return", "ElementCreator", "(", "cls", ",", "href", "=", "vss_container", ".", "get_relation", "(", "'security_groups'", ")", ",", "json"...
Create a new security group. Find a security group:: SecurityGroup.objects.filter(name) .. note:: The isc_id (securitygroup-10, etc) represents the internal NSX reference for the Security Composer group. This is placed in the comment field w...
[ "Create", "a", "new", "security", "group", ".", "Find", "a", "security", "group", "::", "SecurityGroup", ".", "objects", ".", "filter", "(", "name", ")", "..", "note", "::", "The", "isc_id", "(", "securitygroup", "-", "10", "etc", ")", "represents", "the...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L305-L334
gabstopper/smc-python
smc/elements/netlink.py
StaticNetlink.create
def create(cls, name, gateway, network, input_speed=None, output_speed=None, domain_server_address=None, provider_name=None, probe_address=None, standby_mode_period=3600, standby_mode_timeout=30, active_mode_period=5, active_mode_timeout=1, comment=None): ...
python
def create(cls, name, gateway, network, input_speed=None, output_speed=None, domain_server_address=None, provider_name=None, probe_address=None, standby_mode_period=3600, standby_mode_timeout=30, active_mode_period=5, active_mode_timeout=1, comment=None): ...
[ "def", "create", "(", "cls", ",", "name", ",", "gateway", ",", "network", ",", "input_speed", "=", "None", ",", "output_speed", "=", "None", ",", "domain_server_address", "=", "None", ",", "provider_name", "=", "None", ",", "probe_address", "=", "None", ",...
Create a new StaticNetlink to be used as a traffic handler. :param str name: name of netlink Element :param gateway_ref: gateway to map this netlink to. This can be an element or str href. :type gateway_ref: Router,Engine :param list ref: network/s associated with this netli...
[ "Create", "a", "new", "StaticNetlink", "to", "be", "used", "as", "a", "traffic", "handler", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/netlink.py#L91-L149
gabstopper/smc-python
smc/elements/netlink.py
StaticNetlink.update_or_create
def update_or_create(cls, with_status=False, **kwargs): """ Update or create static netlink. DNS entry differences are not resolved, instead any entries provided will be the final state for this netlink. If the intent is to add/remove DNS entries you can use the :meth:`~domain_se...
python
def update_or_create(cls, with_status=False, **kwargs): """ Update or create static netlink. DNS entry differences are not resolved, instead any entries provided will be the final state for this netlink. If the intent is to add/remove DNS entries you can use the :meth:`~domain_se...
[ "def", "update_or_create", "(", "cls", ",", "with_status", "=", "False", ",", "*", "*", "kwargs", ")", ":", "dns_address", "=", "kwargs", ".", "pop", "(", "'domain_server_address'", ",", "[", "]", ")", "element", ",", "updated", ",", "created", "=", "sup...
Update or create static netlink. DNS entry differences are not resolved, instead any entries provided will be the final state for this netlink. If the intent is to add/remove DNS entries you can use the :meth:`~domain_server_address` method to add or remove. :raises Crea...
[ "Update", "or", "create", "static", "netlink", ".", "DNS", "entry", "differences", "are", "not", "resolved", "instead", "any", "entries", "provided", "will", "be", "the", "final", "state", "for", "this", "netlink", ".", "If", "the", "intent", "is", "to", "...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/netlink.py#L152-L176
gabstopper/smc-python
smc/elements/netlink.py
DynamicNetlink.create
def create(cls, name, input_speed=None, learn_dns_automatically=True, output_speed=None, provider_name=None, probe_address=None, standby_mode_period=3600, standby_mode_timeout=30, active_mode_period=5, active_mode_timeout=1, comment=None): """ Create a Dynami...
python
def create(cls, name, input_speed=None, learn_dns_automatically=True, output_speed=None, provider_name=None, probe_address=None, standby_mode_period=3600, standby_mode_timeout=30, active_mode_period=5, active_mode_timeout=1, comment=None): """ Create a Dynami...
[ "def", "create", "(", "cls", ",", "name", ",", "input_speed", "=", "None", ",", "learn_dns_automatically", "=", "True", ",", "output_speed", "=", "None", ",", "provider_name", "=", "None", ",", "probe_address", "=", "None", ",", "standby_mode_period", "=", "...
Create a Dynamic Netlink. :param str name: name of netlink Element :param int input_speed: input speed in Kbps, used for ratio-based load-balancing :param int output_speed: output speed in Kbps, used for ratio-based load-balancing :param bool learn_dns_automatic...
[ "Create", "a", "Dynamic", "Netlink", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/netlink.py#L218-L261
gabstopper/smc-python
smc/elements/netlink.py
Multilink.create
def create(cls, name, multilink_members, multilink_method='rtt', retries=2, timeout=3600, comment=None): """ Create a new multilink configuration. Multilink requires at least one netlink for operation, although 2 or more are recommeneded. :param str name: name of ...
python
def create(cls, name, multilink_members, multilink_method='rtt', retries=2, timeout=3600, comment=None): """ Create a new multilink configuration. Multilink requires at least one netlink for operation, although 2 or more are recommeneded. :param str name: name of ...
[ "def", "create", "(", "cls", ",", "name", ",", "multilink_members", ",", "multilink_method", "=", "'rtt'", ",", "retries", "=", "2", ",", "timeout", "=", "3600", ",", "comment", "=", "None", ")", ":", "json", "=", "{", "'name'", ":", "name", ",", "'c...
Create a new multilink configuration. Multilink requires at least one netlink for operation, although 2 or more are recommeneded. :param str name: name of multilink :param list multilink_members: the output of calling :func:`.multilink_member` to retrieve the proper formatti...
[ "Create", "a", "new", "multilink", "configuration", ".", "Multilink", "requires", "at", "least", "one", "netlink", "for", "operation", "although", "2", "or", "more", "are", "recommeneded", ".", ":", "param", "str", "name", ":", "name", "of", "multilink", ":"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/netlink.py#L314-L341
gabstopper/smc-python
smc/elements/netlink.py
Multilink.create_with_netlinks
def create_with_netlinks(cls, name, netlinks, **kwargs): """ Create a multilink with a list of StaticNetlinks. To properly create the multilink using this method, pass a list of netlinks with the following dict structure:: netlinks = [{'netlink': StaticNetlink, ...
python
def create_with_netlinks(cls, name, netlinks, **kwargs): """ Create a multilink with a list of StaticNetlinks. To properly create the multilink using this method, pass a list of netlinks with the following dict structure:: netlinks = [{'netlink': StaticNetlink, ...
[ "def", "create_with_netlinks", "(", "cls", ",", "name", ",", "netlinks", ",", "*", "*", "kwargs", ")", ":", "multilink_members", "=", "[", "]", "for", "member", "in", "netlinks", ":", "m", "=", "{", "'ip_range'", ":", "member", ".", "get", "(", "'ip_ra...
Create a multilink with a list of StaticNetlinks. To properly create the multilink using this method, pass a list of netlinks with the following dict structure:: netlinks = [{'netlink': StaticNetlink, 'ip_range': 1.1.1.1-1.1.1.2, 'ne...
[ "Create", "a", "multilink", "with", "a", "list", "of", "StaticNetlinks", ".", "To", "properly", "create", "the", "multilink", "using", "this", "method", "pass", "a", "list", "of", "netlinks", "with", "the", "following", "dict", "structure", "::", "netlinks", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/netlink.py#L344-L387
gabstopper/smc-python
smc/elements/netlink.py
MultilinkMember.create
def create(cls, netlink, ip_range=None, netlink_role='active'): """ Create a multilink member. Multilink members are added to an Outbound Multilink configuration and define the ip range, static netlink to use, and the role. This element can be passed to the Multilink constructor ...
python
def create(cls, netlink, ip_range=None, netlink_role='active'): """ Create a multilink member. Multilink members are added to an Outbound Multilink configuration and define the ip range, static netlink to use, and the role. This element can be passed to the Multilink constructor ...
[ "def", "create", "(", "cls", ",", "netlink", ",", "ip_range", "=", "None", ",", "netlink_role", "=", "'active'", ")", ":", "member_def", "=", "dict", "(", "netlink_ref", "=", "netlink", ".", "href", ",", "netlink_role", "=", "netlink_role", ",", "ip_range"...
Create a multilink member. Multilink members are added to an Outbound Multilink configuration and define the ip range, static netlink to use, and the role. This element can be passed to the Multilink constructor to simplify creation of the outbound multilink. :param StaticNetlin...
[ "Create", "a", "multilink", "member", ".", "Multilink", "members", "are", "added", "to", "an", "Outbound", "Multilink", "configuration", "and", "define", "the", "ip", "range", "static", "netlink", "to", "use", "and", "the", "role", ".", "This", "element", "c...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/netlink.py#L484-L507
gabstopper/smc-python
smc/administration/certificates/tls.py
TLSProfile.create
def create(cls, name, tls_version, use_only_subject_alt_name=False, accept_wildcard=False, check_revocation=True, tls_cryptography_suites=None, crl_delay=0, ocsp_delay=0, ignore_network_issues=False, tls_trusted_ca_ref=None, comment=None): """ Create a TLS Profile. By default the...
python
def create(cls, name, tls_version, use_only_subject_alt_name=False, accept_wildcard=False, check_revocation=True, tls_cryptography_suites=None, crl_delay=0, ocsp_delay=0, ignore_network_issues=False, tls_trusted_ca_ref=None, comment=None): """ Create a TLS Profile. By default the...
[ "def", "create", "(", "cls", ",", "name", ",", "tls_version", ",", "use_only_subject_alt_name", "=", "False", ",", "accept_wildcard", "=", "False", ",", "check_revocation", "=", "True", ",", "tls_cryptography_suites", "=", "None", ",", "crl_delay", "=", "0", "...
Create a TLS Profile. By default the SMC will have a default NIST TLS Profile but it is also possible to create a custom profile to provide special TLS handling. :param str name: name of TLS Profile :param str tls_verison: supported tls verison, valid options are TLS...
[ "Create", "a", "TLS", "Profile", ".", "By", "default", "the", "SMC", "will", "have", "a", "default", "NIST", "TLS", "Profile", "but", "it", "is", "also", "possible", "to", "create", "a", "custom", "profile", "to", "provide", "special", "TLS", "handling", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls.py#L119-L162
gabstopper/smc-python
smc/administration/certificates/tls.py
TLSCryptographySuite.ciphers
def ciphers(from_suite=None): """ This is a helper method that will return all of the cipher strings used in a specified TLSCryptographySuite or returns the system default NIST profile list of ciphers. This can be used as a helper to identify the ciphers to specify/add wh...
python
def ciphers(from_suite=None): """ This is a helper method that will return all of the cipher strings used in a specified TLSCryptographySuite or returns the system default NIST profile list of ciphers. This can be used as a helper to identify the ciphers to specify/add wh...
[ "def", "ciphers", "(", "from_suite", "=", "None", ")", ":", "suite", "=", "from_suite", "or", "TLSCryptographySuite", ".", "objects", ".", "filter", "(", "'NIST'", ")", ".", "first", "(", ")", "return", "suite", ".", "data", ".", "get", "(", "'tls_crypto...
This is a helper method that will return all of the cipher strings used in a specified TLSCryptographySuite or returns the system default NIST profile list of ciphers. This can be used as a helper to identify the ciphers to specify/add when creating a new TLSCryptographySuite. ...
[ "This", "is", "a", "helper", "method", "that", "will", "return", "all", "of", "the", "cipher", "strings", "used", "in", "a", "specified", "TLSCryptographySuite", "or", "returns", "the", "system", "default", "NIST", "profile", "list", "of", "ciphers", ".", "T...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls.py#L202-L214
gabstopper/smc-python
smc/administration/certificates/tls.py
TLSCertificateAuthority.create
def create(cls, name, certificate): """ Create a TLS CA. The certificate must be compatible with OpenSSL and be in PEM format. The certificate can be either a file with the Root CA, or a raw string starting with BEGIN CERTIFICATE, etc. When creating a TLS CA, you must also import...
python
def create(cls, name, certificate): """ Create a TLS CA. The certificate must be compatible with OpenSSL and be in PEM format. The certificate can be either a file with the Root CA, or a raw string starting with BEGIN CERTIFICATE, etc. When creating a TLS CA, you must also import...
[ "def", "create", "(", "cls", ",", "name", ",", "certificate", ")", ":", "json", "=", "{", "'name'", ":", "name", ",", "'certificate'", ":", "certificate", "if", "pem_as_string", "(", "certificate", ")", "else", "load_cert_chain", "(", "certificate", ")", "...
Create a TLS CA. The certificate must be compatible with OpenSSL and be in PEM format. The certificate can be either a file with the Root CA, or a raw string starting with BEGIN CERTIFICATE, etc. When creating a TLS CA, you must also import the CA certificate. Once the CA is created, it ...
[ "Create", "a", "TLS", "CA", ".", "The", "certificate", "must", "be", "compatible", "with", "OpenSSL", "and", "be", "in", "PEM", "format", ".", "The", "certificate", "can", "be", "either", "a", "file", "with", "the", "Root", "CA", "or", "a", "raw", "str...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls.py#L264-L284
gabstopper/smc-python
smc/administration/certificates/tls.py
TLSServerCredential.create_csr
def create_csr(cls, name, common_name, public_key_algorithm='rsa', signature_algorithm='rsa_sha_512', key_length=4096): """ Create a certificate signing request. :param str name: name of TLS Server Credential :param str rcommon_name: common name for certificate. ...
python
def create_csr(cls, name, common_name, public_key_algorithm='rsa', signature_algorithm='rsa_sha_512', key_length=4096): """ Create a certificate signing request. :param str name: name of TLS Server Credential :param str rcommon_name: common name for certificate. ...
[ "def", "create_csr", "(", "cls", ",", "name", ",", "common_name", ",", "public_key_algorithm", "=", "'rsa'", ",", "signature_algorithm", "=", "'rsa_sha_512'", ",", "key_length", "=", "4096", ")", ":", "json", "=", "{", "'name'", ":", "name", ",", "'info'", ...
Create a certificate signing request. :param str name: name of TLS Server Credential :param str rcommon_name: common name for certificate. An example would be: "CN=CommonName,O=Organization,OU=Unit,C=FR,ST=PACA,L=Nice". At minimum, a "CN" is required. :param str...
[ "Create", "a", "certificate", "signing", "request", ".", ":", "param", "str", "name", ":", "name", "of", "TLS", "Server", "Credential", ":", "param", "str", "rcommon_name", ":", "common", "name", "for", "certificate", ".", "An", "example", "would", "be", "...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls.py#L326-L355
gabstopper/smc-python
smc/administration/certificates/tls.py
TLSServerCredential.create_self_signed
def create_self_signed(cls, name, common_name, public_key_algorithm='rsa', signature_algorithm='rsa_sha_512', key_length=4096): """ Create a self signed certificate. This is a convenience method that first calls :meth:`~create_csr`, then calls :meth:`~self_sign` on the return...
python
def create_self_signed(cls, name, common_name, public_key_algorithm='rsa', signature_algorithm='rsa_sha_512', key_length=4096): """ Create a self signed certificate. This is a convenience method that first calls :meth:`~create_csr`, then calls :meth:`~self_sign` on the return...
[ "def", "create_self_signed", "(", "cls", ",", "name", ",", "common_name", ",", "public_key_algorithm", "=", "'rsa'", ",", "signature_algorithm", "=", "'rsa_sha_512'", ",", "key_length", "=", "4096", ")", ":", "tls", "=", "TLSServerCredential", ".", "create_csr", ...
Create a self signed certificate. This is a convenience method that first calls :meth:`~create_csr`, then calls :meth:`~self_sign` on the returned TLSServerCredential object. :param str name: name of TLS Server Credential :param str rcommon_name: common name for certificate. An ...
[ "Create", "a", "self", "signed", "certificate", ".", "This", "is", "a", "convenience", "method", "that", "first", "calls", ":", "meth", ":", "~create_csr", "then", "calls", ":", "meth", ":", "~self_sign", "on", "the", "returned", "TLSServerCredential", "object...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls.py#L358-L390
gabstopper/smc-python
smc/administration/certificates/tls.py
TLSServerCredential.import_signed
def import_signed(cls, name, certificate, private_key, intermediate=None): """ Import a signed certificate and private key to SMC, and optionally an intermediate certificate. The certificate and the associated private key must be compatible with OpenSSL and be in PEM format. The ...
python
def import_signed(cls, name, certificate, private_key, intermediate=None): """ Import a signed certificate and private key to SMC, and optionally an intermediate certificate. The certificate and the associated private key must be compatible with OpenSSL and be in PEM format. The ...
[ "def", "import_signed", "(", "cls", ",", "name", ",", "certificate", ",", "private_key", ",", "intermediate", "=", "None", ")", ":", "tls", "=", "TLSServerCredential", ".", "create", "(", "name", ")", "try", ":", "tls", ".", "import_certificate", "(", "cer...
Import a signed certificate and private key to SMC, and optionally an intermediate certificate. The certificate and the associated private key must be compatible with OpenSSL and be in PEM format. The certificate and private key can be imported as a raw string, file path or file object. ...
[ "Import", "a", "signed", "certificate", "and", "private", "key", "to", "SMC", "and", "optionally", "an", "intermediate", "certificate", ".", "The", "certificate", "and", "the", "associated", "private", "key", "must", "be", "compatible", "with", "OpenSSL", "and",...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls.py#L393-L430
gabstopper/smc-python
smc/administration/certificates/tls.py
TLSServerCredential.import_from_chain
def import_from_chain(cls, name, certificate_file, private_key=None): """ Import the server certificate, intermediate and optionally private key from a certificate chain file. The expected format of the chain file follows RFC 4346. In short, the server certificate should come fir...
python
def import_from_chain(cls, name, certificate_file, private_key=None): """ Import the server certificate, intermediate and optionally private key from a certificate chain file. The expected format of the chain file follows RFC 4346. In short, the server certificate should come fir...
[ "def", "import_from_chain", "(", "cls", ",", "name", ",", "certificate_file", ",", "private_key", "=", "None", ")", ":", "contents", "=", "load_cert_chain", "(", "certificate_file", ")", "for", "pem", "in", "list", "(", "contents", ")", ":", "if", "b'PRIVATE...
Import the server certificate, intermediate and optionally private key from a certificate chain file. The expected format of the chain file follows RFC 4346. In short, the server certificate should come first, followed by any intermediate certificates, optionally followed by the ...
[ "Import", "the", "server", "certificate", "intermediate", "and", "optionally", "private", "key", "from", "a", "certificate", "chain", "file", ".", "The", "expected", "format", "of", "the", "chain", "file", "follows", "RFC", "4346", ".", "In", "short", "the", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls.py#L433-L498
gabstopper/smc-python
smc/administration/certificates/tls.py
ClientProtectionCA.import_signed
def import_signed(cls, name, certificate, private_key): """ Import a signed certificate and private key as a client protection CA. This is a shortcut method to the 3 step process: * Create CA with name * Import certificate * Import private ke...
python
def import_signed(cls, name, certificate, private_key): """ Import a signed certificate and private key as a client protection CA. This is a shortcut method to the 3 step process: * Create CA with name * Import certificate * Import private ke...
[ "def", "import_signed", "(", "cls", ",", "name", ",", "certificate", ",", "private_key", ")", ":", "ca", "=", "ClientProtectionCA", ".", "create", "(", "name", "=", "name", ")", "try", ":", "ca", ".", "import_certificate", "(", "certificate", ")", "ca", ...
Import a signed certificate and private key as a client protection CA. This is a shortcut method to the 3 step process: * Create CA with name * Import certificate * Import private key Create the CA:: ClientProtectionCA.i...
[ "Import", "a", "signed", "certificate", "and", "private", "key", "as", "a", "client", "protection", "CA", ".", "This", "is", "a", "shortcut", "method", "to", "the", "3", "step", "process", ":", "*", "Create", "CA", "with", "name", "*", "Import", "certifi...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls.py#L561-L592
gabstopper/smc-python
smc/administration/certificates/tls.py
ClientProtectionCA.create_self_signed
def create_self_signed(cls, name, prefix, password, public_key_algorithm='rsa', life_time=365, key_length=2048): """ Create a self signed client protection CA. To prevent browser warnings during decryption, you must trust the signing certificate in the client browsers. ...
python
def create_self_signed(cls, name, prefix, password, public_key_algorithm='rsa', life_time=365, key_length=2048): """ Create a self signed client protection CA. To prevent browser warnings during decryption, you must trust the signing certificate in the client browsers. ...
[ "def", "create_self_signed", "(", "cls", ",", "name", ",", "prefix", ",", "password", ",", "public_key_algorithm", "=", "'rsa'", ",", "life_time", "=", "365", ",", "key_length", "=", "2048", ")", ":", "json", "=", "{", "'key_name'", ":", "name", ",", "'p...
Create a self signed client protection CA. To prevent browser warnings during decryption, you must trust the signing certificate in the client browsers. :param str name: Name of this ex: "SG Root CA" Used as Key. Real common name will be derivated at creation time with a uniqueId. ...
[ "Create", "a", "self", "signed", "client", "protection", "CA", ".", "To", "prevent", "browser", "warnings", "during", "decryption", "you", "must", "trust", "the", "signing", "certificate", "in", "the", "client", "browsers", ".", ":", "param", "str", "name", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls.py#L610-L643
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/query.py
Query.update_format
def update_format(self, format): """ Update the format for this query. :param format: new format to use for this query :type format: :py:mod:`smc_monitoring.models.formats` """ self.format = format self.request.update(format=self.format.data)
python
def update_format(self, format): """ Update the format for this query. :param format: new format to use for this query :type format: :py:mod:`smc_monitoring.models.formats` """ self.format = format self.request.update(format=self.format.data)
[ "def", "update_format", "(", "self", ",", "format", ")", ":", "self", ".", "format", "=", "format", "self", ".", "request", ".", "update", "(", "format", "=", "self", ".", "format", ".", "data", ")" ]
Update the format for this query. :param format: new format to use for this query :type format: :py:mod:`smc_monitoring.models.formats`
[ "Update", "the", "format", "for", "this", "query", ".", ":", "param", "format", ":", "new", "format", "to", "use", "for", "this", "query", ":", "type", "format", ":", ":", "py", ":", "mod", ":", "smc_monitoring", ".", "models", ".", "formats" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/query.py#L73-L81
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/query.py
Query.add_in_filter
def add_in_filter(self, *values): """ Add a filter using "IN" logic. This is typically the primary filter that will be used to find a match and generally combines other filters to get more granular. An example of usage would be searching for an IP address (or addresses) in a spec...
python
def add_in_filter(self, *values): """ Add a filter using "IN" logic. This is typically the primary filter that will be used to find a match and generally combines other filters to get more granular. An example of usage would be searching for an IP address (or addresses) in a spec...
[ "def", "add_in_filter", "(", "self", ",", "*", "values", ")", ":", "filt", "=", "InFilter", "(", "*", "values", ")", "self", ".", "update_filter", "(", "filt", ")", "return", "filt" ]
Add a filter using "IN" logic. This is typically the primary filter that will be used to find a match and generally combines other filters to get more granular. An example of usage would be searching for an IP address (or addresses) in a specific log field. Or looking for an IP address i...
[ "Add", "a", "filter", "using", "IN", "logic", ".", "This", "is", "typically", "the", "primary", "filter", "that", "will", "be", "used", "to", "find", "a", "match", "and", "generally", "combines", "other", "filters", "to", "get", "more", "granular", ".", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/query.py#L110-L126
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/query.py
Query.add_and_filter
def add_and_filter(self, *values): """ Add a filter using "AND" logic. This filter is useful when requiring multiple matches to evaluate to true. For example, searching for a specific IP address in the src field and another in the dst field. .. seealso:: :class:`smc_...
python
def add_and_filter(self, *values): """ Add a filter using "AND" logic. This filter is useful when requiring multiple matches to evaluate to true. For example, searching for a specific IP address in the src field and another in the dst field. .. seealso:: :class:`smc_...
[ "def", "add_and_filter", "(", "self", ",", "*", "values", ")", ":", "filt", "=", "AndFilter", "(", "*", "values", ")", "self", ".", "update_filter", "(", "filt", ")", "return", "filt" ]
Add a filter using "AND" logic. This filter is useful when requiring multiple matches to evaluate to true. For example, searching for a specific IP address in the src field and another in the dst field. .. seealso:: :class:`smc_monitoring.models.filters.AndFilter` for examples. ...
[ "Add", "a", "filter", "using", "AND", "logic", ".", "This", "filter", "is", "useful", "when", "requiring", "multiple", "matches", "to", "evaluate", "to", "true", ".", "For", "example", "searching", "for", "a", "specific", "IP", "address", "in", "the", "src...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/query.py#L128-L144
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/query.py
Query.add_or_filter
def add_or_filter(self, *values): """ Add a filter using "OR" logic. This filter is useful when matching on one or more criteria. For example, searching for IP 1.1.1.1 and service TCP/443, or IP 1.1.1.10 and TCP/80. Either pair would produce a positive match. .. ...
python
def add_or_filter(self, *values): """ Add a filter using "OR" logic. This filter is useful when matching on one or more criteria. For example, searching for IP 1.1.1.1 and service TCP/443, or IP 1.1.1.10 and TCP/80. Either pair would produce a positive match. .. ...
[ "def", "add_or_filter", "(", "self", ",", "*", "values", ")", ":", "filt", "=", "OrFilter", "(", "*", "values", ")", "self", ".", "update_filter", "(", "filt", ")", "return", "filt" ]
Add a filter using "OR" logic. This filter is useful when matching on one or more criteria. For example, searching for IP 1.1.1.1 and service TCP/443, or IP 1.1.1.10 and TCP/80. Either pair would produce a positive match. .. seealso:: :class:`smc_monitoring.models.filters.OrFilt...
[ "Add", "a", "filter", "using", "OR", "logic", ".", "This", "filter", "is", "useful", "when", "matching", "on", "one", "or", "more", "criteria", ".", "For", "example", "searching", "for", "IP", "1", ".", "1", ".", "1", ".", "1", "and", "service", "TCP...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/query.py#L146-L163
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/query.py
Query.add_not_filter
def add_not_filter(self, *value): """ Add a filter using "NOT" logic. Typically this filter is used in conjunction with and AND or OR filters, but can be used by itself as well. This might be more useful as a standalone filter when displaying logs in real time and filtering out ...
python
def add_not_filter(self, *value): """ Add a filter using "NOT" logic. Typically this filter is used in conjunction with and AND or OR filters, but can be used by itself as well. This might be more useful as a standalone filter when displaying logs in real time and filtering out ...
[ "def", "add_not_filter", "(", "self", ",", "*", "value", ")", ":", "filt", "=", "NotFilter", "(", "*", "value", ")", "self", ".", "update_filter", "(", "filt", ")", "return", "filt" ]
Add a filter using "NOT" logic. Typically this filter is used in conjunction with and AND or OR filters, but can be used by itself as well. This might be more useful as a standalone filter when displaying logs in real time and filtering out unwanted entry types. .. seealso:: :c...
[ "Add", "a", "filter", "using", "NOT", "logic", ".", "Typically", "this", "filter", "is", "used", "in", "conjunction", "with", "and", "AND", "or", "OR", "filters", "but", "can", "be", "used", "by", "itself", "as", "well", ".", "This", "might", "be", "mo...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/query.py#L165-L182
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/query.py
Query.add_defined_filter
def add_defined_filter(self, *value): """ Add a DefinedFilter expression to the query. This filter will be considered true if the :class:`smc.monitoring.values.Value` instance has a value. .. seealso:: :class:`smc_monitoring.models.filters.DefinedFilter` for examples. ...
python
def add_defined_filter(self, *value): """ Add a DefinedFilter expression to the query. This filter will be considered true if the :class:`smc.monitoring.values.Value` instance has a value. .. seealso:: :class:`smc_monitoring.models.filters.DefinedFilter` for examples. ...
[ "def", "add_defined_filter", "(", "self", ",", "*", "value", ")", ":", "filt", "=", "DefinedFilter", "(", "*", "value", ")", "self", ".", "update_filter", "(", "filt", ")", "return", "filt" ]
Add a DefinedFilter expression to the query. This filter will be considered true if the :class:`smc.monitoring.values.Value` instance has a value. .. seealso:: :class:`smc_monitoring.models.filters.DefinedFilter` for examples. :param Value value: single value for the fi...
[ "Add", "a", "DefinedFilter", "expression", "to", "the", "query", ".", "This", "filter", "will", "be", "considered", "true", "if", "the", ":", "class", ":", "smc", ".", "monitoring", ".", "values", ".", "Value", "instance", "has", "a", "value", ".", "..",...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/query.py#L184-L199
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/query.py
Query.resolve_field_ids
def resolve_field_ids(ids, **kw): """ Retrieve the log field details based on the LogField constant IDs. This provides a helper to view the fields representation when using different field_formats. Each query class has a default set of field IDs that can easily be looked up to e...
python
def resolve_field_ids(ids, **kw): """ Retrieve the log field details based on the LogField constant IDs. This provides a helper to view the fields representation when using different field_formats. Each query class has a default set of field IDs that can easily be looked up to e...
[ "def", "resolve_field_ids", "(", "ids", ",", "*", "*", "kw", ")", ":", "request", "=", "{", "'fetch'", ":", "{", "'quantity'", ":", "0", "}", ",", "'format'", ":", "{", "'type'", ":", "'detailed'", ",", "'field_ids'", ":", "ids", "}", ",", "'query'",...
Retrieve the log field details based on the LogField constant IDs. This provides a helper to view the fields representation when using different field_formats. Each query class has a default set of field IDs that can easily be looked up to examine their fields and different label option...
[ "Retrieve", "the", "log", "field", "details", "based", "on", "the", "LogField", "constant", "IDs", ".", "This", "provides", "a", "helper", "to", "view", "the", "fields", "representation", "when", "using", "different", "field_formats", ".", "Each", "query", "cl...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/query.py#L202-L230
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/query.py
Query._get_field_schema
def _get_field_schema(self): """ Get a list of all of the default fields for this query type. If data is available in the monitor type, a list of field definitions will be returned ahead of the actual data, providing insight into the available fields. If no data is available in a...
python
def _get_field_schema(self): """ Get a list of all of the default fields for this query type. If data is available in the monitor type, a list of field definitions will be returned ahead of the actual data, providing insight into the available fields. If no data is available in a...
[ "def", "_get_field_schema", "(", "self", ")", ":", "self", ".", "update_format", "(", "DetailedFormat", "(", ")", ")", "for", "fields", "in", "self", ".", "execute", "(", ")", ":", "if", "'fields'", "in", "fields", ":", "return", "fields", "[", "'fields'...
Get a list of all of the default fields for this query type. If data is available in the monitor type, a list of field definitions will be returned ahead of the actual data, providing insight into the available fields. If no data is available in a monitor, this will block on recv(). ...
[ "Get", "a", "list", "of", "all", "of", "the", "default", "fields", "for", "this", "query", "type", ".", "If", "data", "is", "available", "in", "the", "monitor", "type", "a", "list", "of", "field", "definitions", "will", "be", "returned", "ahead", "of", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/query.py#L232-L245
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/query.py
Query.execute
def execute(self): """ Execute the query with optional timeout. The response to the execute query is the raw payload received from the websocket and will contain multiple dict keys and values. It is more common to call query.fetch_XXX which will filter the return result based on ...
python
def execute(self): """ Execute the query with optional timeout. The response to the execute query is the raw payload received from the websocket and will contain multiple dict keys and values. It is more common to call query.fetch_XXX which will filter the return result based on ...
[ "def", "execute", "(", "self", ")", ":", "with", "SMCSocketProtocol", "(", "self", ",", "*", "*", "self", ".", "sockopt", ")", "as", "protocol", ":", "for", "result", "in", "protocol", ".", "receive", "(", ")", ":", "yield", "result" ]
Execute the query with optional timeout. The response to the execute query is the raw payload received from the websocket and will contain multiple dict keys and values. It is more common to call query.fetch_XXX which will filter the return result based on the method. Each result set wil...
[ "Execute", "the", "query", "with", "optional", "timeout", ".", "The", "response", "to", "the", "execute", "query", "is", "the", "raw", "payload", "received", "from", "the", "websocket", "and", "will", "contain", "multiple", "dict", "keys", "and", "values", "...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/query.py#L247-L263
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/query.py
Query.fetch_raw
def fetch_raw(self, **kw): """ Fetch the records for this query. This fetch type will return the results in raw dict format. It is possible to limit the number of receives on the socket that return results before exiting by providing max_recv. This fetch should b...
python
def fetch_raw(self, **kw): """ Fetch the records for this query. This fetch type will return the results in raw dict format. It is possible to limit the number of receives on the socket that return results before exiting by providing max_recv. This fetch should b...
[ "def", "fetch_raw", "(", "self", ",", "*", "*", "kw", ")", ":", "self", ".", "sockopt", ".", "update", "(", "kw", ")", "with", "SMCSocketProtocol", "(", "self", ",", "*", "*", "self", ".", "sockopt", ")", "as", "protocol", ":", "for", "result", "in...
Fetch the records for this query. This fetch type will return the results in raw dict format. It is possible to limit the number of receives on the socket that return results before exiting by providing max_recv. This fetch should be used if you want to return only the result re...
[ "Fetch", "the", "records", "for", "this", "query", ".", "This", "fetch", "type", "will", "return", "the", "results", "in", "raw", "dict", "format", ".", "It", "is", "possible", "to", "limit", "the", "number", "of", "receives", "on", "the", "socket", "tha...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/query.py#L265-L286
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/query.py
Query.fetch_batch
def fetch_batch(self, formatter=TableFormat, **kw): """ Fetch and return in the specified format. Output format is a formatter class in :py:mod:`smc_monitoring.models.formatters`. This fetch type will be a single shot fetch unless providing max_recv keyword with a value greater t...
python
def fetch_batch(self, formatter=TableFormat, **kw): """ Fetch and return in the specified format. Output format is a formatter class in :py:mod:`smc_monitoring.models.formatters`. This fetch type will be a single shot fetch unless providing max_recv keyword with a value greater t...
[ "def", "fetch_batch", "(", "self", ",", "formatter", "=", "TableFormat", ",", "*", "*", "kw", ")", ":", "fmt", "=", "formatter", "(", "self", ")", "if", "'max_recv'", "not", "in", "kw", ":", "kw", ".", "update", "(", "max_recv", "=", "1", ")", "for...
Fetch and return in the specified format. Output format is a formatter class in :py:mod:`smc_monitoring.models.formatters`. This fetch type will be a single shot fetch unless providing max_recv keyword with a value greater than the default of 1. Keyword arguments available are kw in :met...
[ "Fetch", "and", "return", "in", "the", "specified", "format", ".", "Output", "format", "is", "a", "formatter", "class", "in", ":", "py", ":", "mod", ":", "smc_monitoring", ".", "models", ".", "formatters", ".", "This", "fetch", "type", "will", "be", "a",...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/query.py#L288-L307
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/query.py
Query.fetch_live
def fetch_live(self, formatter=TableFormat): """ Fetch a live stream query. This is the equivalent of selecting the "Play" option for monitoring fields within the SMC UI. Data will be streamed back in real time. :param formatter: Formatter type for data representation. A...
python
def fetch_live(self, formatter=TableFormat): """ Fetch a live stream query. This is the equivalent of selecting the "Play" option for monitoring fields within the SMC UI. Data will be streamed back in real time. :param formatter: Formatter type for data representation. A...
[ "def", "fetch_live", "(", "self", ",", "formatter", "=", "TableFormat", ")", ":", "fmt", "=", "formatter", "(", "self", ")", "for", "results", "in", "self", ".", "execute", "(", ")", ":", "if", "'records'", "in", "results", "and", "results", "[", "'rec...
Fetch a live stream query. This is the equivalent of selecting the "Play" option for monitoring fields within the SMC UI. Data will be streamed back in real time. :param formatter: Formatter type for data representation. Any type in :py:mod:`smc_monitoring.models.formatters`...
[ "Fetch", "a", "live", "stream", "query", ".", "This", "is", "the", "equivalent", "of", "selecting", "the", "Play", "option", "for", "monitoring", "fields", "within", "the", "SMC", "UI", ".", "Data", "will", "be", "streamed", "back", "in", "real", "time", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/query.py#L309-L322
gabstopper/smc-python
smc/api/common.py
fetch_meta_by_name
def fetch_meta_by_name(name, filter_context=None, exact_match=True): """ Find the element based on name and optional filters. By default, the name provided uses the standard filter query. Additional filters can be used based on supported collections in the SMC API. :method: GET :param str name:...
python
def fetch_meta_by_name(name, filter_context=None, exact_match=True): """ Find the element based on name and optional filters. By default, the name provided uses the standard filter query. Additional filters can be used based on supported collections in the SMC API. :method: GET :param str name:...
[ "def", "fetch_meta_by_name", "(", "name", ",", "filter_context", "=", "None", ",", "exact_match", "=", "True", ")", ":", "result", "=", "SMCRequest", "(", "params", "=", "{", "'filter'", ":", "name", ",", "'filter_context'", ":", "filter_context", ",", "'exa...
Find the element based on name and optional filters. By default, the name provided uses the standard filter query. Additional filters can be used based on supported collections in the SMC API. :method: GET :param str name: element name, can use * as wildcard :param str filter_context: further filte...
[ "Find", "the", "element", "based", "on", "name", "and", "optional", "filters", ".", "By", "default", "the", "name", "provided", "uses", "the", "standard", "filter", "query", ".", "Additional", "filters", "can", "be", "used", "based", "on", "supported", "coll...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/common.py#L133-L155
gabstopper/smc-python
smc/administration/system.py
System.blacklist
def blacklist(self, src, dst, duration=3600, **kw): """ Add blacklist to all defined engines. Use the cidr netmask at the end of src and dst, such as: 1.1.1.1/32, etc. :param src: source of the entry :param dst: destination of blacklist entry :raises ActionComman...
python
def blacklist(self, src, dst, duration=3600, **kw): """ Add blacklist to all defined engines. Use the cidr netmask at the end of src and dst, such as: 1.1.1.1/32, etc. :param src: source of the entry :param dst: destination of blacklist entry :raises ActionComman...
[ "def", "blacklist", "(", "self", ",", "src", ",", "dst", ",", "duration", "=", "3600", ",", "*", "*", "kw", ")", ":", "self", ".", "make_request", "(", "method", "=", "'create'", ",", "resource", "=", "'blacklist'", ",", "json", "=", "prepare_blacklist...
Add blacklist to all defined engines. Use the cidr netmask at the end of src and dst, such as: 1.1.1.1/32, etc. :param src: source of the entry :param dst: destination of blacklist entry :raises ActionCommandFailed: blacklist apply failed with reason :return: None ...
[ "Add", "blacklist", "to", "all", "defined", "engines", ".", "Use", "the", "cidr", "netmask", "at", "the", "end", "of", "src", "and", "dst", "such", "as", ":", "1", ".", "1", ".", "1", ".", "1", "/", "32", "etc", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/system.py#L137-L159
gabstopper/smc-python
smc/administration/system.py
System.license_install
def license_install(self, license_file): """ Install a new license. :param str license_file: fully qualified path to the license jar file. :raises: ActionCommandFailed :return: None """ self.make_request( method='update', ...
python
def license_install(self, license_file): """ Install a new license. :param str license_file: fully qualified path to the license jar file. :raises: ActionCommandFailed :return: None """ self.make_request( method='update', ...
[ "def", "license_install", "(", "self", ",", "license_file", ")", ":", "self", ".", "make_request", "(", "method", "=", "'update'", ",", "resource", "=", "'license_install'", ",", "files", "=", "{", "'license_file'", ":", "open", "(", "license_file", ",", "'r...
Install a new license. :param str license_file: fully qualified path to the license jar file. :raises: ActionCommandFailed :return: None
[ "Install", "a", "new", "license", ".", ":", "param", "str", "license_file", ":", "fully", "qualified", "path", "to", "the", "license", "jar", "file", ".", ":", "raises", ":", "ActionCommandFailed", ":", "return", ":", "None" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/system.py#L190-L204
gabstopper/smc-python
smc/administration/system.py
System.visible_security_group_mapping
def visible_security_group_mapping(self, filter=None): # @ReservedAssignment """ Return all security groups assigned to VSS container types. This is only available on SMC >= 6.5. :param str filter: filter for searching by name :raises ActionCommandFailed: element not fo...
python
def visible_security_group_mapping(self, filter=None): # @ReservedAssignment """ Return all security groups assigned to VSS container types. This is only available on SMC >= 6.5. :param str filter: filter for searching by name :raises ActionCommandFailed: element not fo...
[ "def", "visible_security_group_mapping", "(", "self", ",", "filter", "=", "None", ")", ":", "# @ReservedAssignment", "if", "'visible_security_group_mapping'", "not", "in", "self", ".", "data", ".", "links", ":", "raise", "ResourceNotFound", "(", "'This entry point is ...
Return all security groups assigned to VSS container types. This is only available on SMC >= 6.5. :param str filter: filter for searching by name :raises ActionCommandFailed: element not found on this version of SMC :raises ResourceNotFound: unsupported method on SMC < 6.5 ...
[ "Return", "all", "security", "groups", "assigned", "to", "VSS", "container", "types", ".", "This", "is", "only", "available", "on", "SMC", ">", "=", "6", ".", "5", ".", ":", "param", "str", "filter", ":", "filter", "for", "searching", "by", "name", ":"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/system.py#L240-L254
gabstopper/smc-python
smc/administration/system.py
System.references_by_element
def references_by_element(self, element_href): """ Return all references to element specified. :param str element_href: element reference :return: list of references where element is used :rtype: list(dict) """ result = self.make_request( method='crea...
python
def references_by_element(self, element_href): """ Return all references to element specified. :param str element_href: element reference :return: list of references where element is used :rtype: list(dict) """ result = self.make_request( method='crea...
[ "def", "references_by_element", "(", "self", ",", "element_href", ")", ":", "result", "=", "self", ".", "make_request", "(", "method", "=", "'create'", ",", "resource", "=", "'references_by_element'", ",", "json", "=", "{", "'value'", ":", "element_href", "}",...
Return all references to element specified. :param str element_href: element reference :return: list of references where element is used :rtype: list(dict)
[ "Return", "all", "references", "to", "element", "specified", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/system.py#L256-L269
gabstopper/smc-python
smc/administration/system.py
System.export_elements
def export_elements(self, filename='export_elements.zip', typeof='all'): """ Export elements from SMC. Valid types are: all (All Elements)|nw (Network Elements)|ips (IPS Elements)| sv (Services)|rb (Security Policies)|al (Alerts)| vpn (VPN Elements) :param type:...
python
def export_elements(self, filename='export_elements.zip', typeof='all'): """ Export elements from SMC. Valid types are: all (All Elements)|nw (Network Elements)|ips (IPS Elements)| sv (Services)|rb (Security Policies)|al (Alerts)| vpn (VPN Elements) :param type:...
[ "def", "export_elements", "(", "self", ",", "filename", "=", "'export_elements.zip'", ",", "typeof", "=", "'all'", ")", ":", "valid_types", "=", "[", "'all'", ",", "'nw'", ",", "'ips'", ",", "'sv'", ",", "'rb'", ",", "'al'", ",", "'vpn'", "]", "if", "t...
Export elements from SMC. Valid types are: all (All Elements)|nw (Network Elements)|ips (IPS Elements)| sv (Services)|rb (Security Policies)|al (Alerts)| vpn (VPN Elements) :param type: type of element :param filename: Name of file for export :raises TaskRunFail...
[ "Export", "elements", "from", "SMC", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/system.py#L271-L290
gabstopper/smc-python
smc/administration/system.py
System.import_elements
def import_elements(self, import_file): """ Import elements into SMC. Specify the fully qualified path to the import file. :param str import_file: system level path to file :raises: ActionCommandFailed :return: None """ self.make_request( ...
python
def import_elements(self, import_file): """ Import elements into SMC. Specify the fully qualified path to the import file. :param str import_file: system level path to file :raises: ActionCommandFailed :return: None """ self.make_request( ...
[ "def", "import_elements", "(", "self", ",", "import_file", ")", ":", "self", ".", "make_request", "(", "method", "=", "'create'", ",", "resource", "=", "'import_elements'", ",", "files", "=", "{", "'import_file'", ":", "open", "(", "import_file", ",", "'rb'"...
Import elements into SMC. Specify the fully qualified path to the import file. :param str import_file: system level path to file :raises: ActionCommandFailed :return: None
[ "Import", "elements", "into", "SMC", ".", "Specify", "the", "fully", "qualified", "path", "to", "the", "import", "file", ".", ":", "param", "str", "import_file", ":", "system", "level", "path", "to", "file", ":", "raises", ":", "ActionCommandFailed", ":", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/system.py#L304-L318
gabstopper/smc-python
smc/elements/protocols.py
ProtocolAgentMixin.update_protocol_agent
def update_protocol_agent(self, protocol_agent): """ Update this service to use the specified protocol agent. After adding the protocol agent to the service you must call `update` on the element to commit. :param str,ProtocolAgent protocol_agent: protocol agent element o...
python
def update_protocol_agent(self, protocol_agent): """ Update this service to use the specified protocol agent. After adding the protocol agent to the service you must call `update` on the element to commit. :param str,ProtocolAgent protocol_agent: protocol agent element o...
[ "def", "update_protocol_agent", "(", "self", ",", "protocol_agent", ")", ":", "if", "not", "protocol_agent", ":", "for", "pa", "in", "(", "'paValues'", ",", "'protocol_agent_ref'", ")", ":", "self", ".", "data", ".", "pop", "(", "pa", ",", "None", ")", "...
Update this service to use the specified protocol agent. After adding the protocol agent to the service you must call `update` on the element to commit. :param str,ProtocolAgent protocol_agent: protocol agent element or href :return: None
[ "Update", "this", "service", "to", "use", "the", "specified", "protocol", "agent", ".", "After", "adding", "the", "protocol", "agent", "to", "the", "service", "you", "must", "call", "update", "on", "the", "element", "to", "commit", ".", ":", "param", "str"...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/protocols.py#L120-L133
gabstopper/smc-python
smc/elements/protocols.py
ProtocolAgent._get_param_values
def _get_param_values(self, name): """ Return the parameter by name as stored on the protocol agent payload. This loads the data from the local cache versus having to query the SMC for each parameter. :param str name: name of param :rtype: dict """ ...
python
def _get_param_values(self, name): """ Return the parameter by name as stored on the protocol agent payload. This loads the data from the local cache versus having to query the SMC for each parameter. :param str name: name of param :rtype: dict """ ...
[ "def", "_get_param_values", "(", "self", ",", "name", ")", ":", "for", "param", "in", "self", ".", "data", ".", "get", "(", "'paParameters'", ",", "[", "]", ")", ":", "for", "_pa_parameter", ",", "values", "in", "param", ".", "items", "(", ")", ":", ...
Return the parameter by name as stored on the protocol agent payload. This loads the data from the local cache versus having to query the SMC for each parameter. :param str name: name of param :rtype: dict
[ "Return", "the", "parameter", "by", "name", "as", "stored", "on", "the", "protocol", "agent", "payload", ".", "This", "loads", "the", "data", "from", "the", "local", "cache", "versus", "having", "to", "query", "the", "SMC", "for", "each", "parameter", ".",...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/protocols.py#L144-L156
gabstopper/smc-python
smc/elements/protocols.py
ProtocolAgent.parameters
def parameters(self): """ Protocol agent parameters are settings specific to the protocol agent type. Each protocol agent will have parameter settings that are configurable when a service uses a given protocol agent. Parameters on the protocol agent are templates that define sett...
python
def parameters(self): """ Protocol agent parameters are settings specific to the protocol agent type. Each protocol agent will have parameter settings that are configurable when a service uses a given protocol agent. Parameters on the protocol agent are templates that define sett...
[ "def", "parameters", "(", "self", ")", ":", "return", "[", "type", "(", "'ProtocolParameter'", ",", "(", "SubElement", ",", ")", ",", "{", "'data'", ":", "ElementCache", "(", "data", "=", "self", ".", "_get_param_values", "(", "param", ".", "get", "(", ...
Protocol agent parameters are settings specific to the protocol agent type. Each protocol agent will have parameter settings that are configurable when a service uses a given protocol agent. Parameters on the protocol agent are templates that define settings exposed in the service. These...
[ "Protocol", "agent", "parameters", "are", "settings", "specific", "to", "the", "protocol", "agent", "type", ".", "Each", "protocol", "agent", "will", "have", "parameter", "settings", "that", "are", "configurable", "when", "a", "service", "uses", "a", "given", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/protocols.py#L159-L172
gabstopper/smc-python
smc/elements/protocols.py
ProtocolParameterValue.protocol_parameter
def protocol_parameter(self): """ The protocol parameter defined from the base protocol agent. This is a read-only element that provides some additional context to the parameter setting. :rtype: ProtocolParameter """ for parameter in self.protocol_agent.p...
python
def protocol_parameter(self): """ The protocol parameter defined from the base protocol agent. This is a read-only element that provides some additional context to the parameter setting. :rtype: ProtocolParameter """ for parameter in self.protocol_agent.p...
[ "def", "protocol_parameter", "(", "self", ")", ":", "for", "parameter", "in", "self", ".", "protocol_agent", ".", "parameters", ":", "if", "parameter", ".", "href", "in", "self", ".", "protocol_agent_values", ".", "get", "(", "'parameter_ref'", ",", "[", "]"...
The protocol parameter defined from the base protocol agent. This is a read-only element that provides some additional context to the parameter setting. :rtype: ProtocolParameter
[ "The", "protocol", "parameter", "defined", "from", "the", "base", "protocol", "agent", ".", "This", "is", "a", "read", "-", "only", "element", "that", "provides", "some", "additional", "context", "to", "the", "parameter", "setting", ".", ":", "rtype", ":", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/protocols.py#L195-L205
gabstopper/smc-python
smc/elements/protocols.py
ProtocolParameterValue._update
def _update(self, **kwargs): """ Update the mutable field `value`. :rtype: bool """ if 'value' in kwargs and self.protocol_agent_values.get('value') != \ kwargs.get('value'): self.protocol_agent_values.update(value=kwargs['value']) ret...
python
def _update(self, **kwargs): """ Update the mutable field `value`. :rtype: bool """ if 'value' in kwargs and self.protocol_agent_values.get('value') != \ kwargs.get('value'): self.protocol_agent_values.update(value=kwargs['value']) ret...
[ "def", "_update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "'value'", "in", "kwargs", "and", "self", ".", "protocol_agent_values", ".", "get", "(", "'value'", ")", "!=", "kwargs", ".", "get", "(", "'value'", ")", ":", "self", ".", "proto...
Update the mutable field `value`. :rtype: bool
[ "Update", "the", "mutable", "field", "value", ".", ":", "rtype", ":", "bool" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/protocols.py#L248-L258
gabstopper/smc-python
smc/elements/protocols.py
ProxyServiceValue.proxy_server
def proxy_server(self): """ The ProxyServer element referenced in this protocol parameter, if any. :return: The proxy server element or None if one is not assigned :rtype: ProxyServer """ # TODO: Workaround for SMC 6.4.3 which only provides the inspected service ...
python
def proxy_server(self): """ The ProxyServer element referenced in this protocol parameter, if any. :return: The proxy server element or None if one is not assigned :rtype: ProxyServer """ # TODO: Workaround for SMC 6.4.3 which only provides the inspected service ...
[ "def", "proxy_server", "(", "self", ")", ":", "# TODO: Workaround for SMC 6.4.3 which only provides the inspected service", "# reference. We need to find the Proxy Server from this ref.", "if", "self", ".", "_inspected_service_ref", ":", "for", "proxy", "in", "ProxyServer", ".", ...
The ProxyServer element referenced in this protocol parameter, if any. :return: The proxy server element or None if one is not assigned :rtype: ProxyServer
[ "The", "ProxyServer", "element", "referenced", "in", "this", "protocol", "parameter", "if", "any", ".", ":", "return", ":", "The", "proxy", "server", "element", "or", "None", "if", "one", "is", "not", "assigned", ":", "rtype", ":", "ProxyServer" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/protocols.py#L280-L292
gabstopper/smc-python
smc/elements/protocols.py
ProxyServiceValue._update
def _update(self, **kwargs): """ Internal method to update the parameter dict stored in attribute protocol_agent_values. Allows masking of real attribute names to something more sane. :rtype: bool """ updated = False if 'proxy_server' in kwargs: ...
python
def _update(self, **kwargs): """ Internal method to update the parameter dict stored in attribute protocol_agent_values. Allows masking of real attribute names to something more sane. :rtype: bool """ updated = False if 'proxy_server' in kwargs: ...
[ "def", "_update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "updated", "=", "False", "if", "'proxy_server'", "in", "kwargs", ":", "proxy_server", "=", "kwargs", ".", "get", "(", "'proxy_server'", ")", "if", "not", "proxy_server", "and", "self", "."...
Internal method to update the parameter dict stored in attribute protocol_agent_values. Allows masking of real attribute names to something more sane. :rtype: bool
[ "Internal", "method", "to", "update", "the", "parameter", "dict", "stored", "in", "attribute", "protocol_agent_values", ".", "Allows", "masking", "of", "real", "attribute", "names", "to", "something", "more", "sane", ".", ":", "rtype", ":", "bool" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/protocols.py#L294-L320
gabstopper/smc-python
smc/elements/protocols.py
ProtocolAgentValues.update
def update(self, name, **kwargs): """ Update protocol agent parameters based on the parameter name. Provide the relevant keyword pairs based on the parameter type. When update is called, a boolean is returned indicating whether the field was successfully updated or not. You shoul...
python
def update(self, name, **kwargs): """ Update protocol agent parameters based on the parameter name. Provide the relevant keyword pairs based on the parameter type. When update is called, a boolean is returned indicating whether the field was successfully updated or not. You shoul...
[ "def", "update", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "for", "value", "in", "self", ".", "items", ":", "if", "value", ".", "name", "==", "name", ":", "return", "value", ".", "_update", "(", "*", "*", "kwargs", ")", "return...
Update protocol agent parameters based on the parameter name. Provide the relevant keyword pairs based on the parameter type. When update is called, a boolean is returned indicating whether the field was successfully updated or not. You should check the return value and call `update` on ...
[ "Update", "protocol", "agent", "parameters", "based", "on", "the", "parameter", "name", ".", "Provide", "the", "relevant", "keyword", "pairs", "based", "on", "the", "parameter", "type", ".", "When", "update", "is", "called", "a", "boolean", "is", "returned", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/protocols.py#L418-L456
gabstopper/smc-python
smc/routing/route_map.py
MatchCondition.add_access_list
def add_access_list(self, accesslist, rank=None): """ Add an access list to the match condition. Valid access list types are IPAccessList (v4 and v6), IPPrefixList (v4 and v6), AS Path, CommunityAccessList, ExtendedCommunityAccessList. """ self.conditions.append( ...
python
def add_access_list(self, accesslist, rank=None): """ Add an access list to the match condition. Valid access list types are IPAccessList (v4 and v6), IPPrefixList (v4 and v6), AS Path, CommunityAccessList, ExtendedCommunityAccessList. """ self.conditions.append( ...
[ "def", "add_access_list", "(", "self", ",", "accesslist", ",", "rank", "=", "None", ")", ":", "self", ".", "conditions", ".", "append", "(", "dict", "(", "access_list_ref", "=", "accesslist", ".", "href", ",", "type", "=", "'element'", ",", "rank", "=", ...
Add an access list to the match condition. Valid access list types are IPAccessList (v4 and v6), IPPrefixList (v4 and v6), AS Path, CommunityAccessList, ExtendedCommunityAccessList.
[ "Add", "an", "access", "list", "to", "the", "match", "condition", ".", "Valid", "access", "list", "types", "are", "IPAccessList", "(", "v4", "and", "v6", ")", "IPPrefixList", "(", "v4", "and", "v6", ")", "AS", "Path", "CommunityAccessList", "ExtendedCommunit...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/route_map.py#L142-L152
gabstopper/smc-python
smc/routing/route_map.py
MatchCondition.add_metric
def add_metric(self, value, rank=None): """ Add a metric to this match condition :param int value: metric value """ self.conditions.append( dict(metric=value, type='metric', rank=rank))
python
def add_metric(self, value, rank=None): """ Add a metric to this match condition :param int value: metric value """ self.conditions.append( dict(metric=value, type='metric', rank=rank))
[ "def", "add_metric", "(", "self", ",", "value", ",", "rank", "=", "None", ")", ":", "self", ".", "conditions", ".", "append", "(", "dict", "(", "metric", "=", "value", ",", "type", "=", "'metric'", ",", "rank", "=", "rank", ")", ")" ]
Add a metric to this match condition :param int value: metric value
[ "Add", "a", "metric", "to", "this", "match", "condition", ":", "param", "int", "value", ":", "metric", "value" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/route_map.py#L154-L161
gabstopper/smc-python
smc/routing/route_map.py
MatchCondition.add_next_hop
def add_next_hop(self, access_or_prefix_list, rank=None): """ Add a next hop condition. Next hop elements must be of type IPAccessList or IPPrefixList. :raises ElementNotFound: If element specified does not exist """ self.conditions.append(dict( next_...
python
def add_next_hop(self, access_or_prefix_list, rank=None): """ Add a next hop condition. Next hop elements must be of type IPAccessList or IPPrefixList. :raises ElementNotFound: If element specified does not exist """ self.conditions.append(dict( next_...
[ "def", "add_next_hop", "(", "self", ",", "access_or_prefix_list", ",", "rank", "=", "None", ")", ":", "self", ".", "conditions", ".", "append", "(", "dict", "(", "next_hop_ref", "=", "access_or_prefix_list", ".", "href", ",", "type", "=", "'next_hop'", ",", ...
Add a next hop condition. Next hop elements must be of type IPAccessList or IPPrefixList. :raises ElementNotFound: If element specified does not exist
[ "Add", "a", "next", "hop", "condition", ".", "Next", "hop", "elements", "must", "be", "of", "type", "IPAccessList", "or", "IPPrefixList", ".", ":", "raises", "ElementNotFound", ":", "If", "element", "specified", "does", "not", "exist" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/route_map.py#L163-L173
gabstopper/smc-python
smc/routing/route_map.py
MatchCondition.add_peer_address
def add_peer_address(self, ext_bgp_peer_or_fw, rank=None): """ Add a peer address. Peer address types are ExternalBGPPeer or Engine. :raises ElementNotFound: If element specified does not exist """ if ext_bgp_peer_or_fw.typeof == 'external_bgp_peer': ...
python
def add_peer_address(self, ext_bgp_peer_or_fw, rank=None): """ Add a peer address. Peer address types are ExternalBGPPeer or Engine. :raises ElementNotFound: If element specified does not exist """ if ext_bgp_peer_or_fw.typeof == 'external_bgp_peer': ...
[ "def", "add_peer_address", "(", "self", ",", "ext_bgp_peer_or_fw", ",", "rank", "=", "None", ")", ":", "if", "ext_bgp_peer_or_fw", ".", "typeof", "==", "'external_bgp_peer'", ":", "ref", "=", "'external_bgp_peer_address_ref'", "else", ":", "# engine", "ref", "=", ...
Add a peer address. Peer address types are ExternalBGPPeer or Engine. :raises ElementNotFound: If element specified does not exist
[ "Add", "a", "peer", "address", ".", "Peer", "address", "types", "are", "ExternalBGPPeer", "or", "Engine", ".", ":", "raises", "ElementNotFound", ":", "If", "element", "specified", "does", "not", "exist" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/route_map.py#L175-L189
gabstopper/smc-python
smc/routing/route_map.py
MatchCondition.remove_condition
def remove_condition(self, rank): """ Remove a condition element using it's rank. You can find the rank and element for a match condition by iterating the match condition:: >>> rule1 = rm.route_map_rules.get(0) >>> for condition in rule1.match_condition: ...
python
def remove_condition(self, rank): """ Remove a condition element using it's rank. You can find the rank and element for a match condition by iterating the match condition:: >>> rule1 = rm.route_map_rules.get(0) >>> for condition in rule1.match_condition: ...
[ "def", "remove_condition", "(", "self", ",", "rank", ")", ":", "self", ".", "conditions", "[", ":", "]", "=", "[", "r", "for", "r", "in", "self", ".", "conditions", "if", "r", ".", "get", "(", "'rank'", ")", "!=", "rank", "]" ]
Remove a condition element using it's rank. You can find the rank and element for a match condition by iterating the match condition:: >>> rule1 = rm.route_map_rules.get(0) >>> for condition in rule1.match_condition: ... condition ... ...
[ "Remove", "a", "condition", "element", "using", "it", "s", "rank", ".", "You", "can", "find", "the", "rank", "and", "element", "for", "a", "match", "condition", "by", "iterating", "the", "match", "condition", "::", ">>>", "rule1", "=", "rm", ".", "route_...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/route_map.py#L191-L213
gabstopper/smc-python
smc/routing/route_map.py
RouteMapRule.create
def create(self, name, action='permit', goto=None, finish=False, call=None, comment=None, add_pos=None, after=None, before=None, **match_condition): """ Create a route map rule. You can provide match conditions by using keyword arguments specifying the required type...
python
def create(self, name, action='permit', goto=None, finish=False, call=None, comment=None, add_pos=None, after=None, before=None, **match_condition): """ Create a route map rule. You can provide match conditions by using keyword arguments specifying the required type...
[ "def", "create", "(", "self", ",", "name", ",", "action", "=", "'permit'", ",", "goto", "=", "None", ",", "finish", "=", "False", ",", "call", "=", "None", ",", "comment", "=", "None", ",", "add_pos", "=", "None", ",", "after", "=", "None", ",", ...
Create a route map rule. You can provide match conditions by using keyword arguments specifying the required types. You can also create the route map rule and add match conditions after. :param str name: name for this rule :param str action: permit or deny :param...
[ "Create", "a", "route", "map", "rule", ".", "You", "can", "provide", "match", "conditions", "by", "using", "keyword", "arguments", "specifying", "the", "required", "types", ".", "You", "can", "also", "create", "the", "route", "map", "rule", "and", "add", "...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/route_map.py#L229-L307
gabstopper/smc-python
smc/routing/route_map.py
RouteMap.search_rule
def search_rule(self, search): """ Search the RouteMap policy using a search string :param str search: search string for a contains match against the rule name and comments field :rtype: list(RouteMapRule) """ return [RouteMapRule(**rule) for rule in ...
python
def search_rule(self, search): """ Search the RouteMap policy using a search string :param str search: search string for a contains match against the rule name and comments field :rtype: list(RouteMapRule) """ return [RouteMapRule(**rule) for rule in ...
[ "def", "search_rule", "(", "self", ",", "search", ")", ":", "return", "[", "RouteMapRule", "(", "*", "*", "rule", ")", "for", "rule", "in", "self", ".", "make_request", "(", "resource", "=", "'search_rule'", ",", "params", "=", "{", "'filter'", ":", "s...
Search the RouteMap policy using a search string :param str search: search string for a contains match against the rule name and comments field :rtype: list(RouteMapRule)
[ "Search", "the", "RouteMap", "policy", "using", "a", "search", "string", ":", "param", "str", "search", ":", "search", "string", "for", "a", "contains", "match", "against", "the", "rule", "name", "and", "comments", "field", ":", "rtype", ":", "list", "(", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/route_map.py#L447-L456
gabstopper/smc-python
smc/administration/certificates/vpn.py
VPNCertificateCA.create
def create(cls, name, certificate): """ Create a new external VPN CA for signing internal gateway certificates. :param str name: Name of VPN CA :param str certificate: file name, path or certificate string. :raises CreateElementFailed: Failed creating cert with r...
python
def create(cls, name, certificate): """ Create a new external VPN CA for signing internal gateway certificates. :param str name: Name of VPN CA :param str certificate: file name, path or certificate string. :raises CreateElementFailed: Failed creating cert with r...
[ "def", "create", "(", "cls", ",", "name", ",", "certificate", ")", ":", "json", "=", "{", "'name'", ":", "name", ",", "'certificate'", ":", "certificate", "}", "return", "ElementCreator", "(", "cls", ",", "json", ")" ]
Create a new external VPN CA for signing internal gateway certificates. :param str name: Name of VPN CA :param str certificate: file name, path or certificate string. :raises CreateElementFailed: Failed creating cert with reason :rtype: VPNCertificateCA
[ "Create", "a", "new", "external", "VPN", "CA", "for", "signing", "internal", "gateway", "certificates", ".", ":", "param", "str", "name", ":", "Name", "of", "VPN", "CA", ":", "param", "str", "certificate", ":", "file", "name", "path", "or", "certificate", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/vpn.py#L28-L41
gabstopper/smc-python
smc/administration/certificates/vpn.py
GatewayCertificate._create
def _create(self, common_name, public_key_algorithm='rsa', signature_algorithm='rsa_sha_512', key_length=2048, signing_ca=None): """ Internal method called as a reference from the engine.vpn node """ if signing_ca is None: signing_ca = VPNCerti...
python
def _create(self, common_name, public_key_algorithm='rsa', signature_algorithm='rsa_sha_512', key_length=2048, signing_ca=None): """ Internal method called as a reference from the engine.vpn node """ if signing_ca is None: signing_ca = VPNCerti...
[ "def", "_create", "(", "self", ",", "common_name", ",", "public_key_algorithm", "=", "'rsa'", ",", "signature_algorithm", "=", "'rsa_sha_512'", ",", "key_length", "=", "2048", ",", "signing_ca", "=", "None", ")", ":", "if", "signing_ca", "is", "None", ":", "...
Internal method called as a reference from the engine.vpn node
[ "Internal", "method", "called", "as", "a", "reference", "from", "the", "engine", ".", "vpn", "node" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/vpn.py#L59-L80
gabstopper/smc-python
smc/elements/service.py
TCPService.create
def create(cls, name, min_dst_port, max_dst_port=None, min_src_port=None, max_src_port=None, protocol_agent=None, comment=None): """ Create the TCP service :param str name: name of tcp service :param int min_dst_port: minimum destination port value :param int max_...
python
def create(cls, name, min_dst_port, max_dst_port=None, min_src_port=None, max_src_port=None, protocol_agent=None, comment=None): """ Create the TCP service :param str name: name of tcp service :param int min_dst_port: minimum destination port value :param int max_...
[ "def", "create", "(", "cls", ",", "name", ",", "min_dst_port", ",", "max_dst_port", "=", "None", ",", "min_src_port", "=", "None", ",", "max_src_port", "=", "None", ",", "protocol_agent", "=", "None", ",", "comment", "=", "None", ")", ":", "max_dst_port", ...
Create the TCP service :param str name: name of tcp service :param int min_dst_port: minimum destination port value :param int max_dst_port: maximum destination port value :param int min_src_port: minimum source port value :param int max_src_port: maximum source port value ...
[ "Create", "the", "TCP", "service" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/service.py#L40-L66
gabstopper/smc-python
smc/elements/service.py
IPService.create
def create(cls, name, protocol_number, protocol_agent=None, comment=None): """ Create the IP Service :param str name: name of ip-service :param int protocol_number: ip proto number for this service :param str,ProtocolAgent protocol_agent: optional protocol agent for ...
python
def create(cls, name, protocol_number, protocol_agent=None, comment=None): """ Create the IP Service :param str name: name of ip-service :param int protocol_number: ip proto number for this service :param str,ProtocolAgent protocol_agent: optional protocol agent for ...
[ "def", "create", "(", "cls", ",", "name", ",", "protocol_number", ",", "protocol_agent", "=", "None", ",", "comment", "=", "None", ")", ":", "json", "=", "{", "'name'", ":", "name", ",", "'protocol_number'", ":", "protocol_number", ",", "'protocol_agent_ref'...
Create the IP Service :param str name: name of ip-service :param int protocol_number: ip proto number for this service :param str,ProtocolAgent protocol_agent: optional protocol agent for this service :param str comment: optional comment :raises CreateElementFailed: ...
[ "Create", "the", "IP", "Service" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/service.py#L138-L156
gabstopper/smc-python
smc/elements/service.py
EthernetService.create
def create(cls, name, frame_type='eth2', value1=None, comment=None): """ Create an ethernet service :param str name: name of service :param str frame_type: ethernet frame type, eth2 :param str value1: hex code representing ethertype field :param str comment: optional com...
python
def create(cls, name, frame_type='eth2', value1=None, comment=None): """ Create an ethernet service :param str name: name of service :param str frame_type: ethernet frame type, eth2 :param str value1: hex code representing ethertype field :param str comment: optional com...
[ "def", "create", "(", "cls", ",", "name", ",", "frame_type", "=", "'eth2'", ",", "value1", "=", "None", ",", "comment", "=", "None", ")", ":", "json", "=", "{", "'frame_type'", ":", "frame_type", ",", "'name'", ":", "name", ",", "'value1'", ":", "int...
Create an ethernet service :param str name: name of service :param str frame_type: ethernet frame type, eth2 :param str value1: hex code representing ethertype field :param str comment: optional comment :raises CreateElementFailed: failure creating element with reason :r...
[ "Create", "an", "ethernet", "service" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/service.py#L188-L205
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/calendar.py
TimeFormat.custom_range
def custom_range(self, start_time, end_time=None): """ Provide a custom range for the search query. Start time and end time are expected to be naive ``datetime`` objects converted to milliseconds. When submitting the query, it is strongly recommended to set the timezone matching...
python
def custom_range(self, start_time, end_time=None): """ Provide a custom range for the search query. Start time and end time are expected to be naive ``datetime`` objects converted to milliseconds. When submitting the query, it is strongly recommended to set the timezone matching...
[ "def", "custom_range", "(", "self", ",", "start_time", ",", "end_time", "=", "None", ")", ":", "if", "end_time", "is", "None", ":", "end_time", "=", "current_millis", "(", ")", "self", ".", "data", ".", "update", "(", "start_ms", "=", "start_time", ",", ...
Provide a custom range for the search query. Start time and end time are expected to be naive ``datetime`` objects converted to milliseconds. When submitting the query, it is strongly recommended to set the timezone matching the local client making the query. Example of finding...
[ "Provide", "a", "custom", "range", "for", "the", "search", "query", ".", "Start", "time", "and", "end", "time", "are", "expected", "to", "be", "naive", "datetime", "objects", "converted", "to", "milliseconds", ".", "When", "submitting", "the", "query", "it",...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/calendar.py#L147-L195
gabstopper/smc-python
smc/administration/certificates/tls_common.py
pem_as_string
def pem_as_string(cert): """ Only return False if the certificate is a file path. Otherwise it is a file object or raw string and will need to be fed to the file open context. """ if hasattr(cert, 'read'): # File object - return as is return cert cert = cert.encode('utf-8') if isinst...
python
def pem_as_string(cert): """ Only return False if the certificate is a file path. Otherwise it is a file object or raw string and will need to be fed to the file open context. """ if hasattr(cert, 'read'): # File object - return as is return cert cert = cert.encode('utf-8') if isinst...
[ "def", "pem_as_string", "(", "cert", ")", ":", "if", "hasattr", "(", "cert", ",", "'read'", ")", ":", "# File object - return as is", "return", "cert", "cert", "=", "cert", ".", "encode", "(", "'utf-8'", ")", "if", "isinstance", "(", "cert", ",", "unicode"...
Only return False if the certificate is a file path. Otherwise it is a file object or raw string and will need to be fed to the file open context.
[ "Only", "return", "False", "if", "the", "certificate", "is", "a", "file", "path", ".", "Otherwise", "it", "is", "a", "file", "object", "or", "raw", "string", "and", "will", "need", "to", "be", "fed", "to", "the", "file", "open", "context", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls_common.py#L20-L31
gabstopper/smc-python
smc/administration/certificates/tls_common.py
load_cert_chain
def load_cert_chain(chain_file): """ Load the certificates from the chain file. :raises IOError: Failure to read specified file :raises ValueError: Format issues with chain file or missing entries :return: list of cert type matches """ if hasattr(chain_file, 'read'): cert_chain...
python
def load_cert_chain(chain_file): """ Load the certificates from the chain file. :raises IOError: Failure to read specified file :raises ValueError: Format issues with chain file or missing entries :return: list of cert type matches """ if hasattr(chain_file, 'read'): cert_chain...
[ "def", "load_cert_chain", "(", "chain_file", ")", ":", "if", "hasattr", "(", "chain_file", ",", "'read'", ")", ":", "cert_chain", "=", "chain_file", ".", "read", "(", ")", "else", ":", "with", "open", "(", "chain_file", ",", "'rb'", ")", "as", "f", ":"...
Load the certificates from the chain file. :raises IOError: Failure to read specified file :raises ValueError: Format issues with chain file or missing entries :return: list of cert type matches
[ "Load", "the", "certificates", "from", "the", "chain", "file", ".", ":", "raises", "IOError", ":", "Failure", "to", "read", "specified", "file", ":", "raises", "ValueError", ":", "Format", "issues", "with", "chain", "file", "or", "missing", "entries", ":", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls_common.py#L34-L59
gabstopper/smc-python
smc/administration/certificates/tls_common.py
ImportExportCertificate.import_certificate
def import_certificate(self, certificate): """ Import a valid certificate. Certificate can be either a file path or a string of the certificate. If string certificate, it must include the -----BEGIN CERTIFICATE----- string. :param str certificate_file: fully qualified pa...
python
def import_certificate(self, certificate): """ Import a valid certificate. Certificate can be either a file path or a string of the certificate. If string certificate, it must include the -----BEGIN CERTIFICATE----- string. :param str certificate_file: fully qualified pa...
[ "def", "import_certificate", "(", "self", ",", "certificate", ")", ":", "multi_part", "=", "'signed_certificate'", "if", "self", ".", "typeof", "==", "'tls_server_credentials'", "else", "'certificate'", "self", ".", "make_request", "(", "CertificateImportError", ",", ...
Import a valid certificate. Certificate can be either a file path or a string of the certificate. If string certificate, it must include the -----BEGIN CERTIFICATE----- string. :param str certificate_file: fully qualified path to certificate file :raises CertificateImportError: ...
[ "Import", "a", "valid", "certificate", ".", "Certificate", "can", "be", "either", "a", "file", "path", "or", "a", "string", "of", "the", "certificate", ".", "If", "string", "certificate", "it", "must", "include", "the", "-----", "BEGIN", "CERTIFICATE", "----...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls_common.py#L67-L88
gabstopper/smc-python
smc/administration/certificates/tls_common.py
ImportExportIntermediate.import_intermediate_certificate
def import_intermediate_certificate(self, certificate): """ Import a valid certificate. Certificate can be either a file path or a string of the certificate. If string certificate, it must include the -----BEGIN CERTIFICATE----- string. :param str certificate: fully qual...
python
def import_intermediate_certificate(self, certificate): """ Import a valid certificate. Certificate can be either a file path or a string of the certificate. If string certificate, it must include the -----BEGIN CERTIFICATE----- string. :param str certificate: fully qual...
[ "def", "import_intermediate_certificate", "(", "self", ",", "certificate", ")", ":", "self", ".", "make_request", "(", "CertificateImportError", ",", "method", "=", "'create'", ",", "resource", "=", "'intermediate_certificate_import'", ",", "headers", "=", "{", "'co...
Import a valid certificate. Certificate can be either a file path or a string of the certificate. If string certificate, it must include the -----BEGIN CERTIFICATE----- string. :param str certificate: fully qualified path or string :raises CertificateImportError: failure to imp...
[ "Import", "a", "valid", "certificate", ".", "Certificate", "can", "be", "either", "a", "file", "path", "or", "a", "string", "of", "the", "certificate", ".", "If", "string", "certificate", "it", "must", "include", "the", "-----", "BEGIN", "CERTIFICATE", "----...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls_common.py#L116-L135
gabstopper/smc-python
smc/administration/certificates/tls_common.py
ImportExportIntermediate.export_intermediate_certificate
def export_intermediate_certificate(self, filename=None): """ Export the intermediate certificate. Returned certificate will be in string format. If filename is provided, the certificate will also be saved to the file specified. :raises CertificateExportError: error expo...
python
def export_intermediate_certificate(self, filename=None): """ Export the intermediate certificate. Returned certificate will be in string format. If filename is provided, the certificate will also be saved to the file specified. :raises CertificateExportError: error expo...
[ "def", "export_intermediate_certificate", "(", "self", ",", "filename", "=", "None", ")", ":", "result", "=", "self", ".", "make_request", "(", "CertificateExportError", ",", "raw_result", "=", "True", ",", "resource", "=", "'intermediate_certificate_export'", ")", ...
Export the intermediate certificate. Returned certificate will be in string format. If filename is provided, the certificate will also be saved to the file specified. :raises CertificateExportError: error exporting certificate, can occur if no intermediate certificate is ava...
[ "Export", "the", "intermediate", "certificate", ".", "Returned", "certificate", "will", "be", "in", "string", "format", ".", "If", "filename", "is", "provided", "the", "certificate", "will", "also", "be", "saved", "to", "the", "file", "specified", ".", ":", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls_common.py#L137-L156
gabstopper/smc-python
smc/administration/certificates/tls_common.py
ImportPrivateKey.import_private_key
def import_private_key(self, private_key): """ Import a private key. The private key can be a path to a file or the key in string format. If in string format, the key must start with -----BEGIN. Key types supported are PRIVATE RSA KEY and PRIVATE KEY. :param str ...
python
def import_private_key(self, private_key): """ Import a private key. The private key can be a path to a file or the key in string format. If in string format, the key must start with -----BEGIN. Key types supported are PRIVATE RSA KEY and PRIVATE KEY. :param str ...
[ "def", "import_private_key", "(", "self", ",", "private_key", ")", ":", "self", ".", "make_request", "(", "CertificateImportError", ",", "method", "=", "'create'", ",", "resource", "=", "'private_key_import'", ",", "headers", "=", "{", "'content-type'", ":", "'m...
Import a private key. The private key can be a path to a file or the key in string format. If in string format, the key must start with -----BEGIN. Key types supported are PRIVATE RSA KEY and PRIVATE KEY. :param str private_key: fully qualified path to private key file :...
[ "Import", "a", "private", "key", ".", "The", "private", "key", "can", "be", "a", "path", "to", "a", "file", "or", "the", "key", "in", "string", "format", ".", "If", "in", "string", "format", "the", "key", "must", "start", "with", "-----", "BEGIN", "....
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls_common.py#L164-L184
gabstopper/smc-python
smc/api/entry_point.py
Resource.get
def get(self, rel): """ Get the resource by rel name :param str rel_name: name of rel :raises UnsupportedEntryPoint: entry point not found in this version of the API """ for link in self._entry_points: if link.get('rel') == rel: ...
python
def get(self, rel): """ Get the resource by rel name :param str rel_name: name of rel :raises UnsupportedEntryPoint: entry point not found in this version of the API """ for link in self._entry_points: if link.get('rel') == rel: ...
[ "def", "get", "(", "self", ",", "rel", ")", ":", "for", "link", "in", "self", ".", "_entry_points", ":", "if", "link", ".", "get", "(", "'rel'", ")", "==", "rel", ":", "return", "link", ".", "get", "(", "'href'", ")", "raise", "UnsupportedEntryPoint"...
Get the resource by rel name :param str rel_name: name of rel :raises UnsupportedEntryPoint: entry point not found in this version of the API
[ "Get", "the", "resource", "by", "rel", "name", ":", "param", "str", "rel_name", ":", "name", "of", "rel", ":", "raises", "UnsupportedEntryPoint", ":", "entry", "point", "not", "found", "in", "this", "version", "of", "the", "API" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/entry_point.py#L45-L60
gabstopper/smc-python
smc-monitoring/smc_monitoring/wsocket.py
SMCSocketProtocol.on_open
def on_open(self): """ Once the connection is made, start the query off and start an event loop to wait for a signal to stop. Results are yielded within receive(). """ def event_loop(): logger.debug(pformat(self.query.request)) self.send(json.dumps...
python
def on_open(self): """ Once the connection is made, start the query off and start an event loop to wait for a signal to stop. Results are yielded within receive(). """ def event_loop(): logger.debug(pformat(self.query.request)) self.send(json.dumps...
[ "def", "on_open", "(", "self", ")", ":", "def", "event_loop", "(", ")", ":", "logger", ".", "debug", "(", "pformat", "(", "self", ".", "query", ".", "request", ")", ")", "self", ".", "send", "(", "json", ".", "dumps", "(", "self", ".", "query", "...
Once the connection is made, start the query off and start an event loop to wait for a signal to stop. Results are yielded within receive().
[ "Once", "the", "connection", "is", "made", "start", "the", "query", "off", "and", "start", "an", "event", "loop", "to", "wait", "for", "a", "signal", "to", "stop", ".", "Results", "are", "yielded", "within", "receive", "()", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/wsocket.py#L133-L151
gabstopper/smc-python
smc-monitoring/smc_monitoring/wsocket.py
SMCSocketProtocol.send_message
def send_message(self, message): """ Send a message down the socket. The message is expected to have a `request` attribute that holds the message to be serialized and sent. """ if self.connected: self.send( json.dumps(message.request))
python
def send_message(self, message): """ Send a message down the socket. The message is expected to have a `request` attribute that holds the message to be serialized and sent. """ if self.connected: self.send( json.dumps(message.request))
[ "def", "send_message", "(", "self", ",", "message", ")", ":", "if", "self", ".", "connected", ":", "self", ".", "send", "(", "json", ".", "dumps", "(", "message", ".", "request", ")", ")" ]
Send a message down the socket. The message is expected to have a `request` attribute that holds the message to be serialized and sent.
[ "Send", "a", "message", "down", "the", "socket", ".", "The", "message", "is", "expected", "to", "have", "a", "request", "attribute", "that", "holds", "the", "message", "to", "be", "serialized", "and", "sent", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/wsocket.py#L153-L161
gabstopper/smc-python
smc-monitoring/smc_monitoring/wsocket.py
SMCSocketProtocol.receive
def receive(self): """ Generator yielding results from the web socket. Results will come as they are received. Even though socket select has a timeout, the SMC will not reply with a message more than every two minutes. """ try: itr = 0 whil...
python
def receive(self): """ Generator yielding results from the web socket. Results will come as they are received. Even though socket select has a timeout, the SMC will not reply with a message more than every two minutes. """ try: itr = 0 whil...
[ "def", "receive", "(", "self", ")", ":", "try", ":", "itr", "=", "0", "while", "self", ".", "connected", ":", "r", ",", "w", ",", "e", "=", "select", ".", "select", "(", "(", "self", ".", "sock", ",", ")", ",", "(", ")", ",", "(", ")", ",",...
Generator yielding results from the web socket. Results will come as they are received. Even though socket select has a timeout, the SMC will not reply with a message more than every two minutes.
[ "Generator", "yielding", "results", "from", "the", "web", "socket", ".", "Results", "will", "come", "as", "they", "are", "received", ".", "Even", "though", "socket", "select", "has", "a", "timeout", "the", "SMC", "will", "not", "reply", "with", "a", "messa...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/wsocket.py#L170-L228
gabstopper/smc-python
smc/base/model.py
LoadElement
def LoadElement(href, only_etag=False): """ Return an instance of a element as a ElementCache dict used as a cache. :rtype ElementCache """ request = SMCRequest(href=href) request.exception = FetchElementFailed result = request.read() if only_etag: return result.etag ...
python
def LoadElement(href, only_etag=False): """ Return an instance of a element as a ElementCache dict used as a cache. :rtype ElementCache """ request = SMCRequest(href=href) request.exception = FetchElementFailed result = request.read() if only_etag: return result.etag ...
[ "def", "LoadElement", "(", "href", ",", "only_etag", "=", "False", ")", ":", "request", "=", "SMCRequest", "(", "href", "=", "href", ")", "request", ".", "exception", "=", "FetchElementFailed", "result", "=", "request", ".", "read", "(", ")", "if", "only...
Return an instance of a element as a ElementCache dict used as a cache. :rtype ElementCache
[ "Return", "an", "instance", "of", "a", "element", "as", "a", "ElementCache", "dict", "used", "as", "a", "cache", ".", ":", "rtype", "ElementCache" ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L80-L93
gabstopper/smc-python
smc/base/model.py
ElementCreator
def ElementCreator(cls, json, **kwargs): """ Helper method for creating elements. If the created element type is a SubElement class type, provide href value as kwargs since that class type does not have a direct entry point. This is a lazy load that will provide only the meta for the element. Additi...
python
def ElementCreator(cls, json, **kwargs): """ Helper method for creating elements. If the created element type is a SubElement class type, provide href value as kwargs since that class type does not have a direct entry point. This is a lazy load that will provide only the meta for the element. Additi...
[ "def", "ElementCreator", "(", "cls", ",", "json", ",", "*", "*", "kwargs", ")", ":", "if", "'exception'", "not", "in", "kwargs", ":", "kwargs", ".", "update", "(", "exception", "=", "CreateElementFailed", ")", "href", "=", "kwargs", ".", "pop", "(", "'...
Helper method for creating elements. If the created element type is a SubElement class type, provide href value as kwargs since that class type does not have a direct entry point. This is a lazy load that will provide only the meta for the element. Additional attribute access will load the full data. ...
[ "Helper", "method", "for", "creating", "elements", ".", "If", "the", "created", "element", "type", "is", "a", "SubElement", "class", "type", "provide", "href", "value", "as", "kwargs", "since", "that", "class", "type", "does", "not", "have", "a", "direct", ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L97-L127
gabstopper/smc-python
smc/base/model.py
ElementFactory
def ElementFactory(href, smcresult=None, raise_exc=None): """ Factory returns an object of type Element when only the href is provided. :param str href: string href to fetch :param SMCResult smcresult: optional SMCResult. If provided, the request fetch will be skipped :param Excepti...
python
def ElementFactory(href, smcresult=None, raise_exc=None): """ Factory returns an object of type Element when only the href is provided. :param str href: string href to fetch :param SMCResult smcresult: optional SMCResult. If provided, the request fetch will be skipped :param Excepti...
[ "def", "ElementFactory", "(", "href", ",", "smcresult", "=", "None", ",", "raise_exc", "=", "None", ")", ":", "if", "smcresult", "is", "None", ":", "smcresult", "=", "SMCRequest", "(", "href", "=", "href", ")", ".", "read", "(", ")", "if", "smcresult",...
Factory returns an object of type Element when only the href is provided. :param str href: string href to fetch :param SMCResult smcresult: optional SMCResult. If provided, the request fetch will be skipped :param Exception raise_exc: exception to raise if fetch failed
[ "Factory", "returns", "an", "object", "of", "type", "Element", "when", "only", "the", "href", "is", "provided", ".", ":", "param", "str", "href", ":", "string", "href", "to", "fetch", ":", "param", "SMCResult", "smcresult", ":", "optional", "SMCResult", "....
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L130-L153
gabstopper/smc-python
smc/base/model.py
ElementCache.etag
def etag(self, href): """ ETag can be None if a subset of element json is using this container, such as the case with Routing. """ if self and self._etag is None: self._etag = LoadElement(href, only_etag=True) return self._etag
python
def etag(self, href): """ ETag can be None if a subset of element json is using this container, such as the case with Routing. """ if self and self._etag is None: self._etag = LoadElement(href, only_etag=True) return self._etag
[ "def", "etag", "(", "self", ",", "href", ")", ":", "if", "self", "and", "self", ".", "_etag", "is", "None", ":", "self", ".", "_etag", "=", "LoadElement", "(", "href", ",", "only_etag", "=", "True", ")", "return", "self", ".", "_etag" ]
ETag can be None if a subset of element json is using this container, such as the case with Routing.
[ "ETag", "can", "be", "None", "if", "a", "subset", "of", "element", "json", "is", "using", "this", "container", "such", "as", "the", "case", "with", "Routing", "." ]
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L162-L169