id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 51 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
251,100 | F5Networks/f5-common-python | f5/utils/iapp_parser.py | IappParser._get_section_end_index | def _get_section_end_index(self, section, section_start):
'''Get end of section's content.
In the loop to match braces, we must not count curly braces that are
within a doubly quoted string.
:param section: string name of section
:param section_start: integer index of section's... | python | def _get_section_end_index(self, section, section_start):
'''Get end of section's content.
In the loop to match braces, we must not count curly braces that are
within a doubly quoted string.
:param section: string name of section
:param section_start: integer index of section's... | [
"def",
"_get_section_end_index",
"(",
"self",
",",
"section",
",",
"section_start",
")",
":",
"brace_count",
"=",
"0",
"in_quote",
"=",
"False",
"in_escape",
"=",
"False",
"for",
"index",
",",
"char",
"in",
"enumerate",
"(",
"self",
".",
"template_str",
"[",... | Get end of section's content.
In the loop to match braces, we must not count curly braces that are
within a doubly quoted string.
:param section: string name of section
:param section_start: integer index of section's beginning
:return: integer index of section's end
:r... | [
"Get",
"end",
"of",
"section",
"s",
"content",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/iapp_parser.py#L80-L129 |
251,101 | F5Networks/f5-common-python | f5/utils/iapp_parser.py | IappParser._get_section_start_index | def _get_section_start_index(self, section):
'''Get start of a section's content.
:param section: string name of section
:return: integer index of section's beginning
:raises: NonextantSectionException
'''
sec_start_re = r'%s\s*\{' % section
found = re.search(s... | python | def _get_section_start_index(self, section):
'''Get start of a section's content.
:param section: string name of section
:return: integer index of section's beginning
:raises: NonextantSectionException
'''
sec_start_re = r'%s\s*\{' % section
found = re.search(s... | [
"def",
"_get_section_start_index",
"(",
"self",
",",
"section",
")",
":",
"sec_start_re",
"=",
"r'%s\\s*\\{'",
"%",
"section",
"found",
"=",
"re",
".",
"search",
"(",
"sec_start_re",
",",
"self",
".",
"template_str",
")",
"if",
"found",
":",
"return",
"found... | Get start of a section's content.
:param section: string name of section
:return: integer index of section's beginning
:raises: NonextantSectionException | [
"Get",
"start",
"of",
"a",
"section",
"s",
"content",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/iapp_parser.py#L131-L147 |
251,102 | F5Networks/f5-common-python | f5/utils/iapp_parser.py | IappParser._get_template_name | def _get_template_name(self):
'''Find template name.
:returns: string of template name
:raises: NonextantTemplateNameException
'''
start_pattern = r"sys application template\s+" \
r"(\/[\w\.\-]+\/)?" \
r"(?P<name>[\w\.\-]+)\s*\{"
... | python | def _get_template_name(self):
'''Find template name.
:returns: string of template name
:raises: NonextantTemplateNameException
'''
start_pattern = r"sys application template\s+" \
r"(\/[\w\.\-]+\/)?" \
r"(?P<name>[\w\.\-]+)\s*\{"
... | [
"def",
"_get_template_name",
"(",
"self",
")",
":",
"start_pattern",
"=",
"r\"sys application template\\s+\"",
"r\"(\\/[\\w\\.\\-]+\\/)?\"",
"r\"(?P<name>[\\w\\.\\-]+)\\s*\\{\"",
"template_start",
"=",
"re",
".",
"search",
"(",
"start_pattern",
",",
"self",
".",
"template_s... | Find template name.
:returns: string of template name
:raises: NonextantTemplateNameException | [
"Find",
"template",
"name",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/iapp_parser.py#L149-L164 |
251,103 | F5Networks/f5-common-python | f5/utils/iapp_parser.py | IappParser._get_template_attr | def _get_template_attr(self, attr):
'''Find the attribute value for a specific attribute.
:param attr: string of attribute name
:returns: string of attribute value
'''
attr_re = r'{0}\s+.*'.format(attr)
attr_found = re.search(attr_re, self.template_str)
if attr... | python | def _get_template_attr(self, attr):
'''Find the attribute value for a specific attribute.
:param attr: string of attribute name
:returns: string of attribute value
'''
attr_re = r'{0}\s+.*'.format(attr)
attr_found = re.search(attr_re, self.template_str)
if attr... | [
"def",
"_get_template_attr",
"(",
"self",
",",
"attr",
")",
":",
"attr_re",
"=",
"r'{0}\\s+.*'",
".",
"format",
"(",
"attr",
")",
"attr_found",
"=",
"re",
".",
"search",
"(",
"attr_re",
",",
"self",
".",
"template_str",
")",
"if",
"attr_found",
":",
"att... | Find the attribute value for a specific attribute.
:param attr: string of attribute name
:returns: string of attribute value | [
"Find",
"the",
"attribute",
"value",
"for",
"a",
"specific",
"attribute",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/iapp_parser.py#L166-L178 |
251,104 | F5Networks/f5-common-python | f5/utils/iapp_parser.py | IappParser._add_sections | def _add_sections(self):
'''Add the found and required sections to the templ_dict.'''
for section in self.template_sections:
try:
sec_start = self._get_section_start_index(section)
except NonextantSectionException:
if section in self.sections_not_r... | python | def _add_sections(self):
'''Add the found and required sections to the templ_dict.'''
for section in self.template_sections:
try:
sec_start = self._get_section_start_index(section)
except NonextantSectionException:
if section in self.sections_not_r... | [
"def",
"_add_sections",
"(",
"self",
")",
":",
"for",
"section",
"in",
"self",
".",
"template_sections",
":",
"try",
":",
"sec_start",
"=",
"self",
".",
"_get_section_start_index",
"(",
"section",
")",
"except",
"NonextantSectionException",
":",
"if",
"section",... | Add the found and required sections to the templ_dict. | [
"Add",
"the",
"found",
"and",
"required",
"sections",
"to",
"the",
"templ_dict",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/iapp_parser.py#L180-L198 |
251,105 | F5Networks/f5-common-python | f5/utils/iapp_parser.py | IappParser._add_cli_scripts | def _add_cli_scripts(self):
'''Add the found external sections to the templ_dict.'''
pattern = r"cli script\s+" \
r"(\/[\w\.\-]+\/)?" \
r"(?P<name>[\w\.\-]+)\s*\{"
sections = re.finditer(pattern, self.template_str)
for section in sections:
... | python | def _add_cli_scripts(self):
'''Add the found external sections to the templ_dict.'''
pattern = r"cli script\s+" \
r"(\/[\w\.\-]+\/)?" \
r"(?P<name>[\w\.\-]+)\s*\{"
sections = re.finditer(pattern, self.template_str)
for section in sections:
... | [
"def",
"_add_cli_scripts",
"(",
"self",
")",
":",
"pattern",
"=",
"r\"cli script\\s+\"",
"r\"(\\/[\\w\\.\\-]+\\/)?\"",
"r\"(?P<name>[\\w\\.\\-]+)\\s*\\{\"",
"sections",
"=",
"re",
".",
"finditer",
"(",
"pattern",
",",
"self",
".",
"template_str",
")",
"for",
"section"... | Add the found external sections to the templ_dict. | [
"Add",
"the",
"found",
"external",
"sections",
"to",
"the",
"templ_dict",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/iapp_parser.py#L200-L230 |
251,106 | F5Networks/f5-common-python | f5/utils/iapp_parser.py | IappParser._add_attrs | def _add_attrs(self):
'''Add the found and required attrs to the templ_dict.'''
for attr in self.template_attrs:
attr_value = self._get_template_attr(attr)
if not attr_value:
continue
attr, attr_value = self._transform_key_value(
attr... | python | def _add_attrs(self):
'''Add the found and required attrs to the templ_dict.'''
for attr in self.template_attrs:
attr_value = self._get_template_attr(attr)
if not attr_value:
continue
attr, attr_value = self._transform_key_value(
attr... | [
"def",
"_add_attrs",
"(",
"self",
")",
":",
"for",
"attr",
"in",
"self",
".",
"template_attrs",
":",
"attr_value",
"=",
"self",
".",
"_get_template_attr",
"(",
"attr",
")",
"if",
"not",
"attr_value",
":",
"continue",
"attr",
",",
"attr_value",
"=",
"self",... | Add the found and required attrs to the templ_dict. | [
"Add",
"the",
"found",
"and",
"required",
"attrs",
"to",
"the",
"templ_dict",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/iapp_parser.py#L232-L245 |
251,107 | F5Networks/f5-common-python | f5/utils/iapp_parser.py | IappParser._parse_tcl_list | def _parse_tcl_list(self, attr, list_str):
'''Turns a string representation of a TCL list into a Python list.
:param attr: string name of attribute
:param list_str: string representation of a list
:returns: Python list
'''
list_str = list_str.strip()
if not lis... | python | def _parse_tcl_list(self, attr, list_str):
'''Turns a string representation of a TCL list into a Python list.
:param attr: string name of attribute
:param list_str: string representation of a list
:returns: Python list
'''
list_str = list_str.strip()
if not lis... | [
"def",
"_parse_tcl_list",
"(",
"self",
",",
"attr",
",",
"list_str",
")",
":",
"list_str",
"=",
"list_str",
".",
"strip",
"(",
")",
"if",
"not",
"list_str",
":",
"return",
"[",
"]",
"if",
"list_str",
"[",
"0",
"]",
"!=",
"'{'",
"and",
"list_str",
"["... | Turns a string representation of a TCL list into a Python list.
:param attr: string name of attribute
:param list_str: string representation of a list
:returns: Python list | [
"Turns",
"a",
"string",
"representation",
"of",
"a",
"TCL",
"list",
"into",
"a",
"Python",
"list",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/iapp_parser.py#L247-L271 |
251,108 | F5Networks/f5-common-python | f5/utils/iapp_parser.py | IappParser._transform_key_value | def _transform_key_value(self, key, value, map_dict):
'''Massage keys and values for iapp dict to look like JSON.
:param key: string dictionary key
:param value: string dictionary value
:param map_dict: dictionary to map key names
'''
if key in self.tcl_list_patterns:
... | python | def _transform_key_value(self, key, value, map_dict):
'''Massage keys and values for iapp dict to look like JSON.
:param key: string dictionary key
:param value: string dictionary value
:param map_dict: dictionary to map key names
'''
if key in self.tcl_list_patterns:
... | [
"def",
"_transform_key_value",
"(",
"self",
",",
"key",
",",
"value",
",",
"map_dict",
")",
":",
"if",
"key",
"in",
"self",
".",
"tcl_list_patterns",
":",
"value",
"=",
"self",
".",
"_parse_tcl_list",
"(",
"key",
",",
"value",
")",
"if",
"key",
"in",
"... | Massage keys and values for iapp dict to look like JSON.
:param key: string dictionary key
:param value: string dictionary value
:param map_dict: dictionary to map key names | [
"Massage",
"keys",
"and",
"values",
"for",
"iapp",
"dict",
"to",
"look",
"like",
"JSON",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/iapp_parser.py#L273-L287 |
251,109 | F5Networks/f5-common-python | f5/utils/iapp_parser.py | IappParser.parse_template | def parse_template(self):
'''Parse the template string into a dict.
Find the (large) inner sections first, save them, and remove them from
a modified string. Then find the template attributes in the modified
string.
:returns: dictionary of parsed template
'''
s... | python | def parse_template(self):
'''Parse the template string into a dict.
Find the (large) inner sections first, save them, and remove them from
a modified string. Then find the template attributes in the modified
string.
:returns: dictionary of parsed template
'''
s... | [
"def",
"parse_template",
"(",
"self",
")",
":",
"self",
".",
"templ_dict",
"=",
"{",
"'actions'",
":",
"{",
"'definition'",
":",
"{",
"}",
"}",
"}",
"self",
".",
"templ_dict",
"[",
"'name'",
"]",
"=",
"self",
".",
"_get_template_name",
"(",
")",
"self"... | Parse the template string into a dict.
Find the (large) inner sections first, save them, and remove them from
a modified string. Then find the template attributes in the modified
string.
:returns: dictionary of parsed template | [
"Parse",
"the",
"template",
"string",
"into",
"a",
"dict",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/iapp_parser.py#L289-L307 |
251,110 | F5Networks/f5-common-python | f5/bigip/shared/authn.py | Root._create | def _create(self, **kwargs):
"""wrapped by `create` override that in subclasses to customize"""
if 'uri' in self._meta_data:
error = "There was an attempt to assign a new uri to this "\
"resource, the _meta_data['uri'] is %s and it should"\
" not be ch... | python | def _create(self, **kwargs):
if 'uri' in self._meta_data:
error = "There was an attempt to assign a new uri to this "\
"resource, the _meta_data['uri'] is %s and it should"\
" not be changed." % (self._meta_data['uri'])
raise URICreationCollision(e... | [
"def",
"_create",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'uri'",
"in",
"self",
".",
"_meta_data",
":",
"error",
"=",
"\"There was an attempt to assign a new uri to this \"",
"\"resource, the _meta_data['uri'] is %s and it should\"",
"\" not be changed.\"",
... | wrapped by `create` override that in subclasses to customize | [
"wrapped",
"by",
"create",
"override",
"that",
"in",
"subclasses",
"to",
"customize"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/shared/authn.py#L55-L83 |
251,111 | F5Networks/f5-common-python | f5sdk_plugins/fixtures.py | peer | def peer(opt_peer, opt_username, opt_password, scope="module"):
'''peer bigip fixture'''
p = BigIP(opt_peer, opt_username, opt_password)
return p | python | def peer(opt_peer, opt_username, opt_password, scope="module"):
'''peer bigip fixture'''
p = BigIP(opt_peer, opt_username, opt_password)
return p | [
"def",
"peer",
"(",
"opt_peer",
",",
"opt_username",
",",
"opt_password",
",",
"scope",
"=",
"\"module\"",
")",
":",
"p",
"=",
"BigIP",
"(",
"opt_peer",
",",
"opt_username",
",",
"opt_password",
")",
"return",
"p"
] | peer bigip fixture | [
"peer",
"bigip",
"fixture"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5sdk_plugins/fixtures.py#L116-L119 |
251,112 | F5Networks/f5-common-python | f5/bigip/tm/gtm/topology.py | Topology.exists | def exists(self, **kwargs):
"""Providing a partition is not necessary on topology; causes errors"""
kwargs.pop('partition', None)
kwargs['transform_name'] = True
return self._exists(**kwargs) | python | def exists(self, **kwargs):
kwargs.pop('partition', None)
kwargs['transform_name'] = True
return self._exists(**kwargs) | [
"def",
"exists",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"pop",
"(",
"'partition'",
",",
"None",
")",
"kwargs",
"[",
"'transform_name'",
"]",
"=",
"True",
"return",
"self",
".",
"_exists",
"(",
"*",
"*",
"kwargs",
")"
] | Providing a partition is not necessary on topology; causes errors | [
"Providing",
"a",
"partition",
"is",
"not",
"necessary",
"on",
"topology",
";",
"causes",
"errors"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/gtm/topology.py#L149-L153 |
251,113 | F5Networks/f5-common-python | f5/utils/responses/handlers.py | Stats._key_dot_replace | def _key_dot_replace(self, rdict):
"""Replace fullstops in returned keynames"""
temp_dict = {}
for key, value in iteritems(rdict):
if isinstance(value, dict):
value = self._key_dot_replace(value)
temp_dict[key.replace('.', '_')] = value
return temp... | python | def _key_dot_replace(self, rdict):
temp_dict = {}
for key, value in iteritems(rdict):
if isinstance(value, dict):
value = self._key_dot_replace(value)
temp_dict[key.replace('.', '_')] = value
return temp_dict | [
"def",
"_key_dot_replace",
"(",
"self",
",",
"rdict",
")",
":",
"temp_dict",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"iteritems",
"(",
"rdict",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"value",
"=",
"self",
".",
"... | Replace fullstops in returned keynames | [
"Replace",
"fullstops",
"in",
"returned",
"keynames"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/responses/handlers.py#L43-L50 |
251,114 | F5Networks/f5-common-python | f5/utils/responses/handlers.py | Stats._get_nest_stats | def _get_nest_stats(self):
"""Helper method to deal with nestedStats
as json format changed in v12.x
"""
for x in self.rdict:
check = urlparse(x)
if check.scheme:
nested_dict = self.rdict[x]['nestedStats']
tmp_dict = nested_dict['e... | python | def _get_nest_stats(self):
for x in self.rdict:
check = urlparse(x)
if check.scheme:
nested_dict = self.rdict[x]['nestedStats']
tmp_dict = nested_dict['entries']
return self._key_dot_replace(tmp_dict)
return self._key_dot_replace(s... | [
"def",
"_get_nest_stats",
"(",
"self",
")",
":",
"for",
"x",
"in",
"self",
".",
"rdict",
":",
"check",
"=",
"urlparse",
"(",
"x",
")",
"if",
"check",
".",
"scheme",
":",
"nested_dict",
"=",
"self",
".",
"rdict",
"[",
"x",
"]",
"[",
"'nestedStats'",
... | Helper method to deal with nestedStats
as json format changed in v12.x | [
"Helper",
"method",
"to",
"deal",
"with",
"nestedStats"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/responses/handlers.py#L52-L64 |
251,115 | F5Networks/f5-common-python | f5/utils/responses/handlers.py | Stats.refresh | def refresh(self, **kwargs):
"""Refreshes stats attached to an object"""
self.resource.refresh(**kwargs)
self.rdict = self.resource.entries
self._update_stats() | python | def refresh(self, **kwargs):
self.resource.refresh(**kwargs)
self.rdict = self.resource.entries
self._update_stats() | [
"def",
"refresh",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"resource",
".",
"refresh",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"rdict",
"=",
"self",
".",
"resource",
".",
"entries",
"self",
".",
"_update_stats",
"(",
")"
] | Refreshes stats attached to an object | [
"Refreshes",
"stats",
"attached",
"to",
"an",
"object"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/responses/handlers.py#L71-L75 |
251,116 | F5Networks/f5-common-python | f5/bigip/tm/security/firewall.py | Rule.load | def load(self, **kwargs):
"""Custom load method to address issue in 11.6.0 Final,
where non existing objects would be True.
"""
if LooseVersion(self.tmos_ver) == LooseVersion('11.6.0'):
return self._load_11_6(**kwargs)
else:
return super(Rule, self)._load... | python | def load(self, **kwargs):
if LooseVersion(self.tmos_ver) == LooseVersion('11.6.0'):
return self._load_11_6(**kwargs)
else:
return super(Rule, self)._load(**kwargs) | [
"def",
"load",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"LooseVersion",
"(",
"self",
".",
"tmos_ver",
")",
"==",
"LooseVersion",
"(",
"'11.6.0'",
")",
":",
"return",
"self",
".",
"_load_11_6",
"(",
"*",
"*",
"kwargs",
")",
"else",
":",
... | Custom load method to address issue in 11.6.0 Final,
where non existing objects would be True. | [
"Custom",
"load",
"method",
"to",
"address",
"issue",
"in",
"11",
".",
"6",
".",
"0",
"Final"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/security/firewall.py#L169-L177 |
251,117 | F5Networks/f5-common-python | f5/utils/decorators.py | poll_for_exceptionless_callable | def poll_for_exceptionless_callable(callable, attempts, interval):
'''Poll with a given callable for a specified number of times.
:param callable: callable to invoke in loop -- if no exception is raised
the call is considered succeeded
:param attempts: number of iterations to attempt
... | python | def poll_for_exceptionless_callable(callable, attempts, interval):
'''Poll with a given callable for a specified number of times.
:param callable: callable to invoke in loop -- if no exception is raised
the call is considered succeeded
:param attempts: number of iterations to attempt
... | [
"def",
"poll_for_exceptionless_callable",
"(",
"callable",
",",
"attempts",
",",
"interval",
")",
":",
"@",
"wraps",
"(",
"callable",
")",
"def",
"poll",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"attempt",
"in",
"range",
"(",
"attempts... | Poll with a given callable for a specified number of times.
:param callable: callable to invoke in loop -- if no exception is raised
the call is considered succeeded
:param attempts: number of iterations to attempt
:param interval: seconds to wait before next attempt | [
"Poll",
"with",
"a",
"given",
"callable",
"for",
"a",
"specified",
"number",
"of",
"times",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/utils/decorators.py#L28-L47 |
251,118 | F5Networks/f5-common-python | f5/bigip/tm/security/log.py | Network.exists | def exists(self, **kwargs):
"""Some objects when deleted still return when called by their
direct URI, this is a known issue in 11.6.0.
"""
if LooseVersion(self.tmos_ver) == LooseVersion('11.6.0'):
return self._exists_11_6(**kwargs)
else:
return super(Ne... | python | def exists(self, **kwargs):
if LooseVersion(self.tmos_ver) == LooseVersion('11.6.0'):
return self._exists_11_6(**kwargs)
else:
return super(Network, self)._exists(**kwargs) | [
"def",
"exists",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"LooseVersion",
"(",
"self",
".",
"tmos_ver",
")",
"==",
"LooseVersion",
"(",
"'11.6.0'",
")",
":",
"return",
"self",
".",
"_exists_11_6",
"(",
"*",
"*",
"kwargs",
")",
"else",
":... | Some objects when deleted still return when called by their
direct URI, this is a known issue in 11.6.0. | [
"Some",
"objects",
"when",
"deleted",
"still",
"return",
"when",
"called",
"by",
"their"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/security/log.py#L168-L177 |
251,119 | F5Networks/f5-common-python | f5/bigip/mixins.py | CommandExecutionMixin._is_allowed_command | def _is_allowed_command(self, command):
"""Checking if the given command is allowed on a given endpoint."""
cmds = self._meta_data['allowed_commands']
if command not in self._meta_data['allowed_commands']:
error_message = "The command value {0} does not exist. " \
... | python | def _is_allowed_command(self, command):
cmds = self._meta_data['allowed_commands']
if command not in self._meta_data['allowed_commands']:
error_message = "The command value {0} does not exist. " \
"Valid commands are {1}".format(command, cmds)
raise In... | [
"def",
"_is_allowed_command",
"(",
"self",
",",
"command",
")",
":",
"cmds",
"=",
"self",
".",
"_meta_data",
"[",
"'allowed_commands'",
"]",
"if",
"command",
"not",
"in",
"self",
".",
"_meta_data",
"[",
"'allowed_commands'",
"]",
":",
"error_message",
"=",
"... | Checking if the given command is allowed on a given endpoint. | [
"Checking",
"if",
"the",
"given",
"command",
"is",
"allowed",
"on",
"a",
"given",
"endpoint",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/mixins.py#L212-L218 |
251,120 | F5Networks/f5-common-python | f5/bigip/mixins.py | CommandExecutionMixin._check_command_result | def _check_command_result(self):
"""If command result exists run these checks."""
if self.commandResult.startswith('/bin/bash'):
raise UtilError('%s' % self.commandResult.split(' ', 1)[1])
if self.commandResult.startswith('/bin/mv'):
raise UtilError('%s' % self.commandRes... | python | def _check_command_result(self):
if self.commandResult.startswith('/bin/bash'):
raise UtilError('%s' % self.commandResult.split(' ', 1)[1])
if self.commandResult.startswith('/bin/mv'):
raise UtilError('%s' % self.commandResult.split(' ', 1)[1])
if self.commandResult.start... | [
"def",
"_check_command_result",
"(",
"self",
")",
":",
"if",
"self",
".",
"commandResult",
".",
"startswith",
"(",
"'/bin/bash'",
")",
":",
"raise",
"UtilError",
"(",
"'%s'",
"%",
"self",
".",
"commandResult",
".",
"split",
"(",
"' '",
",",
"1",
")",
"["... | If command result exists run these checks. | [
"If",
"command",
"result",
"exists",
"run",
"these",
"checks",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/mixins.py#L220-L235 |
251,121 | F5Networks/f5-common-python | f5/bigip/mixins.py | CommandExecutionMixin.exec_cmd | def exec_cmd(self, command, **kwargs):
"""Wrapper method that can be changed in the inheriting classes."""
self._is_allowed_command(command)
self._check_command_parameters(**kwargs)
return self._exec_cmd(command, **kwargs) | python | def exec_cmd(self, command, **kwargs):
self._is_allowed_command(command)
self._check_command_parameters(**kwargs)
return self._exec_cmd(command, **kwargs) | [
"def",
"exec_cmd",
"(",
"self",
",",
"command",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_is_allowed_command",
"(",
"command",
")",
"self",
".",
"_check_command_parameters",
"(",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"_exec_cmd",
"(",
"... | Wrapper method that can be changed in the inheriting classes. | [
"Wrapper",
"method",
"that",
"can",
"be",
"changed",
"in",
"the",
"inheriting",
"classes",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/mixins.py#L237-L241 |
251,122 | F5Networks/f5-common-python | f5/bigip/mixins.py | CommandExecutionMixin._exec_cmd | def _exec_cmd(self, command, **kwargs):
"""Create a new method as command has specific requirements.
There is a handful of the TMSH global commands supported,
so this method requires them as a parameter.
:raises: InvalidCommand
"""
kwargs['command'] = command
s... | python | def _exec_cmd(self, command, **kwargs):
kwargs['command'] = command
self._check_exclusive_parameters(**kwargs)
requests_params = self._handle_requests_params(kwargs)
session = self._meta_data['bigip']._meta_data['icr_session']
response = session.post(
self._meta_data[... | [
"def",
"_exec_cmd",
"(",
"self",
",",
"command",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'command'",
"]",
"=",
"command",
"self",
".",
"_check_exclusive_parameters",
"(",
"*",
"*",
"kwargs",
")",
"requests_params",
"=",
"self",
".",
"_handle_req... | Create a new method as command has specific requirements.
There is a handful of the TMSH global commands supported,
so this method requires them as a parameter.
:raises: InvalidCommand | [
"Create",
"a",
"new",
"method",
"as",
"command",
"has",
"specific",
"requirements",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/mixins.py#L243-L263 |
251,123 | F5Networks/f5-common-python | f5/bigip/mixins.py | DeviceMixin.get_device_info | def get_device_info(self, bigip):
'''Get device information about a specific BigIP device.
:param bigip: bigip object --- device to inspect
:returns: bigip object
'''
coll = bigip.tm.cm.devices.get_collection()
device = [device for device in coll if device.selfDevice ==... | python | def get_device_info(self, bigip):
'''Get device information about a specific BigIP device.
:param bigip: bigip object --- device to inspect
:returns: bigip object
'''
coll = bigip.tm.cm.devices.get_collection()
device = [device for device in coll if device.selfDevice ==... | [
"def",
"get_device_info",
"(",
"self",
",",
"bigip",
")",
":",
"coll",
"=",
"bigip",
".",
"tm",
".",
"cm",
".",
"devices",
".",
"get_collection",
"(",
")",
"device",
"=",
"[",
"device",
"for",
"device",
"in",
"coll",
"if",
"device",
".",
"selfDevice",
... | Get device information about a specific BigIP device.
:param bigip: bigip object --- device to inspect
:returns: bigip object | [
"Get",
"device",
"information",
"about",
"a",
"specific",
"BigIP",
"device",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/mixins.py#L434-L444 |
251,124 | F5Networks/f5-common-python | f5/bigip/mixins.py | CheckExistenceMixin._check_existence_by_collection | def _check_existence_by_collection(self, container, item_name):
'''Check existnce of item based on get collection call.
:param collection: container object -- capable of get_collection()
:param item_name: str -- name of item to search for in collection
'''
coll = container.get_... | python | def _check_existence_by_collection(self, container, item_name):
'''Check existnce of item based on get collection call.
:param collection: container object -- capable of get_collection()
:param item_name: str -- name of item to search for in collection
'''
coll = container.get_... | [
"def",
"_check_existence_by_collection",
"(",
"self",
",",
"container",
",",
"item_name",
")",
":",
"coll",
"=",
"container",
".",
"get_collection",
"(",
")",
"for",
"item",
"in",
"coll",
":",
"if",
"item",
".",
"name",
"==",
"item_name",
":",
"return",
"T... | Check existnce of item based on get collection call.
:param collection: container object -- capable of get_collection()
:param item_name: str -- name of item to search for in collection | [
"Check",
"existnce",
"of",
"item",
"based",
"on",
"get",
"collection",
"call",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/mixins.py#L450-L461 |
251,125 | F5Networks/f5-common-python | f5/bigip/mixins.py | CheckExistenceMixin._return_object | def _return_object(self, container, item_name):
"""Helper method to retrieve the object"""
coll = container.get_collection()
for item in coll:
if item.name == item_name:
return item | python | def _return_object(self, container, item_name):
coll = container.get_collection()
for item in coll:
if item.name == item_name:
return item | [
"def",
"_return_object",
"(",
"self",
",",
"container",
",",
"item_name",
")",
":",
"coll",
"=",
"container",
".",
"get_collection",
"(",
")",
"for",
"item",
"in",
"coll",
":",
"if",
"item",
".",
"name",
"==",
"item_name",
":",
"return",
"item"
] | Helper method to retrieve the object | [
"Helper",
"method",
"to",
"retrieve",
"the",
"object"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/mixins.py#L463-L468 |
251,126 | F5Networks/f5-common-python | f5/bigip/tm/sys/config.py | Config.exec_cmd | def exec_cmd(self, command, **kwargs):
"""Normal save and load only need the command.
To merge, just supply the merge and file arguments as kwargs like so:
exec_cmd('load', merge=True, file='/path/to/file.txt')
"""
if command == 'load':
if kwargs:
kw... | python | def exec_cmd(self, command, **kwargs):
if command == 'load':
if kwargs:
kwargs = dict(options=[kwargs])
return self._exec_cmd(command, **kwargs) | [
"def",
"exec_cmd",
"(",
"self",
",",
"command",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"command",
"==",
"'load'",
":",
"if",
"kwargs",
":",
"kwargs",
"=",
"dict",
"(",
"options",
"=",
"[",
"kwargs",
"]",
")",
"return",
"self",
".",
"_exec_cmd",
"... | Normal save and load only need the command.
To merge, just supply the merge and file arguments as kwargs like so:
exec_cmd('load', merge=True, file='/path/to/file.txt') | [
"Normal",
"save",
"and",
"load",
"only",
"need",
"the",
"command",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/sys/config.py#L52-L62 |
251,127 | F5Networks/f5-common-python | f5/bigip/tm/sys/snmp.py | User.update | def update(self, **kwargs):
"""Due to a password decryption bug
we will disable update() method for 12.1.0 and up
"""
tmos_version = self._meta_data['bigip'].tmos_version
if LooseVersion(tmos_version) > LooseVersion('12.0.0'):
msg = "Update() is unsupported for User... | python | def update(self, **kwargs):
tmos_version = self._meta_data['bigip'].tmos_version
if LooseVersion(tmos_version) > LooseVersion('12.0.0'):
msg = "Update() is unsupported for User on version %s. " \
"Utilize Modify() method instead" % tmos_version
raise Unsupported... | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"tmos_version",
"=",
"self",
".",
"_meta_data",
"[",
"'bigip'",
"]",
".",
"tmos_version",
"if",
"LooseVersion",
"(",
"tmos_version",
")",
">",
"LooseVersion",
"(",
"'12.0.0'",
")",
":",
"ms... | Due to a password decryption bug
we will disable update() method for 12.1.0 and up | [
"Due",
"to",
"a",
"password",
"decryption",
"bug"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/sys/snmp.py#L128-L140 |
251,128 | F5Networks/f5-common-python | devtools/template_engine.py | TemplateEngine._process_config_with_kind | def _process_config_with_kind(self, raw_conf):
'''Use this to decide which format is called for by the kind.
NOTE, order matters since subsequent conditions are not evaluated is an
earlier condition is met. In the some cases, e.g. a kind contains both
"stats" and "state", this will bec... | python | def _process_config_with_kind(self, raw_conf):
'''Use this to decide which format is called for by the kind.
NOTE, order matters since subsequent conditions are not evaluated is an
earlier condition is met. In the some cases, e.g. a kind contains both
"stats" and "state", this will bec... | [
"def",
"_process_config_with_kind",
"(",
"self",
",",
"raw_conf",
")",
":",
"kind",
"=",
"raw_conf",
"[",
"u\"kind\"",
"]",
"org_match",
"=",
"re",
".",
"match",
"(",
"self",
".",
"OC_pattern",
",",
"kind",
")",
"if",
"org_match",
":",
"return",
"self",
... | Use this to decide which format is called for by the kind.
NOTE, order matters since subsequent conditions are not evaluated is an
earlier condition is met. In the some cases, e.g. a kind contains both
"stats" and "state", this will become an issue. | [
"Use",
"this",
"to",
"decide",
"which",
"format",
"is",
"called",
"for",
"by",
"the",
"kind",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/devtools/template_engine.py#L204-L220 |
251,129 | F5Networks/f5-common-python | f5/bigip/resource.py | _missing_required_parameters | def _missing_required_parameters(rqset, **kwargs):
"""Helper function to do operation on sets.
Checks for any missing required parameters.
Returns non-empty or empty list. With empty
list being False.
::returns list
"""
key_set = set(list(iterkeys(kwargs)))
required_minus_received = rq... | python | def _missing_required_parameters(rqset, **kwargs):
key_set = set(list(iterkeys(kwargs)))
required_minus_received = rqset - key_set
if required_minus_received != set():
return list(required_minus_received) | [
"def",
"_missing_required_parameters",
"(",
"rqset",
",",
"*",
"*",
"kwargs",
")",
":",
"key_set",
"=",
"set",
"(",
"list",
"(",
"iterkeys",
"(",
"kwargs",
")",
")",
")",
"required_minus_received",
"=",
"rqset",
"-",
"key_set",
"if",
"required_minus_received",... | Helper function to do operation on sets.
Checks for any missing required parameters.
Returns non-empty or empty list. With empty
list being False.
::returns list | [
"Helper",
"function",
"to",
"do",
"operation",
"on",
"sets",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L137-L149 |
251,130 | F5Networks/f5-common-python | f5/bigip/resource.py | PathElement._format_collection_name | def _format_collection_name(self):
"""Formats a name from Collection format
Collections are of two name formats based on their actual URI
representation in the REST service.
1. For cases where the actual URI of a collection is singular, for
example,
/mgmt/tm/... | python | def _format_collection_name(self):
base_uri = self._format_resource_name()
if base_uri[-2:] == '_s':
endind = 2
else:
endind = 1
return base_uri[:-endind] | [
"def",
"_format_collection_name",
"(",
"self",
")",
":",
"base_uri",
"=",
"self",
".",
"_format_resource_name",
"(",
")",
"if",
"base_uri",
"[",
"-",
"2",
":",
"]",
"==",
"'_s'",
":",
"endind",
"=",
"2",
"else",
":",
"endind",
"=",
"1",
"return",
"base... | Formats a name from Collection format
Collections are of two name formats based on their actual URI
representation in the REST service.
1. For cases where the actual URI of a collection is singular, for
example,
/mgmt/tm/ltm/node
The name of the collectio... | [
"Formats",
"a",
"name",
"from",
"Collection",
"format"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L199-L238 |
251,131 | F5Networks/f5-common-python | f5/bigip/resource.py | PathElement._check_command_parameters | def _check_command_parameters(self, **kwargs):
"""Params given to exec_cmd should satisfy required params.
:params: kwargs
:raises: MissingRequiredCommandParameter
"""
rset = self._meta_data['required_command_parameters']
check = _missing_required_parameters(rset, **kwar... | python | def _check_command_parameters(self, **kwargs):
rset = self._meta_data['required_command_parameters']
check = _missing_required_parameters(rset, **kwargs)
if check:
error_message = 'Missing required params: %s' % check
raise MissingRequiredCommandParameter(error_message) | [
"def",
"_check_command_parameters",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"rset",
"=",
"self",
".",
"_meta_data",
"[",
"'required_command_parameters'",
"]",
"check",
"=",
"_missing_required_parameters",
"(",
"rset",
",",
"*",
"*",
"kwargs",
")",
"if"... | Params given to exec_cmd should satisfy required params.
:params: kwargs
:raises: MissingRequiredCommandParameter | [
"Params",
"given",
"to",
"exec_cmd",
"should",
"satisfy",
"required",
"params",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L264-L274 |
251,132 | F5Networks/f5-common-python | f5/bigip/resource.py | PathElement._handle_requests_params | def _handle_requests_params(self, kwargs):
"""Validate parameters that will be passed to the requests verbs.
This method validates that there is no conflict in the names of the
requests_params passed to the function and the other kwargs. It also
ensures that the required request parame... | python | def _handle_requests_params(self, kwargs):
requests_params = kwargs.pop('requests_params', {})
for param in requests_params:
if param in kwargs:
error_message = 'Requests Parameter %r collides with a load'\
' parameter of the same name.' % param
... | [
"def",
"_handle_requests_params",
"(",
"self",
",",
"kwargs",
")",
":",
"requests_params",
"=",
"kwargs",
".",
"pop",
"(",
"'requests_params'",
",",
"{",
"}",
")",
"for",
"param",
"in",
"requests_params",
":",
"if",
"param",
"in",
"kwargs",
":",
"error_messa... | Validate parameters that will be passed to the requests verbs.
This method validates that there is no conflict in the names of the
requests_params passed to the function and the other kwargs. It also
ensures that the required request parameters for the object are
added to the request p... | [
"Validate",
"parameters",
"that",
"will",
"be",
"passed",
"to",
"the",
"requests",
"verbs",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L298-L319 |
251,133 | F5Networks/f5-common-python | f5/bigip/resource.py | PathElement._check_exclusive_parameters | def _check_exclusive_parameters(self, **kwargs):
"""Check for mutually exclusive attributes in kwargs.
:raises ExclusiveAttributesPresent
"""
if len(self._meta_data['exclusive_attributes']) > 0:
attr_set = set(list(iterkeys(kwargs)))
ex_set = set(self._meta_data[... | python | def _check_exclusive_parameters(self, **kwargs):
if len(self._meta_data['exclusive_attributes']) > 0:
attr_set = set(list(iterkeys(kwargs)))
ex_set = set(self._meta_data['exclusive_attributes'][0])
common_set = sorted(attr_set.intersection(ex_set))
if len(common_s... | [
"def",
"_check_exclusive_parameters",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"self",
".",
"_meta_data",
"[",
"'exclusive_attributes'",
"]",
")",
">",
"0",
":",
"attr_set",
"=",
"set",
"(",
"list",
"(",
"iterkeys",
"(",
"kwargs"... | Check for mutually exclusive attributes in kwargs.
:raises ExclusiveAttributesPresent | [
"Check",
"for",
"mutually",
"exclusive",
"attributes",
"in",
"kwargs",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L321-L335 |
251,134 | F5Networks/f5-common-python | f5/bigip/resource.py | ResourceBase._modify | def _modify(self, **patch):
"""Wrapped with modify, override in a subclass to customize."""
requests_params, patch_uri, session, read_only = \
self._prepare_put_or_patch(patch)
self._check_for_boolean_pair_reduction(patch)
read_only_mutations = []
for attr in read_on... | python | def _modify(self, **patch):
requests_params, patch_uri, session, read_only = \
self._prepare_put_or_patch(patch)
self._check_for_boolean_pair_reduction(patch)
read_only_mutations = []
for attr in read_only:
if attr in patch:
read_only_mutations.app... | [
"def",
"_modify",
"(",
"self",
",",
"*",
"*",
"patch",
")",
":",
"requests_params",
",",
"patch_uri",
",",
"session",
",",
"read_only",
"=",
"self",
".",
"_prepare_put_or_patch",
"(",
"patch",
")",
"self",
".",
"_check_for_boolean_pair_reduction",
"(",
"patch"... | Wrapped with modify, override in a subclass to customize. | [
"Wrapped",
"with",
"modify",
"override",
"in",
"a",
"subclass",
"to",
"customize",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L388-L405 |
251,135 | F5Networks/f5-common-python | f5/bigip/resource.py | ResourceBase._check_for_boolean_pair_reduction | def _check_for_boolean_pair_reduction(self, kwargs):
"""Check if boolean pairs should be reduced in this resource."""
if 'reduction_forcing_pairs' in self._meta_data:
for key1, key2 in self._meta_data['reduction_forcing_pairs']:
kwargs = self._reduce_boolean_pair(kwargs, key... | python | def _check_for_boolean_pair_reduction(self, kwargs):
if 'reduction_forcing_pairs' in self._meta_data:
for key1, key2 in self._meta_data['reduction_forcing_pairs']:
kwargs = self._reduce_boolean_pair(kwargs, key1, key2)
return kwargs | [
"def",
"_check_for_boolean_pair_reduction",
"(",
"self",
",",
"kwargs",
")",
":",
"if",
"'reduction_forcing_pairs'",
"in",
"self",
".",
"_meta_data",
":",
"for",
"key1",
",",
"key2",
"in",
"self",
".",
"_meta_data",
"[",
"'reduction_forcing_pairs'",
"]",
":",
"k... | Check if boolean pairs should be reduced in this resource. | [
"Check",
"if",
"boolean",
"pairs",
"should",
"be",
"reduced",
"in",
"this",
"resource",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L413-L419 |
251,136 | F5Networks/f5-common-python | f5/bigip/resource.py | ResourceBase._prepare_put_or_patch | def _prepare_put_or_patch(self, kwargs):
"""Retrieve the appropriate request items for put or patch calls."""
requests_params = self._handle_requests_params(kwargs)
update_uri = self._meta_data['uri']
session = self._meta_data['bigip']._meta_data['icr_session']
read_only = self.... | python | def _prepare_put_or_patch(self, kwargs):
requests_params = self._handle_requests_params(kwargs)
update_uri = self._meta_data['uri']
session = self._meta_data['bigip']._meta_data['icr_session']
read_only = self._meta_data.get('read_only_attributes', [])
return requests_params, upd... | [
"def",
"_prepare_put_or_patch",
"(",
"self",
",",
"kwargs",
")",
":",
"requests_params",
"=",
"self",
".",
"_handle_requests_params",
"(",
"kwargs",
")",
"update_uri",
"=",
"self",
".",
"_meta_data",
"[",
"'uri'",
"]",
"session",
"=",
"self",
".",
"_meta_data"... | Retrieve the appropriate request items for put or patch calls. | [
"Retrieve",
"the",
"appropriate",
"request",
"items",
"for",
"put",
"or",
"patch",
"calls",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L421-L428 |
251,137 | F5Networks/f5-common-python | f5/bigip/resource.py | ResourceBase._prepare_request_json | def _prepare_request_json(self, kwargs):
"""Prepare request args for sending to device as JSON."""
# Check for python keywords in dict
kwargs = self._check_for_python_keywords(kwargs)
# Check for the key 'check' in kwargs
if 'check' in kwargs:
od = OrderedDict()
... | python | def _prepare_request_json(self, kwargs):
# Check for python keywords in dict
kwargs = self._check_for_python_keywords(kwargs)
# Check for the key 'check' in kwargs
if 'check' in kwargs:
od = OrderedDict()
od['check'] = kwargs['check']
kwargs.pop('chec... | [
"def",
"_prepare_request_json",
"(",
"self",
",",
"kwargs",
")",
":",
"# Check for python keywords in dict",
"kwargs",
"=",
"self",
".",
"_check_for_python_keywords",
"(",
"kwargs",
")",
"# Check for the key 'check' in kwargs",
"if",
"'check'",
"in",
"kwargs",
":",
"od"... | Prepare request args for sending to device as JSON. | [
"Prepare",
"request",
"args",
"for",
"sending",
"to",
"device",
"as",
"JSON",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L430-L443 |
251,138 | F5Networks/f5-common-python | f5/bigip/resource.py | ResourceBase._iter_list_for_dicts | def _iter_list_for_dicts(self, check_list):
"""Iterate over list to find dicts and check for python keywords."""
list_copy = copy.deepcopy(check_list)
for index, elem in enumerate(check_list):
if isinstance(elem, dict):
list_copy[index] = self._check_for_python_keywo... | python | def _iter_list_for_dicts(self, check_list):
list_copy = copy.deepcopy(check_list)
for index, elem in enumerate(check_list):
if isinstance(elem, dict):
list_copy[index] = self._check_for_python_keywords(elem)
elif isinstance(elem, list):
list_copy[i... | [
"def",
"_iter_list_for_dicts",
"(",
"self",
",",
"check_list",
")",
":",
"list_copy",
"=",
"copy",
".",
"deepcopy",
"(",
"check_list",
")",
"for",
"index",
",",
"elem",
"in",
"enumerate",
"(",
"check_list",
")",
":",
"if",
"isinstance",
"(",
"elem",
",",
... | Iterate over list to find dicts and check for python keywords. | [
"Iterate",
"over",
"list",
"to",
"find",
"dicts",
"and",
"check",
"for",
"python",
"keywords",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L445-L456 |
251,139 | F5Networks/f5-common-python | f5/bigip/resource.py | ResourceBase._check_for_python_keywords | def _check_for_python_keywords(self, kwargs):
"""When Python keywords seen, mutate to remove trailing underscore."""
kwargs_copy = copy.deepcopy(kwargs)
for key, val in iteritems(kwargs):
if isinstance(val, dict):
kwargs_copy[key] = self._check_for_python_keywords(va... | python | def _check_for_python_keywords(self, kwargs):
kwargs_copy = copy.deepcopy(kwargs)
for key, val in iteritems(kwargs):
if isinstance(val, dict):
kwargs_copy[key] = self._check_for_python_keywords(val)
elif isinstance(val, list):
kwargs_copy[key] = se... | [
"def",
"_check_for_python_keywords",
"(",
"self",
",",
"kwargs",
")",
":",
"kwargs_copy",
"=",
"copy",
".",
"deepcopy",
"(",
"kwargs",
")",
"for",
"key",
",",
"val",
"in",
"iteritems",
"(",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"dict",... | When Python keywords seen, mutate to remove trailing underscore. | [
"When",
"Python",
"keywords",
"seen",
"mutate",
"to",
"remove",
"trailing",
"underscore",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L458-L473 |
251,140 | F5Networks/f5-common-python | f5/bigip/resource.py | ResourceBase._check_keys | def _check_keys(self, rdict):
"""Call this from _local_update to validate response keys
disallowed server-response json keys:
1. The string-literal '_meta_data'
2. strings that are not valid Python 2.7 identifiers
3. strings beginning with '__'.
:param rdict: from respo... | python | def _check_keys(self, rdict):
if '_meta_data' in rdict:
error_message = "Response contains key '_meta_data' which is "\
"incompatible with this API!!\n Response json: %r" % rdict
raise DeviceProvidesIncompatibleKey(error_message)
for x in rdict:
if not... | [
"def",
"_check_keys",
"(",
"self",
",",
"rdict",
")",
":",
"if",
"'_meta_data'",
"in",
"rdict",
":",
"error_message",
"=",
"\"Response contains key '_meta_data' which is \"",
"\"incompatible with this API!!\\n Response json: %r\"",
"%",
"rdict",
"raise",
"DeviceProvidesIncomp... | Call this from _local_update to validate response keys
disallowed server-response json keys:
1. The string-literal '_meta_data'
2. strings that are not valid Python 2.7 identifiers
3. strings beginning with '__'.
:param rdict: from response.json()
:raises: DeviceProvide... | [
"Call",
"this",
"from",
"_local_update",
"to",
"validate",
"response",
"keys"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L475-L504 |
251,141 | F5Networks/f5-common-python | f5/bigip/resource.py | ResourceBase._local_update | def _local_update(self, rdict):
"""Call this with a response dictionary to update instance attrs.
If the response has only valid keys, stash meta_data, replace __dict__,
and reassign meta_data.
:param rdict: response attributes derived from server JSON
"""
sanitized = s... | python | def _local_update(self, rdict):
sanitized = self._check_keys(rdict)
temp_meta = self._meta_data
self.__dict__ = sanitized
self._meta_data = temp_meta | [
"def",
"_local_update",
"(",
"self",
",",
"rdict",
")",
":",
"sanitized",
"=",
"self",
".",
"_check_keys",
"(",
"rdict",
")",
"temp_meta",
"=",
"self",
".",
"_meta_data",
"self",
".",
"__dict__",
"=",
"sanitized",
"self",
".",
"_meta_data",
"=",
"temp_meta... | Call this with a response dictionary to update instance attrs.
If the response has only valid keys, stash meta_data, replace __dict__,
and reassign meta_data.
:param rdict: response attributes derived from server JSON | [
"Call",
"this",
"with",
"a",
"response",
"dictionary",
"to",
"update",
"instance",
"attrs",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L506-L517 |
251,142 | F5Networks/f5-common-python | f5/bigip/resource.py | ResourceBase._update | def _update(self, **kwargs):
"""wrapped with update, override that in a subclass to customize"""
requests_params, update_uri, session, read_only = \
self._prepare_put_or_patch(kwargs)
read_only_mutations = []
for attr in read_only:
if attr in kwargs:
... | python | def _update(self, **kwargs):
requests_params, update_uri, session, read_only = \
self._prepare_put_or_patch(kwargs)
read_only_mutations = []
for attr in read_only:
if attr in kwargs:
read_only_mutations.append(attr)
if read_only_mutations:
... | [
"def",
"_update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"requests_params",
",",
"update_uri",
",",
"session",
",",
"read_only",
"=",
"self",
".",
"_prepare_put_or_patch",
"(",
"kwargs",
")",
"read_only_mutations",
"=",
"[",
"]",
"for",
"attr",
"i... | wrapped with update, override that in a subclass to customize | [
"wrapped",
"with",
"update",
"override",
"that",
"in",
"a",
"subclass",
"to",
"customize"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L519-L594 |
251,143 | F5Networks/f5-common-python | f5/bigip/resource.py | ResourceBase._refresh | def _refresh(self, **kwargs):
"""wrapped by `refresh` override that in a subclass to customize"""
requests_params = self._handle_requests_params(kwargs)
refresh_session = self._meta_data['bigip']._meta_data['icr_session']
if self._meta_data['uri'].endswith('/stats/'):
# Slic... | python | def _refresh(self, **kwargs):
requests_params = self._handle_requests_params(kwargs)
refresh_session = self._meta_data['bigip']._meta_data['icr_session']
if self._meta_data['uri'].endswith('/stats/'):
# Slicing off the trailing slash here for Stats enpoints because
# iWo... | [
"def",
"_refresh",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"requests_params",
"=",
"self",
".",
"_handle_requests_params",
"(",
"kwargs",
")",
"refresh_session",
"=",
"self",
".",
"_meta_data",
"[",
"'bigip'",
"]",
".",
"_meta_data",
"[",
"'icr_sessi... | wrapped by `refresh` override that in a subclass to customize | [
"wrapped",
"by",
"refresh",
"override",
"that",
"in",
"a",
"subclass",
"to",
"customize"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L619-L635 |
251,144 | F5Networks/f5-common-python | f5/bigip/resource.py | ResourceBase._produce_instance | def _produce_instance(self, response):
'''Generate a new self, which is an instance of the self.'''
new_instance = self._stamp_out_core()
# Post-process the response
new_instance._local_update(response.json())
# Allow for example files, which are KindTypeMismatches
if ha... | python | def _produce_instance(self, response):
'''Generate a new self, which is an instance of the self.'''
new_instance = self._stamp_out_core()
# Post-process the response
new_instance._local_update(response.json())
# Allow for example files, which are KindTypeMismatches
if ha... | [
"def",
"_produce_instance",
"(",
"self",
",",
"response",
")",
":",
"new_instance",
"=",
"self",
".",
"_stamp_out_core",
"(",
")",
"# Post-process the response",
"new_instance",
".",
"_local_update",
"(",
"response",
".",
"json",
"(",
")",
")",
"# Allow for exampl... | Generate a new self, which is an instance of the self. | [
"Generate",
"a",
"new",
"self",
"which",
"is",
"an",
"instance",
"of",
"the",
"self",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L681-L714 |
251,145 | F5Networks/f5-common-python | f5/bigip/resource.py | ResourceBase._reduce_boolean_pair | def _reduce_boolean_pair(self, config_dict, key1, key2):
"""Ensure only one key with a boolean value is present in dict.
:param config_dict: dict -- dictionary of config or kwargs
:param key1: string -- first key name
:param key2: string -- second key name
:raises: BooleansToRed... | python | def _reduce_boolean_pair(self, config_dict, key1, key2):
if key1 in config_dict and key2 in config_dict \
and config_dict[key1] == config_dict[key2]:
msg = 'Boolean pair, %s and %s, have same value: %s. If both ' \
'are given to this method, they cannot be the same, a... | [
"def",
"_reduce_boolean_pair",
"(",
"self",
",",
"config_dict",
",",
"key1",
",",
"key2",
")",
":",
"if",
"key1",
"in",
"config_dict",
"and",
"key2",
"in",
"config_dict",
"and",
"config_dict",
"[",
"key1",
"]",
"==",
"config_dict",
"[",
"key2",
"]",
":",
... | Ensure only one key with a boolean value is present in dict.
:param config_dict: dict -- dictionary of config or kwargs
:param key1: string -- first key name
:param key2: string -- second key name
:raises: BooleansToReduceHaveSameValue | [
"Ensure",
"only",
"one",
"key",
"with",
"a",
"boolean",
"value",
"is",
"present",
"in",
"dict",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L716-L738 |
251,146 | F5Networks/f5-common-python | f5/bigip/resource.py | Collection.get_collection | def get_collection(self, **kwargs):
"""Get an iterator of Python ``Resource`` objects that represent URIs.
The returned objects are Pythonic `Resource`s that map to the most
recently `refreshed` state of uris-resources published by the device.
In order to instantiate the correct types, ... | python | def get_collection(self, **kwargs):
list_of_contents = []
self.refresh(**kwargs)
if 'items' in self.__dict__:
for item in self.items:
# It's possible to have non-"kind" JSON returned. We just
# append the corresponding dict. PostProcessing is the calle... | [
"def",
"get_collection",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"list_of_contents",
"=",
"[",
"]",
"self",
".",
"refresh",
"(",
"*",
"*",
"kwargs",
")",
"if",
"'items'",
"in",
"self",
".",
"__dict__",
":",
"for",
"item",
"in",
"self",
".",
... | Get an iterator of Python ``Resource`` objects that represent URIs.
The returned objects are Pythonic `Resource`s that map to the most
recently `refreshed` state of uris-resources published by the device.
In order to instantiate the correct types, the concrete subclass must
populate its... | [
"Get",
"an",
"iterator",
"of",
"Python",
"Resource",
"objects",
"that",
"represent",
"URIs",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L783-L819 |
251,147 | F5Networks/f5-common-python | f5/bigip/resource.py | Collection._delete_collection | def _delete_collection(self, **kwargs):
"""wrapped with delete_collection, override that in a sublcass to customize """
error_message = "The request must include \"requests_params\": {\"params\": \"options=<glob pattern>\"} as kwarg"
try:
if kwargs['requests_params']['params'].split(... | python | def _delete_collection(self, **kwargs):
error_message = "The request must include \"requests_params\": {\"params\": \"options=<glob pattern>\"} as kwarg"
try:
if kwargs['requests_params']['params'].split('=')[0] != 'options':
raise MissingRequiredRequestsParameter(error_messa... | [
"def",
"_delete_collection",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"error_message",
"=",
"\"The request must include \\\"requests_params\\\": {\\\"params\\\": \\\"options=<glob pattern>\\\"} as kwarg\"",
"try",
":",
"if",
"kwargs",
"[",
"'requests_params'",
"]",
"["... | wrapped with delete_collection, override that in a sublcass to customize | [
"wrapped",
"with",
"delete_collection",
"override",
"that",
"in",
"a",
"sublcass",
"to",
"customize"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L821-L834 |
251,148 | F5Networks/f5-common-python | f5/bigip/resource.py | Resource._activate_URI | def _activate_URI(self, selfLinkuri):
"""Call this with a selfLink, after it's returned in _create or _load.
Each instance is tightly bound to a particular service URI. When that
service is created by this library, or loaded from the device, the URI
is set to self._meta_data['uri']. ... | python | def _activate_URI(self, selfLinkuri):
# netloc local alias
uri = urlparse.urlsplit(str(self._meta_data['bigip']._meta_data['uri']))
# attrs local alias
attribute_reg = self._meta_data.get('attribute_registry', {})
attrs = list(itervalues(attribute_reg))
attrs = self._ass... | [
"def",
"_activate_URI",
"(",
"self",
",",
"selfLinkuri",
")",
":",
"# netloc local alias",
"uri",
"=",
"urlparse",
".",
"urlsplit",
"(",
"str",
"(",
"self",
".",
"_meta_data",
"[",
"'bigip'",
"]",
".",
"_meta_data",
"[",
"'uri'",
"]",
")",
")",
"# attrs lo... | Call this with a selfLink, after it's returned in _create or _load.
Each instance is tightly bound to a particular service URI. When that
service is created by this library, or loaded from the device, the URI
is set to self._meta_data['uri']. This operation can only occur once,
any s... | [
"Call",
"this",
"with",
"a",
"selfLink",
"after",
"it",
"s",
"returned",
"in",
"_create",
"or",
"_load",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L900-L949 |
251,149 | F5Networks/f5-common-python | f5/bigip/resource.py | Resource._check_create_parameters | def _check_create_parameters(self, **kwargs):
"""Params given to create should satisfy required params.
:params: kwargs
:raises: MissingRequiredCreateParameter
"""
rset = self._meta_data['required_creation_parameters']
check = _missing_required_parameters(rset, **kwargs)... | python | def _check_create_parameters(self, **kwargs):
rset = self._meta_data['required_creation_parameters']
check = _missing_required_parameters(rset, **kwargs)
if check:
error_message = 'Missing required params: %s' % check
raise MissingRequiredCreationParameter(error_message) | [
"def",
"_check_create_parameters",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"rset",
"=",
"self",
".",
"_meta_data",
"[",
"'required_creation_parameters'",
"]",
"check",
"=",
"_missing_required_parameters",
"(",
"rset",
",",
"*",
"*",
"kwargs",
")",
"if"... | Params given to create should satisfy required params.
:params: kwargs
:raises: MissingRequiredCreateParameter | [
"Params",
"given",
"to",
"create",
"should",
"satisfy",
"required",
"params",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L956-L966 |
251,150 | F5Networks/f5-common-python | f5/bigip/resource.py | Resource._minimum_one_is_missing | def _minimum_one_is_missing(self, **kwargs):
"""Helper function to do operation on sets
Verify if at least one of the elements
is present in **kwargs. If no items of rqset
are contained in **kwargs the function
raises exception.
This check will only trigger if rqset is... | python | def _minimum_one_is_missing(self, **kwargs):
rqset = self._meta_data['minimum_additional_parameters']
if rqset:
kwarg_set = set(iterkeys(kwargs))
if kwarg_set.isdisjoint(rqset):
args = sorted(rqset)
error_message = 'This resource requires at least ... | [
"def",
"_minimum_one_is_missing",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"rqset",
"=",
"self",
".",
"_meta_data",
"[",
"'minimum_additional_parameters'",
"]",
"if",
"rqset",
":",
"kwarg_set",
"=",
"set",
"(",
"iterkeys",
"(",
"kwargs",
")",
")",
"... | Helper function to do operation on sets
Verify if at least one of the elements
is present in **kwargs. If no items of rqset
are contained in **kwargs the function
raises exception.
This check will only trigger if rqset is not empty.
Raises:
MissingRequire... | [
"Helper",
"function",
"to",
"do",
"operation",
"on",
"sets"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L968-L989 |
251,151 | F5Networks/f5-common-python | f5/bigip/resource.py | Resource._check_load_parameters | def _check_load_parameters(self, **kwargs):
"""Params given to load should at least satisfy required params.
:params: kwargs
:raises: MissingRequiredReadParameter
"""
rset = self._meta_data['required_load_parameters']
check = _missing_required_parameters(rset, **kwargs)
... | python | def _check_load_parameters(self, **kwargs):
rset = self._meta_data['required_load_parameters']
check = _missing_required_parameters(rset, **kwargs)
if check:
check.sort()
error_message = 'Missing required params: %s' % check
raise MissingRequiredReadParameter(... | [
"def",
"_check_load_parameters",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"rset",
"=",
"self",
".",
"_meta_data",
"[",
"'required_load_parameters'",
"]",
"check",
"=",
"_missing_required_parameters",
"(",
"rset",
",",
"*",
"*",
"kwargs",
")",
"if",
"c... | Params given to load should at least satisfy required params.
:params: kwargs
:raises: MissingRequiredReadParameter | [
"Params",
"given",
"to",
"load",
"should",
"at",
"least",
"satisfy",
"required",
"params",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L1055-L1066 |
251,152 | F5Networks/f5-common-python | f5/bigip/resource.py | Resource._load | def _load(self, **kwargs):
"""wrapped with load, override that in a subclass to customize"""
if 'uri' in self._meta_data:
error = "There was an attempt to assign a new uri to this "\
"resource, the _meta_data['uri'] is %s and it should"\
" not be chang... | python | def _load(self, **kwargs):
if 'uri' in self._meta_data:
error = "There was an attempt to assign a new uri to this "\
"resource, the _meta_data['uri'] is %s and it should"\
" not be changed." % (self._meta_data['uri'])
raise URICreationCollision(err... | [
"def",
"_load",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'uri'",
"in",
"self",
".",
"_meta_data",
":",
"error",
"=",
"\"There was an attempt to assign a new uri to this \"",
"\"resource, the _meta_data['uri'] is %s and it should\"",
"\" not be changed.\"",
"... | wrapped with load, override that in a subclass to customize | [
"wrapped",
"with",
"load",
"override",
"that",
"in",
"a",
"subclass",
"to",
"customize"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L1068-L1086 |
251,153 | F5Networks/f5-common-python | f5/bigip/resource.py | Resource._delete | def _delete(self, **kwargs):
"""wrapped with delete, override that in a subclass to customize """
requests_params = self._handle_requests_params(kwargs)
delete_uri = self._meta_data['uri']
session = self._meta_data['bigip']._meta_data['icr_session']
# Check the generation for m... | python | def _delete(self, **kwargs):
requests_params = self._handle_requests_params(kwargs)
delete_uri = self._meta_data['uri']
session = self._meta_data['bigip']._meta_data['icr_session']
# Check the generation for match before delete
force = self._check_force_arg(kwargs.pop('force', ... | [
"def",
"_delete",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"requests_params",
"=",
"self",
".",
"_handle_requests_params",
"(",
"kwargs",
")",
"delete_uri",
"=",
"self",
".",
"_meta_data",
"[",
"'uri'",
"]",
"session",
"=",
"self",
".",
"_meta_data"... | wrapped with delete, override that in a subclass to customize | [
"wrapped",
"with",
"delete",
"override",
"that",
"in",
"a",
"subclass",
"to",
"customize"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L1112-L1126 |
251,154 | F5Networks/f5-common-python | f5/bigip/resource.py | AsmResource._delete | def _delete(self, **kwargs):
"""Wrapped with delete, override that in a subclass to customize """
requests_params = self._handle_requests_params(kwargs)
delete_uri = self._meta_data['uri']
session = self._meta_data['bigip']._meta_data['icr_session']
response = session.delete(del... | python | def _delete(self, **kwargs):
requests_params = self._handle_requests_params(kwargs)
delete_uri = self._meta_data['uri']
session = self._meta_data['bigip']._meta_data['icr_session']
response = session.delete(delete_uri, **requests_params)
if response.status_code == 200 or 201:
... | [
"def",
"_delete",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"requests_params",
"=",
"self",
".",
"_handle_requests_params",
"(",
"kwargs",
")",
"delete_uri",
"=",
"self",
".",
"_meta_data",
"[",
"'uri'",
"]",
"session",
"=",
"self",
".",
"_meta_data"... | Wrapped with delete, override that in a subclass to customize | [
"Wrapped",
"with",
"delete",
"override",
"that",
"in",
"a",
"subclass",
"to",
"customize"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L1322-L1330 |
251,155 | F5Networks/f5-common-python | f5/bigip/resource.py | AsmResource.exists | def exists(self, **kwargs):
r"""Check for the existence of the ASM object on the BIG-IP
Sends an HTTP GET to the URI of the ASM object and if it fails with
a :exc:~requests.HTTPError` exception it checks the exception for
status code of 404 and returns :obj:`False` in that case.
... | python | def exists(self, **kwargs):
r"""Check for the existence of the ASM object on the BIG-IP
Sends an HTTP GET to the URI of the ASM object and if it fails with
a :exc:~requests.HTTPError` exception it checks the exception for
status code of 404 and returns :obj:`False` in that case.
... | [
"def",
"exists",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"requests_params",
"=",
"self",
".",
"_handle_requests_params",
"(",
"kwargs",
")",
"self",
".",
"_check_load_parameters",
"(",
"*",
"*",
"kwargs",
")",
"kwargs",
"[",
"'uri_as_parts'",
"]",
... | r"""Check for the existence of the ASM object on the BIG-IP
Sends an HTTP GET to the URI of the ASM object and if it fails with
a :exc:~requests.HTTPError` exception it checks the exception for
status code of 404 and returns :obj:`False` in that case.
If the GET is successful it return... | [
"r",
"Check",
"for",
"the",
"existence",
"of",
"the",
"ASM",
"object",
"on",
"the",
"BIG",
"-",
"IP"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L1350-L1392 |
251,156 | F5Networks/f5-common-python | f5/bigip/resource.py | AsmTaskResource._fetch | def _fetch(self):
"""wrapped by `fetch` override that in subclasses to customize"""
if 'uri' in self._meta_data:
error = "There was an attempt to assign a new uri to this "\
"resource, the _meta_data['uri'] is %s and it should"\
" not be changed." % (s... | python | def _fetch(self):
if 'uri' in self._meta_data:
error = "There was an attempt to assign a new uri to this "\
"resource, the _meta_data['uri'] is %s and it should"\
" not be changed." % (self._meta_data['uri'])
raise URICreationCollision(error)
... | [
"def",
"_fetch",
"(",
"self",
")",
":",
"if",
"'uri'",
"in",
"self",
".",
"_meta_data",
":",
"error",
"=",
"\"There was an attempt to assign a new uri to this \"",
"\"resource, the _meta_data['uri'] is %s and it should\"",
"\" not be changed.\"",
"%",
"(",
"self",
".",
"_... | wrapped by `fetch` override that in subclasses to customize | [
"wrapped",
"by",
"fetch",
"override",
"that",
"in",
"subclasses",
"to",
"customize"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L1423-L1436 |
251,157 | F5Networks/f5-common-python | f5/multi_device/cluster/__init__.py | ClusterManager._check_device_number | def _check_device_number(self, devices):
'''Check if number of devices is between 2 and 4
:param kwargs: dict -- keyword args in dict
'''
if len(devices) < 2 or len(devices) > 4:
msg = 'The number of devices to cluster is not supported.'
raise ClusterNotSupporte... | python | def _check_device_number(self, devices):
'''Check if number of devices is between 2 and 4
:param kwargs: dict -- keyword args in dict
'''
if len(devices) < 2 or len(devices) > 4:
msg = 'The number of devices to cluster is not supported.'
raise ClusterNotSupporte... | [
"def",
"_check_device_number",
"(",
"self",
",",
"devices",
")",
":",
"if",
"len",
"(",
"devices",
")",
"<",
"2",
"or",
"len",
"(",
"devices",
")",
">",
"4",
":",
"msg",
"=",
"'The number of devices to cluster is not supported.'",
"raise",
"ClusterNotSupported",... | Check if number of devices is between 2 and 4
:param kwargs: dict -- keyword args in dict | [
"Check",
"if",
"number",
"of",
"devices",
"is",
"between",
"2",
"and",
"4"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/cluster/__init__.py#L126-L134 |
251,158 | F5Networks/f5-common-python | f5/multi_device/cluster/__init__.py | ClusterManager.manage_extant | def manage_extant(self, **kwargs):
'''Manage an existing cluster
:param kwargs: dict -- keyword args in dict
'''
self._check_device_number(kwargs['devices'])
self.trust_domain = TrustDomain(
devices=kwargs['devices'],
partition=kwargs['device_group_parti... | python | def manage_extant(self, **kwargs):
'''Manage an existing cluster
:param kwargs: dict -- keyword args in dict
'''
self._check_device_number(kwargs['devices'])
self.trust_domain = TrustDomain(
devices=kwargs['devices'],
partition=kwargs['device_group_parti... | [
"def",
"manage_extant",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_check_device_number",
"(",
"kwargs",
"[",
"'devices'",
"]",
")",
"self",
".",
"trust_domain",
"=",
"TrustDomain",
"(",
"devices",
"=",
"kwargs",
"[",
"'devices'",
"]",
... | Manage an existing cluster
:param kwargs: dict -- keyword args in dict | [
"Manage",
"an",
"existing",
"cluster"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/cluster/__init__.py#L136-L148 |
251,159 | F5Networks/f5-common-python | f5/bigip/tm/ltm/policy.py | Policy._filter_version_specific_options | def _filter_version_specific_options(self, tmos_ver, **kwargs):
'''Filter version-specific optional parameters
Some optional parameters only exist in v12.1.0 and greater,
filter these out for earlier versions to allow backward comatibility.
'''
if LooseVersion(tmos_ver) < Loose... | python | def _filter_version_specific_options(self, tmos_ver, **kwargs):
'''Filter version-specific optional parameters
Some optional parameters only exist in v12.1.0 and greater,
filter these out for earlier versions to allow backward comatibility.
'''
if LooseVersion(tmos_ver) < Loose... | [
"def",
"_filter_version_specific_options",
"(",
"self",
",",
"tmos_ver",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"LooseVersion",
"(",
"tmos_ver",
")",
"<",
"LooseVersion",
"(",
"'12.1.0'",
")",
":",
"for",
"k",
",",
"parms",
"in",
"self",
".",
"_meta_data... | Filter version-specific optional parameters
Some optional parameters only exist in v12.1.0 and greater,
filter these out for earlier versions to allow backward comatibility. | [
"Filter",
"version",
"-",
"specific",
"optional",
"parameters"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/policy.py#L64-L79 |
251,160 | F5Networks/f5-common-python | f5/bigip/tm/ltm/policy.py | Policy._create | def _create(self, **kwargs):
'''Allow creation of draft policy and ability to publish a draft
Draft policies only exist in 12.1.0 and greater versions of TMOS.
But there must be a method to create a draft, then publish it.
:raises: MissingRequiredCreationParameter
'''
... | python | def _create(self, **kwargs):
'''Allow creation of draft policy and ability to publish a draft
Draft policies only exist in 12.1.0 and greater versions of TMOS.
But there must be a method to create a draft, then publish it.
:raises: MissingRequiredCreationParameter
'''
... | [
"def",
"_create",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"tmos_ver",
"=",
"self",
".",
"_meta_data",
"[",
"'bigip'",
"]",
".",
"_meta_data",
"[",
"'tmos_version'",
"]",
"legacy",
"=",
"kwargs",
".",
"pop",
"(",
"'legacy'",
",",
"False",
")",
... | Allow creation of draft policy and ability to publish a draft
Draft policies only exist in 12.1.0 and greater versions of TMOS.
But there must be a method to create a draft, then publish it.
:raises: MissingRequiredCreationParameter | [
"Allow",
"creation",
"of",
"draft",
"policy",
"and",
"ability",
"to",
"publish",
"a",
"draft"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/policy.py#L81-L108 |
251,161 | F5Networks/f5-common-python | f5/bigip/tm/ltm/policy.py | Policy._modify | def _modify(self, **patch):
'''Modify only draft or legacy policies
Published policies cannot be modified
:raises: OperationNotSupportedOnPublishedPolicy
'''
legacy = patch.pop('legacy', False)
tmos_ver = self._meta_data['bigip']._meta_data['tmos_version']
self.... | python | def _modify(self, **patch):
'''Modify only draft or legacy policies
Published policies cannot be modified
:raises: OperationNotSupportedOnPublishedPolicy
'''
legacy = patch.pop('legacy', False)
tmos_ver = self._meta_data['bigip']._meta_data['tmos_version']
self.... | [
"def",
"_modify",
"(",
"self",
",",
"*",
"*",
"patch",
")",
":",
"legacy",
"=",
"patch",
".",
"pop",
"(",
"'legacy'",
",",
"False",
")",
"tmos_ver",
"=",
"self",
".",
"_meta_data",
"[",
"'bigip'",
"]",
".",
"_meta_data",
"[",
"'tmos_version'",
"]",
"... | Modify only draft or legacy policies
Published policies cannot be modified
:raises: OperationNotSupportedOnPublishedPolicy | [
"Modify",
"only",
"draft",
"or",
"legacy",
"policies"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/policy.py#L110-L125 |
251,162 | F5Networks/f5-common-python | f5/bigip/tm/ltm/policy.py | Policy._update | def _update(self, **kwargs):
'''Update only draft or legacy policies
Published policies cannot be updated
:raises: OperationNotSupportedOnPublishedPolicy
'''
legacy = kwargs.pop('legacy', False)
tmos_ver = self._meta_data['bigip']._meta_data['tmos_version']
self... | python | def _update(self, **kwargs):
'''Update only draft or legacy policies
Published policies cannot be updated
:raises: OperationNotSupportedOnPublishedPolicy
'''
legacy = kwargs.pop('legacy', False)
tmos_ver = self._meta_data['bigip']._meta_data['tmos_version']
self... | [
"def",
"_update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"legacy",
"=",
"kwargs",
".",
"pop",
"(",
"'legacy'",
",",
"False",
")",
"tmos_ver",
"=",
"self",
".",
"_meta_data",
"[",
"'bigip'",
"]",
".",
"_meta_data",
"[",
"'tmos_version'",
"]",
... | Update only draft or legacy policies
Published policies cannot be updated
:raises: OperationNotSupportedOnPublishedPolicy | [
"Update",
"only",
"draft",
"or",
"legacy",
"policies"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/policy.py#L127-L142 |
251,163 | F5Networks/f5-common-python | f5/bigip/tm/ltm/policy.py | Policy.publish | def publish(self, **kwargs):
'''Publishing a draft policy is only applicable in TMOS 12.1 and up.
This operation updates the meta_data['uri'] of the existing object
and effectively moves a draft into a published state on the device.
The self object is also updated with the response from... | python | def publish(self, **kwargs):
'''Publishing a draft policy is only applicable in TMOS 12.1 and up.
This operation updates the meta_data['uri'] of the existing object
and effectively moves a draft into a published state on the device.
The self object is also updated with the response from... | [
"def",
"publish",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"'Drafts'",
"in",
"self",
".",
"_meta_data",
"[",
"'uri'",
"]",
"assert",
"self",
".",
"status",
".",
"lower",
"(",
")",
"==",
"'draft'",
"base_uri",
"=",
"self",
".",
"_meta... | Publishing a draft policy is only applicable in TMOS 12.1 and up.
This operation updates the meta_data['uri'] of the existing object
and effectively moves a draft into a published state on the device.
The self object is also updated with the response from a GET to the
device.
:... | [
"Publishing",
"a",
"draft",
"policy",
"is",
"only",
"applicable",
"in",
"TMOS",
"12",
".",
"1",
"and",
"up",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/policy.py#L144-L172 |
251,164 | F5Networks/f5-common-python | f5/bigip/tm/ltm/policy.py | Policy.draft | def draft(self, **kwargs):
'''Allows for easily re-drafting a policy
After a policy has been created, it was not previously possible
to re-draft the published policy. This method makes it possible
for a user with existing, published, policies to create drafts
from them so that t... | python | def draft(self, **kwargs):
'''Allows for easily re-drafting a policy
After a policy has been created, it was not previously possible
to re-draft the published policy. This method makes it possible
for a user with existing, published, policies to create drafts
from them so that t... | [
"def",
"draft",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"tmos_ver",
"=",
"self",
".",
"_meta_data",
"[",
"'bigip'",
"]",
".",
"_meta_data",
"[",
"'tmos_version'",
"]",
"legacy",
"=",
"kwargs",
".",
"pop",
"(",
"'legacy'",
",",
"False",
")",
"... | Allows for easily re-drafting a policy
After a policy has been created, it was not previously possible
to re-draft the published policy. This method makes it possible
for a user with existing, published, policies to create drafts
from them so that they are modifiable.
See https:... | [
"Allows",
"for",
"easily",
"re",
"-",
"drafting",
"a",
"policy"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/policy.py#L174-L208 |
251,165 | F5Networks/f5-common-python | f5/bigiq/cm/shared/licensing/pools.py | Member.delete | def delete(self, **kwargs):
"""Deletes a member from an unmanaged license pool
You need to be careful with this method. When you use it, and it
succeeds on the remote BIG-IP, the configuration of the BIG-IP
will be reloaded. During this process, you will not be able to
access th... | python | def delete(self, **kwargs):
if 'uuid' not in kwargs:
kwargs['uuid'] = str(self.uuid)
requests_params = self._handle_requests_params(kwargs)
kwargs = self._check_for_python_keywords(kwargs)
kwargs = self._prepare_request_json(kwargs)
delete_uri = self._meta_data['uri... | [
"def",
"delete",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'uuid'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'uuid'",
"]",
"=",
"str",
"(",
"self",
".",
"uuid",
")",
"requests_params",
"=",
"self",
".",
"_handle_requests_params",
"(",
... | Deletes a member from an unmanaged license pool
You need to be careful with this method. When you use it, and it
succeeds on the remote BIG-IP, the configuration of the BIG-IP
will be reloaded. During this process, you will not be able to
access the REST interface.
This method ... | [
"Deletes",
"a",
"member",
"from",
"an",
"unmanaged",
"license",
"pool"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigiq/cm/shared/licensing/pools.py#L101-L133 |
251,166 | F5Networks/f5-common-python | f5/bigip/tm/sys/failover.py | Failover.exec_cmd | def exec_cmd(self, command, **kwargs):
"""Defining custom method to append 'exclusive_attributes'.
WARNING: Some parameters are hyphenated therefore the function
will need to utilize variable keyword argument syntax.
This only applies when utilCmdArgs method is not in ... | python | def exec_cmd(self, command, **kwargs):
kwargs = self._reduce_boolean_pair(kwargs, 'online', 'offline')
if 'offline' in kwargs:
self._meta_data['exclusive_attributes'].append(
('offline', 'standby'))
if 'online' in kwargs:
self._meta_data['exclusive_attrib... | [
"def",
"exec_cmd",
"(",
"self",
",",
"command",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"self",
".",
"_reduce_boolean_pair",
"(",
"kwargs",
",",
"'online'",
",",
"'offline'",
")",
"if",
"'offline'",
"in",
"kwargs",
":",
"self",
".",
"_meta_data... | Defining custom method to append 'exclusive_attributes'.
WARNING: Some parameters are hyphenated therefore the function
will need to utilize variable keyword argument syntax.
This only applies when utilCmdArgs method is not in use.
eg.
param... | [
"Defining",
"custom",
"method",
"to",
"append",
"exclusive_attributes",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/sys/failover.py#L65-L103 |
251,167 | F5Networks/f5-common-python | f5/bigip/tm/sys/failover.py | Failover.toggle_standby | def toggle_standby(self, **kwargs):
"""Toggle the standby status of a traffic group.
WARNING: This method which used POST obtains json keys from the device
that are not available in the response to a GET against the same URI.
NOTE: This method method is deprecated and probably will ... | python | def toggle_standby(self, **kwargs):
trafficgroup = kwargs.pop('trafficgroup')
state = kwargs.pop('state')
if kwargs:
raise TypeError('Unexpected **kwargs: %r' % kwargs)
arguments = {'standby': state, 'traffic-group': trafficgroup}
return self.exec_cmd('run', **argumen... | [
"def",
"toggle_standby",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"trafficgroup",
"=",
"kwargs",
".",
"pop",
"(",
"'trafficgroup'",
")",
"state",
"=",
"kwargs",
".",
"pop",
"(",
"'state'",
")",
"if",
"kwargs",
":",
"raise",
"TypeError",
"(",
"'U... | Toggle the standby status of a traffic group.
WARNING: This method which used POST obtains json keys from the device
that are not available in the response to a GET against the same URI.
NOTE: This method method is deprecated and probably will be removed,
usage of exec_cmd is... | [
"Toggle",
"the",
"standby",
"status",
"of",
"a",
"traffic",
"group",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/sys/failover.py#L105-L120 |
251,168 | F5Networks/f5-common-python | f5/bigip/tm/ltm/profile.py | Ocsp_Stapling_Params.update | def update(self, **kwargs):
"""When setting useProxyServer to enable we need to supply
proxyServerPool value as well
"""
if 'useProxyServer' in kwargs and kwargs['useProxyServer'] == 'enabled':
if 'proxyServerPool' not in kwargs:
error = 'Missing proxySer... | python | def update(self, **kwargs):
if 'useProxyServer' in kwargs and kwargs['useProxyServer'] == 'enabled':
if 'proxyServerPool' not in kwargs:
error = 'Missing proxyServerPool parameter value.'
raise MissingUpdateParameter(error)
if hasattr(self, 'useProxyServer'):
... | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'useProxyServer'",
"in",
"kwargs",
"and",
"kwargs",
"[",
"'useProxyServer'",
"]",
"==",
"'enabled'",
":",
"if",
"'proxyServerPool'",
"not",
"in",
"kwargs",
":",
"error",
"=",
"'Missing... | When setting useProxyServer to enable we need to supply
proxyServerPool value as well | [
"When",
"setting",
"useProxyServer",
"to",
"enable",
"we",
"need",
"to",
"supply"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/profile.py#L678-L694 |
251,169 | F5Networks/f5-common-python | f5/bigip/tm/net/vlan.py | Interfaces._check_tagmode_and_tmos_version | def _check_tagmode_and_tmos_version(self, **kwargs):
'''Raise an exception if tagMode in kwargs and tmos version < 11.6.0
:param kwargs: dict -- keyword arguments for request
:raises: TagModeDisallowedForTMOSVersion
'''
tmos_version = self._meta_data['bigip']._meta_data['tmos_v... | python | def _check_tagmode_and_tmos_version(self, **kwargs):
'''Raise an exception if tagMode in kwargs and tmos version < 11.6.0
:param kwargs: dict -- keyword arguments for request
:raises: TagModeDisallowedForTMOSVersion
'''
tmos_version = self._meta_data['bigip']._meta_data['tmos_v... | [
"def",
"_check_tagmode_and_tmos_version",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"tmos_version",
"=",
"self",
".",
"_meta_data",
"[",
"'bigip'",
"]",
".",
"_meta_data",
"[",
"'tmos_version'",
"]",
"if",
"LooseVersion",
"(",
"tmos_version",
")",
"<",
... | Raise an exception if tagMode in kwargs and tmos version < 11.6.0
:param kwargs: dict -- keyword arguments for request
:raises: TagModeDisallowedForTMOSVersion | [
"Raise",
"an",
"exception",
"if",
"tagMode",
"in",
"kwargs",
"and",
"tmos",
"version",
"<",
"11",
".",
"6",
".",
"0"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/net/vlan.py#L97-L109 |
251,170 | F5Networks/f5-common-python | f5/bigip/tm/ltm/virtual.py | Policies.load | def load(self, **kwargs):
"""Override load to retrieve object based on exists above."""
tmos_v = self._meta_data['bigip']._meta_data['tmos_version']
if self._check_existence_by_collection(
self._meta_data['container'], kwargs['name']):
if LooseVersion(tmos_v) == Loose... | python | def load(self, **kwargs):
tmos_v = self._meta_data['bigip']._meta_data['tmos_version']
if self._check_existence_by_collection(
self._meta_data['container'], kwargs['name']):
if LooseVersion(tmos_v) == LooseVersion('11.5.4'):
return self._load_11_5_4(**kwargs)
... | [
"def",
"load",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"tmos_v",
"=",
"self",
".",
"_meta_data",
"[",
"'bigip'",
"]",
".",
"_meta_data",
"[",
"'tmos_version'",
"]",
"if",
"self",
".",
"_check_existence_by_collection",
"(",
"self",
".",
"_meta_data"... | Override load to retrieve object based on exists above. | [
"Override",
"load",
"to",
"retrieve",
"object",
"based",
"on",
"exists",
"above",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/virtual.py#L127-L138 |
251,171 | F5Networks/f5-common-python | f5/bigip/tm/ltm/virtual.py | Policies._load_11_5_4 | def _load_11_5_4(self, **kwargs):
"""Custom _load method to accommodate for issue in 11.5.4,
where an existing object would return 404 HTTP response.
"""
if 'uri' in self._meta_data:
error = "There was an attempt to assign a new uri to this " \
"resource,... | python | def _load_11_5_4(self, **kwargs):
if 'uri' in self._meta_data:
error = "There was an attempt to assign a new uri to this " \
"resource, the _meta_data['uri'] is %s and it should" \
" not be changed." % (self._meta_data['uri'])
raise URICreationColl... | [
"def",
"_load_11_5_4",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'uri'",
"in",
"self",
".",
"_meta_data",
":",
"error",
"=",
"\"There was an attempt to assign a new uri to this \"",
"\"resource, the _meta_data['uri'] is %s and it should\"",
"\" not be changed.\... | Custom _load method to accommodate for issue in 11.5.4,
where an existing object would return 404 HTTP response. | [
"Custom",
"_load",
"method",
"to",
"accommodate",
"for",
"issue",
"in",
"11",
".",
"5",
".",
"4"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/virtual.py#L140-L169 |
251,172 | F5Networks/f5-common-python | f5/bigip/tm/ltm/virtual.py | Policies.create | def create(self, **kwargs):
"""Custom _create method to accommodate for issue 11.5.4 and 12.1.1,
Where creation of an object would return 404, despite the object
being created.
"""
tmos_v = self._meta_data['bigip']._meta_data['tmos_version']
if LooseVersion(tmos_v) == Lo... | python | def create(self, **kwargs):
tmos_v = self._meta_data['bigip']._meta_data['tmos_version']
if LooseVersion(tmos_v) == LooseVersion('11.5.4') or LooseVersion(
tmos_v) == LooseVersion('12.1.1'):
if 'uri' in self._meta_data:
error = "There was an attempt to assign ... | [
"def",
"create",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"tmos_v",
"=",
"self",
".",
"_meta_data",
"[",
"'bigip'",
"]",
".",
"_meta_data",
"[",
"'tmos_version'",
"]",
"if",
"LooseVersion",
"(",
"tmos_v",
")",
"==",
"LooseVersion",
"(",
"'11.5.4'"... | Custom _create method to accommodate for issue 11.5.4 and 12.1.1,
Where creation of an object would return 404, despite the object
being created. | [
"Custom",
"_create",
"method",
"to",
"accommodate",
"for",
"issue",
"11",
".",
"5",
".",
"4",
"and",
"12",
".",
"1",
".",
"1"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/virtual.py#L171-L212 |
251,173 | F5Networks/f5-common-python | f5/bigip/tm/ltm/virtual.py | Policies_s.get_collection | def get_collection(self, **kwargs):
"""We need special get collection method to address issue in 11.5.4
In 11.5.4 collection 'items' were nested under 'policiesReference'
key. This has caused get_collection() calls to return empty list.
This fix will update the list if the policiesRefer... | python | def get_collection(self, **kwargs):
list_of_contents = []
self.refresh(**kwargs)
if 'items' in self.__dict__:
for item in self.items:
# It's possible to have non-"kind" JSON returned. We just
# append the corresponding dict. PostProcessing is the calle... | [
"def",
"get_collection",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"list_of_contents",
"=",
"[",
"]",
"self",
".",
"refresh",
"(",
"*",
"*",
"kwargs",
")",
"if",
"'items'",
"in",
"self",
".",
"__dict__",
":",
"for",
"item",
"in",
"self",
".",
... | We need special get collection method to address issue in 11.5.4
In 11.5.4 collection 'items' were nested under 'policiesReference'
key. This has caused get_collection() calls to return empty list.
This fix will update the list if the policiesReference key is found
and 'items' key do no... | [
"We",
"need",
"special",
"get",
"collection",
"method",
"to",
"address",
"issue",
"in",
"11",
".",
"5",
".",
"4"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/virtual.py#L223-L271 |
251,174 | F5Networks/f5-common-python | f5/multi_device/utils.py | get_device_names_to_objects | def get_device_names_to_objects(devices):
'''Map a list of devices to their hostnames.
:param devices: list -- list of ManagementRoot objects
:returns: dict -- mapping of hostnames to ManagementRoot objects
'''
name_to_object = {}
for device in devices:
device_name = get_device_info(de... | python | def get_device_names_to_objects(devices):
'''Map a list of devices to their hostnames.
:param devices: list -- list of ManagementRoot objects
:returns: dict -- mapping of hostnames to ManagementRoot objects
'''
name_to_object = {}
for device in devices:
device_name = get_device_info(de... | [
"def",
"get_device_names_to_objects",
"(",
"devices",
")",
":",
"name_to_object",
"=",
"{",
"}",
"for",
"device",
"in",
"devices",
":",
"device_name",
"=",
"get_device_info",
"(",
"device",
")",
".",
"name",
"name_to_object",
"[",
"device_name",
"]",
"=",
"dev... | Map a list of devices to their hostnames.
:param devices: list -- list of ManagementRoot objects
:returns: dict -- mapping of hostnames to ManagementRoot objects | [
"Map",
"a",
"list",
"of",
"devices",
"to",
"their",
"hostnames",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/utils.py#L42-L53 |
251,175 | F5Networks/f5-common-python | f5/bigip/tm/asm/policies/parameters.py | UrlParametersResource.create | def create(self, **kwargs):
"""Custom create method for v12.x and above.
Change of behavior in v12 where the returned selfLink is different
from target resource, requires us to append URI after object is
created. So any modify() calls will not lead to json kind
inconsistency wh... | python | def create(self, **kwargs):
if LooseVersion(self.tmos_v) < LooseVersion('12.0.0'):
return self._create(**kwargs)
else:
new_instance = self._create(**kwargs)
tmp_name = str(new_instance.id)
tmp_path = new_instance._meta_data['container']._meta_data['uri']
... | [
"def",
"create",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"LooseVersion",
"(",
"self",
".",
"tmos_v",
")",
"<",
"LooseVersion",
"(",
"'12.0.0'",
")",
":",
"return",
"self",
".",
"_create",
"(",
"*",
"*",
"kwargs",
")",
"else",
":",
"ne... | Custom create method for v12.x and above.
Change of behavior in v12 where the returned selfLink is different
from target resource, requires us to append URI after object is
created. So any modify() calls will not lead to json kind
inconsistency when changing the resource attribute.
... | [
"Custom",
"create",
"method",
"for",
"v12",
".",
"x",
"and",
"above",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/asm/policies/parameters.py#L88-L107 |
251,176 | F5Networks/f5-common-python | f5/bigip/tm/ltm/pool.py | Pool._format_monitor_parameter | def _format_monitor_parameter(param):
"""This is a workaround for a known issue ID645289, which affects
all versions of TMOS at this time.
"""
if '{' in param and '}':
tmp = param.strip('}').split('{')
monitor = ''.join(tmp).rstrip()
return monitor
... | python | def _format_monitor_parameter(param):
if '{' in param and '}':
tmp = param.strip('}').split('{')
monitor = ''.join(tmp).rstrip()
return monitor
else:
return param | [
"def",
"_format_monitor_parameter",
"(",
"param",
")",
":",
"if",
"'{'",
"in",
"param",
"and",
"'}'",
":",
"tmp",
"=",
"param",
".",
"strip",
"(",
"'}'",
")",
".",
"split",
"(",
"'{'",
")",
"monitor",
"=",
"''",
".",
"join",
"(",
"tmp",
")",
".",
... | This is a workaround for a known issue ID645289, which affects
all versions of TMOS at this time. | [
"This",
"is",
"a",
"workaround",
"for",
"a",
"known",
"issue",
"ID645289",
"which",
"affects"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/pool.py#L57-L67 |
251,177 | F5Networks/f5-common-python | f5/bigip/tm/ltm/pool.py | Pool.create | def create(self, **kwargs):
"""Custom create method to implement monitor parameter formatting."""
if 'monitor' in kwargs:
value = self._format_monitor_parameter(kwargs['monitor'])
kwargs['monitor'] = value
return super(Pool, self)._create(**kwargs) | python | def create(self, **kwargs):
if 'monitor' in kwargs:
value = self._format_monitor_parameter(kwargs['monitor'])
kwargs['monitor'] = value
return super(Pool, self)._create(**kwargs) | [
"def",
"create",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'monitor'",
"in",
"kwargs",
":",
"value",
"=",
"self",
".",
"_format_monitor_parameter",
"(",
"kwargs",
"[",
"'monitor'",
"]",
")",
"kwargs",
"[",
"'monitor'",
"]",
"=",
"value",
"... | Custom create method to implement monitor parameter formatting. | [
"Custom",
"create",
"method",
"to",
"implement",
"monitor",
"parameter",
"formatting",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/pool.py#L69-L74 |
251,178 | F5Networks/f5-common-python | f5/bigip/tm/ltm/pool.py | Pool.update | def update(self, **kwargs):
"""Custom update method to implement monitor parameter formatting."""
if 'monitor' in kwargs:
value = self._format_monitor_parameter(kwargs['monitor'])
kwargs['monitor'] = value
elif 'monitor' in self.__dict__:
value = self._format_... | python | def update(self, **kwargs):
if 'monitor' in kwargs:
value = self._format_monitor_parameter(kwargs['monitor'])
kwargs['monitor'] = value
elif 'monitor' in self.__dict__:
value = self._format_monitor_parameter(self.__dict__['monitor'])
self.__dict__['monitor... | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'monitor'",
"in",
"kwargs",
":",
"value",
"=",
"self",
".",
"_format_monitor_parameter",
"(",
"kwargs",
"[",
"'monitor'",
"]",
")",
"kwargs",
"[",
"'monitor'",
"]",
"=",
"value",
"... | Custom update method to implement monitor parameter formatting. | [
"Custom",
"update",
"method",
"to",
"implement",
"monitor",
"parameter",
"formatting",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/pool.py#L76-L84 |
251,179 | F5Networks/f5-common-python | f5/bigip/tm/ltm/pool.py | Pool.modify | def modify(self, **patch):
"""Custom modify method to implement monitor parameter formatting."""
if 'monitor' in patch:
value = self._format_monitor_parameter(patch['monitor'])
patch['monitor'] = value
return super(Pool, self)._modify(**patch) | python | def modify(self, **patch):
if 'monitor' in patch:
value = self._format_monitor_parameter(patch['monitor'])
patch['monitor'] = value
return super(Pool, self)._modify(**patch) | [
"def",
"modify",
"(",
"self",
",",
"*",
"*",
"patch",
")",
":",
"if",
"'monitor'",
"in",
"patch",
":",
"value",
"=",
"self",
".",
"_format_monitor_parameter",
"(",
"patch",
"[",
"'monitor'",
"]",
")",
"patch",
"[",
"'monitor'",
"]",
"=",
"value",
"retu... | Custom modify method to implement monitor parameter formatting. | [
"Custom",
"modify",
"method",
"to",
"implement",
"monitor",
"parameter",
"formatting",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/pool.py#L86-L91 |
251,180 | F5Networks/f5-common-python | f5/bigip/tm/ltm/pool.py | Members.exists | def exists(self, **kwargs):
"""Check for the existence of the named object on the BigIP
Sends an HTTP GET to the URI of the named object and if it fails with
a :exc:~requests.HTTPError` exception it checks the exception for
status code of 404 and returns :obj:`False` in that case.
... | python | def exists(self, **kwargs):
requests_params = self._handle_requests_params(kwargs)
self._check_load_parameters(**kwargs)
kwargs['uri_as_parts'] = True
session = self._meta_data['bigip']._meta_data['icr_session']
base_uri = self._meta_data['container']._meta_data['uri']
kw... | [
"def",
"exists",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"requests_params",
"=",
"self",
".",
"_handle_requests_params",
"(",
"kwargs",
")",
"self",
".",
"_check_load_parameters",
"(",
"*",
"*",
"kwargs",
")",
"kwargs",
"[",
"'uri_as_parts'",
"]",
... | Check for the existence of the named object on the BigIP
Sends an HTTP GET to the URI of the named object and if it fails with
a :exc:~requests.HTTPError` exception it checks the exception for
status code of 404 and returns :obj:`False` in that case.
If the GET is successful it must th... | [
"Check",
"for",
"the",
"existence",
"of",
"the",
"named",
"object",
"on",
"the",
"BigIP"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/ltm/pool.py#L162-L206 |
251,181 | F5Networks/f5-common-python | f5/bigip/tm/sys/ucs.py | Ucs.exec_cmd | def exec_cmd(self, command, **kwargs):
"""Due to ID476518 the load command need special treatment."""
self._is_allowed_command(command)
self._check_command_parameters(**kwargs)
if command == 'load':
kwargs['command'] = command
self._check_exclusive_parameters(**k... | python | def exec_cmd(self, command, **kwargs):
self._is_allowed_command(command)
self._check_command_parameters(**kwargs)
if command == 'load':
kwargs['command'] = command
self._check_exclusive_parameters(**kwargs)
requests_params = self._handle_requests_params(kwarg... | [
"def",
"exec_cmd",
"(",
"self",
",",
"command",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_is_allowed_command",
"(",
"command",
")",
"self",
".",
"_check_command_parameters",
"(",
"*",
"*",
"kwargs",
")",
"if",
"command",
"==",
"'load'",
":",
"kwa... | Due to ID476518 the load command need special treatment. | [
"Due",
"to",
"ID476518",
"the",
"load",
"command",
"need",
"special",
"treatment",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/sys/ucs.py#L60-L81 |
251,182 | F5Networks/f5-common-python | f5/bigip/tm/sys/ucs.py | Ucs.load | def load(self, **kwargs):
"""Method to list the UCS on the system
Since this is only fixed in 12.1.0 and up
we implemented version check here
"""
# Check if we are using 12.1.0 version or above when using this method
self._is_version_supported_method('12.1.0')
n... | python | def load(self, **kwargs):
# Check if we are using 12.1.0 version or above when using this method
self._is_version_supported_method('12.1.0')
newinst = self._stamp_out_core()
newinst._refresh(**kwargs)
return newinst | [
"def",
"load",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Check if we are using 12.1.0 version or above when using this method",
"self",
".",
"_is_version_supported_method",
"(",
"'12.1.0'",
")",
"newinst",
"=",
"self",
".",
"_stamp_out_core",
"(",
")",
"newin... | Method to list the UCS on the system
Since this is only fixed in 12.1.0 and up
we implemented version check here | [
"Method",
"to",
"list",
"the",
"UCS",
"on",
"the",
"system"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/sys/ucs.py#L83-L95 |
251,183 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup._set_attributes | def _set_attributes(self, **kwargs):
'''Set instance attributes based on kwargs
:param kwargs: dict -- kwargs to set as attributes
'''
try:
self.devices = kwargs['devices'][:]
self.name = kwargs['device_group_name']
self.type = kwargs['device_group_t... | python | def _set_attributes(self, **kwargs):
'''Set instance attributes based on kwargs
:param kwargs: dict -- kwargs to set as attributes
'''
try:
self.devices = kwargs['devices'][:]
self.name = kwargs['device_group_name']
self.type = kwargs['device_group_t... | [
"def",
"_set_attributes",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"devices",
"=",
"kwargs",
"[",
"'devices'",
"]",
"[",
":",
"]",
"self",
".",
"name",
"=",
"kwargs",
"[",
"'device_group_name'",
"]",
"self",
".",
"type... | Set instance attributes based on kwargs
:param kwargs: dict -- kwargs to set as attributes | [
"Set",
"instance",
"attributes",
"based",
"on",
"kwargs"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L104-L116 |
251,184 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup.validate | def validate(self, **kwargs):
'''Validate device group state among given devices.
:param kwargs: dict -- keyword args of device group information
:raises: UnexpectedDeviceGroupType, UnexpectedDeviceGroupDevices
'''
self._set_attributes(**kwargs)
self._check_type()
... | python | def validate(self, **kwargs):
'''Validate device group state among given devices.
:param kwargs: dict -- keyword args of device group information
:raises: UnexpectedDeviceGroupType, UnexpectedDeviceGroupDevices
'''
self._set_attributes(**kwargs)
self._check_type()
... | [
"def",
"validate",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_set_attributes",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"_check_type",
"(",
")",
"self",
".",
"dev_group_uri_res",
"=",
"self",
".",
"_get_device_group",
"(",
"self",
... | Validate device group state among given devices.
:param kwargs: dict -- keyword args of device group information
:raises: UnexpectedDeviceGroupType, UnexpectedDeviceGroupDevices | [
"Validate",
"device",
"group",
"state",
"among",
"given",
"devices",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L118-L142 |
251,185 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup._check_type | def _check_type(self):
'''Check that the device group type is correct.
:raises: DeviceGroupOperationNotSupported, DeviceGroupNotSupported
'''
if self.type not in self.available_types:
msg = 'Unsupported cluster type was given: %s' % self.type
raise DeviceGroupNo... | python | def _check_type(self):
'''Check that the device group type is correct.
:raises: DeviceGroupOperationNotSupported, DeviceGroupNotSupported
'''
if self.type not in self.available_types:
msg = 'Unsupported cluster type was given: %s' % self.type
raise DeviceGroupNo... | [
"def",
"_check_type",
"(",
"self",
")",
":",
"if",
"self",
".",
"type",
"not",
"in",
"self",
".",
"available_types",
":",
"msg",
"=",
"'Unsupported cluster type was given: %s'",
"%",
"self",
".",
"type",
"raise",
"DeviceGroupNotSupported",
"(",
"msg",
")",
"el... | Check that the device group type is correct.
:raises: DeviceGroupOperationNotSupported, DeviceGroupNotSupported | [
"Check",
"that",
"the",
"device",
"group",
"type",
"is",
"correct",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L144-L156 |
251,186 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup.create | def create(self, **kwargs):
'''Create the device service cluster group and add devices to it.'''
self._set_attributes(**kwargs)
self._check_type()
pollster(self._check_all_devices_in_sync)()
dg = self.devices[0].tm.cm.device_groups.device_group
dg.create(name=self.name, ... | python | def create(self, **kwargs):
'''Create the device service cluster group and add devices to it.'''
self._set_attributes(**kwargs)
self._check_type()
pollster(self._check_all_devices_in_sync)()
dg = self.devices[0].tm.cm.device_groups.device_group
dg.create(name=self.name, ... | [
"def",
"create",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_set_attributes",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"_check_type",
"(",
")",
"pollster",
"(",
"self",
".",
"_check_all_devices_in_sync",
")",
"(",
")",
"dg",
"=",
... | Create the device service cluster group and add devices to it. | [
"Create",
"the",
"device",
"service",
"cluster",
"group",
"and",
"add",
"devices",
"to",
"it",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L161-L172 |
251,187 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup.teardown | def teardown(self):
'''Teardown device service cluster group.'''
self.ensure_all_devices_in_sync()
for device in self.devices:
self._delete_device_from_device_group(device)
self._sync_to_group(device)
pollster(self._ensure_device_active)(device)
s... | python | def teardown(self):
'''Teardown device service cluster group.'''
self.ensure_all_devices_in_sync()
for device in self.devices:
self._delete_device_from_device_group(device)
self._sync_to_group(device)
pollster(self._ensure_device_active)(device)
s... | [
"def",
"teardown",
"(",
"self",
")",
":",
"self",
".",
"ensure_all_devices_in_sync",
"(",
")",
"for",
"device",
"in",
"self",
".",
"devices",
":",
"self",
".",
"_delete_device_from_device_group",
"(",
"device",
")",
"self",
".",
"_sync_to_group",
"(",
"device"... | Teardown device service cluster group. | [
"Teardown",
"device",
"service",
"cluster",
"group",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L174-L186 |
251,188 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup._get_device_group | def _get_device_group(self, device):
'''Get the device group through a device.
:param device: bigip object -- device
:returns: tm.cm.device_groups.device_group object
'''
return device.tm.cm.device_groups.device_group.load(
name=self.name, partition=self.partition
... | python | def _get_device_group(self, device):
'''Get the device group through a device.
:param device: bigip object -- device
:returns: tm.cm.device_groups.device_group object
'''
return device.tm.cm.device_groups.device_group.load(
name=self.name, partition=self.partition
... | [
"def",
"_get_device_group",
"(",
"self",
",",
"device",
")",
":",
"return",
"device",
".",
"tm",
".",
"cm",
".",
"device_groups",
".",
"device_group",
".",
"load",
"(",
"name",
"=",
"self",
".",
"name",
",",
"partition",
"=",
"self",
".",
"partition",
... | Get the device group through a device.
:param device: bigip object -- device
:returns: tm.cm.device_groups.device_group object | [
"Get",
"the",
"device",
"group",
"through",
"a",
"device",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L202-L211 |
251,189 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup._add_device_to_device_group | def _add_device_to_device_group(self, device):
'''Add device to device service cluster group.
:param device: bigip object -- device to add to group
'''
device_name = get_device_info(device).name
dg = pollster(self._get_device_group)(device)
dg.devices_s.devices.create(n... | python | def _add_device_to_device_group(self, device):
'''Add device to device service cluster group.
:param device: bigip object -- device to add to group
'''
device_name = get_device_info(device).name
dg = pollster(self._get_device_group)(device)
dg.devices_s.devices.create(n... | [
"def",
"_add_device_to_device_group",
"(",
"self",
",",
"device",
")",
":",
"device_name",
"=",
"get_device_info",
"(",
"device",
")",
".",
"name",
"dg",
"=",
"pollster",
"(",
"self",
".",
"_get_device_group",
")",
"(",
"device",
")",
"dg",
".",
"devices_s",... | Add device to device service cluster group.
:param device: bigip object -- device to add to group | [
"Add",
"device",
"to",
"device",
"service",
"cluster",
"group",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L224-L233 |
251,190 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup._check_device_exists_in_device_group | def _check_device_exists_in_device_group(self, device_name):
'''Check whether a device exists in the device group
:param device: ManagementRoot object -- device to look for
'''
dg = self._get_device_group(self.devices[0])
dg.devices_s.devices.load(name=device_name, partition=se... | python | def _check_device_exists_in_device_group(self, device_name):
'''Check whether a device exists in the device group
:param device: ManagementRoot object -- device to look for
'''
dg = self._get_device_group(self.devices[0])
dg.devices_s.devices.load(name=device_name, partition=se... | [
"def",
"_check_device_exists_in_device_group",
"(",
"self",
",",
"device_name",
")",
":",
"dg",
"=",
"self",
".",
"_get_device_group",
"(",
"self",
".",
"devices",
"[",
"0",
"]",
")",
"dg",
".",
"devices_s",
".",
"devices",
".",
"load",
"(",
"name",
"=",
... | Check whether a device exists in the device group
:param device: ManagementRoot object -- device to look for | [
"Check",
"whether",
"a",
"device",
"exists",
"in",
"the",
"device",
"group"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L235-L242 |
251,191 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup._delete_device_from_device_group | def _delete_device_from_device_group(self, device):
'''Remove device from device service cluster group.
:param device: ManagementRoot object -- device to delete from group
'''
device_name = get_device_info(device).name
dg = pollster(self._get_device_group)(device)
devic... | python | def _delete_device_from_device_group(self, device):
'''Remove device from device service cluster group.
:param device: ManagementRoot object -- device to delete from group
'''
device_name = get_device_info(device).name
dg = pollster(self._get_device_group)(device)
devic... | [
"def",
"_delete_device_from_device_group",
"(",
"self",
",",
"device",
")",
":",
"device_name",
"=",
"get_device_info",
"(",
"device",
")",
".",
"name",
"dg",
"=",
"pollster",
"(",
"self",
".",
"_get_device_group",
")",
"(",
"device",
")",
"device_to_remove",
... | Remove device from device service cluster group.
:param device: ManagementRoot object -- device to delete from group | [
"Remove",
"device",
"from",
"device",
"service",
"cluster",
"group",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L244-L255 |
251,192 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup._ensure_device_active | def _ensure_device_active(self, device):
'''Ensure a single device is in an active state
:param device: ManagementRoot object -- device to inspect
:raises: UnexpectedClusterState
'''
act = device.tm.cm.devices.device.load(
name=get_device_info(device).name,
... | python | def _ensure_device_active(self, device):
'''Ensure a single device is in an active state
:param device: ManagementRoot object -- device to inspect
:raises: UnexpectedClusterState
'''
act = device.tm.cm.devices.device.load(
name=get_device_info(device).name,
... | [
"def",
"_ensure_device_active",
"(",
"self",
",",
"device",
")",
":",
"act",
"=",
"device",
".",
"tm",
".",
"cm",
".",
"devices",
".",
"device",
".",
"load",
"(",
"name",
"=",
"get_device_info",
"(",
"device",
")",
".",
"name",
",",
"partition",
"=",
... | Ensure a single device is in an active state
:param device: ManagementRoot object -- device to inspect
:raises: UnexpectedClusterState | [
"Ensure",
"a",
"single",
"device",
"is",
"in",
"an",
"active",
"state"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L257-L270 |
251,193 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup._sync_to_group | def _sync_to_group(self, device):
'''Sync the device to the cluster group
:param device: bigip object -- device to sync to group
'''
config_sync_cmd = 'config-sync to-group %s' % self.name
device.tm.cm.exec_cmd('run', utilCmdArgs=config_sync_cmd) | python | def _sync_to_group(self, device):
'''Sync the device to the cluster group
:param device: bigip object -- device to sync to group
'''
config_sync_cmd = 'config-sync to-group %s' % self.name
device.tm.cm.exec_cmd('run', utilCmdArgs=config_sync_cmd) | [
"def",
"_sync_to_group",
"(",
"self",
",",
"device",
")",
":",
"config_sync_cmd",
"=",
"'config-sync to-group %s'",
"%",
"self",
".",
"name",
"device",
".",
"tm",
".",
"cm",
".",
"exec_cmd",
"(",
"'run'",
",",
"utilCmdArgs",
"=",
"config_sync_cmd",
")"
] | Sync the device to the cluster group
:param device: bigip object -- device to sync to group | [
"Sync",
"the",
"device",
"to",
"the",
"cluster",
"group"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L272-L279 |
251,194 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup._check_all_devices_in_sync | def _check_all_devices_in_sync(self):
'''Wait until all devices have failover status of 'In Sync'.
:raises: UnexpectedClusterState
'''
if len(self._get_devices_by_failover_status('In Sync')) != \
len(self.devices):
msg = "Expected all devices in group to hav... | python | def _check_all_devices_in_sync(self):
'''Wait until all devices have failover status of 'In Sync'.
:raises: UnexpectedClusterState
'''
if len(self._get_devices_by_failover_status('In Sync')) != \
len(self.devices):
msg = "Expected all devices in group to hav... | [
"def",
"_check_all_devices_in_sync",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"_get_devices_by_failover_status",
"(",
"'In Sync'",
")",
")",
"!=",
"len",
"(",
"self",
".",
"devices",
")",
":",
"msg",
"=",
"\"Expected all devices in group to have 'In S... | Wait until all devices have failover status of 'In Sync'.
:raises: UnexpectedClusterState | [
"Wait",
"until",
"all",
"devices",
"have",
"failover",
"status",
"of",
"In",
"Sync",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L287-L296 |
251,195 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup._get_devices_by_failover_status | def _get_devices_by_failover_status(self, status):
'''Get a list of bigips by failover status.
:param status: str -- status to filter the returned list of devices
:returns: list -- list of devices that have the given status
'''
devices_with_status = []
for device in sel... | python | def _get_devices_by_failover_status(self, status):
'''Get a list of bigips by failover status.
:param status: str -- status to filter the returned list of devices
:returns: list -- list of devices that have the given status
'''
devices_with_status = []
for device in sel... | [
"def",
"_get_devices_by_failover_status",
"(",
"self",
",",
"status",
")",
":",
"devices_with_status",
"=",
"[",
"]",
"for",
"device",
"in",
"self",
".",
"devices",
":",
"if",
"(",
"self",
".",
"_check_device_failover_status",
"(",
"device",
",",
"status",
")"... | Get a list of bigips by failover status.
:param status: str -- status to filter the returned list of devices
:returns: list -- list of devices that have the given status | [
"Get",
"a",
"list",
"of",
"bigips",
"by",
"failover",
"status",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L298-L309 |
251,196 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup._check_device_failover_status | def _check_device_failover_status(self, device, status):
'''Determine if a device has a specific failover status.
:param status: str -- status to check against
:returns: bool -- True is it has status, False otherwise
'''
sync_status = device.tm.cm.sync_status
sync_statu... | python | def _check_device_failover_status(self, device, status):
'''Determine if a device has a specific failover status.
:param status: str -- status to check against
:returns: bool -- True is it has status, False otherwise
'''
sync_status = device.tm.cm.sync_status
sync_statu... | [
"def",
"_check_device_failover_status",
"(",
"self",
",",
"device",
",",
"status",
")",
":",
"sync_status",
"=",
"device",
".",
"tm",
".",
"cm",
".",
"sync_status",
"sync_status",
".",
"refresh",
"(",
")",
"current_status",
"=",
"(",
"sync_status",
".",
"ent... | Determine if a device has a specific failover status.
:param status: str -- status to check against
:returns: bool -- True is it has status, False otherwise | [
"Determine",
"if",
"a",
"device",
"has",
"a",
"specific",
"failover",
"status",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L311-L325 |
251,197 | F5Networks/f5-common-python | f5/multi_device/device_group.py | DeviceGroup._get_devices_by_activation_state | def _get_devices_by_activation_state(self, state):
'''Get a list of bigips by activation statue.
:param state: str -- state to filter the returned list of devices
:returns: list -- list of devices that are in the given state
'''
devices_with_state = []
for device in sel... | python | def _get_devices_by_activation_state(self, state):
'''Get a list of bigips by activation statue.
:param state: str -- state to filter the returned list of devices
:returns: list -- list of devices that are in the given state
'''
devices_with_state = []
for device in sel... | [
"def",
"_get_devices_by_activation_state",
"(",
"self",
",",
"state",
")",
":",
"devices_with_state",
"=",
"[",
"]",
"for",
"device",
"in",
"self",
".",
"devices",
":",
"act",
"=",
"device",
".",
"tm",
".",
"cm",
".",
"devices",
".",
"device",
".",
"load... | Get a list of bigips by activation statue.
:param state: str -- state to filter the returned list of devices
:returns: list -- list of devices that are in the given state | [
"Get",
"a",
"list",
"of",
"bigips",
"by",
"activation",
"statue",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/multi_device/device_group.py#L327-L342 |
251,198 | F5Networks/f5-common-python | f5/bigip/tm/asm/policies/__init__.py | Policy._set_attr_reg | def _set_attr_reg(self):
"""Helper method.
Appends correct attribute registry, depending on TMOS version
"""
tmos_v = self._meta_data['bigip']._meta_data['tmos_version']
attributes = self._meta_data['attribute_registry']
v12kind = 'tm:asm:policies:blocking-settings:bloc... | python | def _set_attr_reg(self):
tmos_v = self._meta_data['bigip']._meta_data['tmos_version']
attributes = self._meta_data['attribute_registry']
v12kind = 'tm:asm:policies:blocking-settings:blocking-settingcollectionstate'
v11kind = 'tm:asm:policies:blocking-settings'
builderv11 = 'tm:as... | [
"def",
"_set_attr_reg",
"(",
"self",
")",
":",
"tmos_v",
"=",
"self",
".",
"_meta_data",
"[",
"'bigip'",
"]",
".",
"_meta_data",
"[",
"'tmos_version'",
"]",
"attributes",
"=",
"self",
".",
"_meta_data",
"[",
"'attribute_registry'",
"]",
"v12kind",
"=",
"'tm:... | Helper method.
Appends correct attribute registry, depending on TMOS version | [
"Helper",
"method",
"."
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/asm/policies/__init__.py#L132-L149 |
251,199 | F5Networks/f5-common-python | f5/bigip/tm/asm/policies/__init__.py | Policy.create | def create(self, **kwargs):
"""Custom creation logic to handle edge cases
This shouldn't be needed, but ASM has a tendency to raise various errors that
are painful to handle from a customer point-of-view
The error itself are described in their exception handler
To address thes... | python | def create(self, **kwargs):
for x in range(0, 30):
try:
return self._create(**kwargs)
except iControlUnexpectedHTTPError as ex:
if self._check_exception(ex):
continue
else:
raise | [
"def",
"create",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"x",
"in",
"range",
"(",
"0",
",",
"30",
")",
":",
"try",
":",
"return",
"self",
".",
"_create",
"(",
"*",
"*",
"kwargs",
")",
"except",
"iControlUnexpectedHTTPError",
"as",
"e... | Custom creation logic to handle edge cases
This shouldn't be needed, but ASM has a tendency to raise various errors that
are painful to handle from a customer point-of-view
The error itself are described in their exception handler
To address these failure, we try a number of exception... | [
"Custom",
"creation",
"logic",
"to",
"handle",
"edge",
"cases"
] | 7e67d5acd757a60e3d5f8c88c534bd72208f5494 | https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/asm/policies/__init__.py#L151-L172 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.