_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q232600 | PartnerCredentials.refresh | train | def refresh(self):
"Refresh an expired token"
# Construct the credentials for the verification request
oauth = OAuth1(
self.consumer_key,
client_secret=self.consumer_secret,
resource_owner_key=self.oauth_token,
resource_owner_secret=self.oauth_tok... | python | {
"resource": ""
} |
q232601 | FilesManager._get_files | train | def _get_files(self, folderId):
"""Retrieve the list of files contained in a folder"""
uri = '/'.join([self.base_url, self.name, folderId, 'Files'])
return uri, {}, 'get', None, None, False, None | python | {
"resource": ""
} |
q232602 | MotionCluster.handle_cluster_request | train | def handle_cluster_request(self, tsn, command_id, args):
"""Handle the cluster command."""
if command_id == 0:
if self._timer_handle:
self._timer_handle.cancel()
loop = asyncio.get_event_loop()
self._timer_handle = loop.call_later(30, self._turn_off) | python | {
"resource": ""
} |
q232603 | BasicCluster._parse_attributes | train | def _parse_attributes(self, value):
"""Parse non standard atrributes."""
from zigpy.zcl import foundation as f
attributes = {}
attribute_names = {
1: BATTERY_VOLTAGE_MV,
3: TEMPERATURE,
4: XIAOMI_ATTR_4,
5: XIAOMI_ATTR_5,
6: XIA... | python | {
"resource": ""
} |
q232604 | BasicCluster._calculate_remaining_battery_percentage | train | def _calculate_remaining_battery_percentage(self, voltage):
"""Calculate percentage."""
min_voltage = 2500
max_voltage = 3000
percent = (voltage - min_voltage) / (max_voltage - min_voltage) * 200
return min(200, percent) | python | {
"resource": ""
} |
q232605 | PowerConfigurationCluster.battery_reported | train | def battery_reported(self, voltage, rawVoltage):
"""Battery reported."""
self._update_attribute(BATTERY_PERCENTAGE_REMAINING, voltage)
self._update_attribute(self.BATTERY_VOLTAGE_ATTR,
int(rawVoltage / 100)) | python | {
"resource": ""
} |
q232606 | FastPollingPowerConfigurationCluster.configure_reporting | train | async def configure_reporting(self, attribute, min_interval,
max_interval, reportable_change):
"""Configure reporting."""
result = await super().configure_reporting(
PowerConfigurationCluster.BATTERY_VOLTAGE_ATTR,
self.FREQUENCY,
self... | python | {
"resource": ""
} |
q232607 | Folder.update | train | def update(self, **kwargs):
'''Update the object, removing device group if inherited
If inheritedDevicegroup is the string "true" we need to remove
deviceGroup from the args before we update or we get the
following error:
The floating traffic-group: /Common/traffic-group-1 can ... | python | {
"resource": ""
} |
q232608 | Device_Group.sync_to | train | def sync_to(self):
"""Wrapper method that synchronizes configuration to DG.
Executes the containing object's cm :meth:`~f5.bigip.cm.Cm.exec_cmd`
method to sync the configuration TO the device-group.
:note:: Both sync_to, and sync_from methods are convenience
methods wh... | python | {
"resource": ""
} |
q232609 | Service._create | train | def _create(self, **kwargs):
'''Create service on device and create accompanying Python object.
:params kwargs: keyword arguments passed in from create call
:raises: HTTPError
:returns: Python Service object
'''
try:
return super(Service, self)._create(**kwa... | python | {
"resource": ""
} |
q232610 | Service._build_service_uri | train | def _build_service_uri(self, base_uri, partition, name):
'''Build the proper uri for a service resource.
This follows the scheme:
<base_uri>/~<partition>~<<name>.app>~<name>
:param base_uri: str -- base uri for container
:param partition: str -- partition for this service
... | python | {
"resource": ""
} |
q232611 | Members.delete | train | def delete(self, **kwargs):
"""Deletes a member from a 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 inte... | python | {
"resource": ""
} |
q232612 | TrustDomain._set_attributes | train | def _set_attributes(self, **kwargs):
'''Set attributes for instance in one place
:param kwargs: dict -- dictionary of keyword arguments
'''
self.devices = kwargs['devices'][:]
self.partition = kwargs['partition']
self.device_group_name = 'device_trust_group'
sel... | python | {
"resource": ""
} |
q232613 | TrustDomain.validate | train | def validate(self):
'''Validate that devices are each trusted by one another
:param kwargs: dict -- keyword args for devices and partition
:raises: DeviceNotTrusted
'''
self._populate_domain()
missing = []
for domain_device in self.domain:
for truste... | python | {
"resource": ""
} |
q232614 | TrustDomain._populate_domain | train | def _populate_domain(self):
'''Populate TrustDomain's domain attribute.
This entails an inspection of each device's certificate-authority
devices in its trust domain and recording them. After which, we
get a dictionary of who trusts who in the domain.
'''
self.domain = ... | python | {
"resource": ""
} |
q232615 | TrustDomain.create | train | def create(self, **kwargs):
'''Add trusted peers to the root bigip device.
When adding a trusted device to a device, the trust is reflexive. That
is, the truster trusts the trustee and the trustee trusts the truster.
So we only need to add the trusted devices to one device.
:pa... | python | {
"resource": ""
} |
q232616 | TrustDomain.teardown | train | def teardown(self):
'''Teardown trust domain by removing trusted devices.'''
for device in self.devices:
self._remove_trustee(device)
self._populate_domain()
self.domain = {} | python | {
"resource": ""
} |
q232617 | TrustDomain._add_trustee | train | def _add_trustee(self, device):
'''Add a single trusted device to the trust domain.
:param device: ManagementRoot object -- device to add to trust domain
'''
device_name = get_device_info(device).name
if device_name in self.domain:
msg = 'Device: %r is already in th... | python | {
"resource": ""
} |
q232618 | TrustDomain._remove_trustee | train | def _remove_trustee(self, device):
'''Remove a trustee from the trust domain.
:param device: MangementRoot object -- device to remove
'''
trustee_name = get_device_info(device).name
name_object_map = get_device_names_to_objects(self.devices)
delete_func = self._get_dele... | python | {
"resource": ""
} |
q232619 | TrustDomain._modify_trust | train | def _modify_trust(self, truster, mod_peer_func, trustee):
'''Modify a trusted peer device by deploying an iapp.
:param truster: ManagementRoot object -- device on which to perform
commands
:param mod_peer_func: function -- function to call to modify peer
:param ... | python | {
"resource": ""
} |
q232620 | TrustDomain._delete_iapp | train | def _delete_iapp(self, iapp_name, deploying_device):
'''Delete an iapp service and template on the root device.
:param iapp_name: str -- name of iapp
:param deploying_device: ManagementRoot object -- device where the
iapp will be deleted
'''
iap... | python | {
"resource": ""
} |
q232621 | TrustDomain._deploy_iapp | train | def _deploy_iapp(self, iapp_name, actions, deploying_device):
'''Deploy iapp to add trusted device
:param iapp_name: str -- name of iapp
:param actions: dict -- actions definition of iapp sections
:param deploying_device: ManagementRoot object -- device where the
... | python | {
"resource": ""
} |
q232622 | TrustDomain._get_add_trustee_cmd | train | def _get_add_trustee_cmd(self, trustee):
'''Get tmsh command to add a trusted device.
:param trustee: ManagementRoot object -- device to add as trusted
:returns: str -- tmsh command to add trustee
'''
trustee_info = pollster(get_device_info)(trustee)
username = trustee.... | python | {
"resource": ""
} |
q232623 | Virtual_Disk.load | train | def load(self, **kwargs):
"""Loads a given resource
Loads a given resource provided a 'name' and an optional 'slot'
parameter. The 'slot' parameter is not a required load parameter
because it is provided as an optional way of constructing the
correct 'name' of the vCMP resource.... | python | {
"resource": ""
} |
q232624 | IappParser._get_section_end_index | train | 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 | {
"resource": ""
} |
q232625 | IappParser._get_section_start_index | train | 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 | {
"resource": ""
} |
q232626 | IappParser._get_template_name | train | 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 | {
"resource": ""
} |
q232627 | IappParser._get_template_attr | train | 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 | {
"resource": ""
} |
q232628 | IappParser._add_sections | train | 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 | {
"resource": ""
} |
q232629 | IappParser._add_cli_scripts | train | 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 | {
"resource": ""
} |
q232630 | IappParser._add_attrs | train | 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 | {
"resource": ""
} |
q232631 | IappParser._parse_tcl_list | train | 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 | {
"resource": ""
} |
q232632 | IappParser._transform_key_value | train | 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 | {
"resource": ""
} |
q232633 | IappParser.parse_template | train | 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 | {
"resource": ""
} |
q232634 | Root._create | train | 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 | {
"resource": ""
} |
q232635 | peer | train | def peer(opt_peer, opt_username, opt_password, scope="module"):
'''peer bigip fixture'''
p = BigIP(opt_peer, opt_username, opt_password)
return p | python | {
"resource": ""
} |
q232636 | Topology.exists | train | 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 | {
"resource": ""
} |
q232637 | Stats._key_dot_replace | train | 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 | {
"resource": ""
} |
q232638 | Stats._get_nest_stats | train | 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 | {
"resource": ""
} |
q232639 | Stats.refresh | train | def refresh(self, **kwargs):
"""Refreshes stats attached to an object"""
self.resource.refresh(**kwargs)
self.rdict = self.resource.entries
self._update_stats() | python | {
"resource": ""
} |
q232640 | Rule.load | train | 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 | {
"resource": ""
} |
q232641 | poll_for_exceptionless_callable | train | 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 | {
"resource": ""
} |
q232642 | Network.exists | train | 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 | {
"resource": ""
} |
q232643 | CommandExecutionMixin._is_allowed_command | train | 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 | {
"resource": ""
} |
q232644 | CommandExecutionMixin._check_command_result | train | 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 | {
"resource": ""
} |
q232645 | CommandExecutionMixin.exec_cmd | train | 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 | {
"resource": ""
} |
q232646 | CommandExecutionMixin._exec_cmd | train | 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 | {
"resource": ""
} |
q232647 | DeviceMixin.get_device_info | train | 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 | {
"resource": ""
} |
q232648 | CheckExistenceMixin._check_existence_by_collection | train | 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 | {
"resource": ""
} |
q232649 | CheckExistenceMixin._return_object | train | 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 | {
"resource": ""
} |
q232650 | Config.exec_cmd | train | 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 | {
"resource": ""
} |
q232651 | User.update | train | 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 | {
"resource": ""
} |
q232652 | TemplateEngine._process_config_with_kind | train | 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 | {
"resource": ""
} |
q232653 | _missing_required_parameters | train | 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 | {
"resource": ""
} |
q232654 | PathElement._format_collection_name | train | 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 | {
"resource": ""
} |
q232655 | PathElement._check_command_parameters | train | 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 | {
"resource": ""
} |
q232656 | PathElement._handle_requests_params | train | 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 | {
"resource": ""
} |
q232657 | PathElement._check_exclusive_parameters | train | 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 | {
"resource": ""
} |
q232658 | ResourceBase._modify | train | 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 | {
"resource": ""
} |
q232659 | ResourceBase._check_for_boolean_pair_reduction | train | 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 | {
"resource": ""
} |
q232660 | ResourceBase._prepare_put_or_patch | train | 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 | {
"resource": ""
} |
q232661 | ResourceBase._prepare_request_json | train | 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 | {
"resource": ""
} |
q232662 | ResourceBase._iter_list_for_dicts | train | 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 | {
"resource": ""
} |
q232663 | ResourceBase._check_for_python_keywords | train | 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 | {
"resource": ""
} |
q232664 | ResourceBase._check_keys | train | 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 | {
"resource": ""
} |
q232665 | ResourceBase._local_update | train | 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 | {
"resource": ""
} |
q232666 | ResourceBase._update | train | 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 | {
"resource": ""
} |
q232667 | ResourceBase._refresh | train | 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 | {
"resource": ""
} |
q232668 | ResourceBase._produce_instance | train | 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 | {
"resource": ""
} |
q232669 | ResourceBase._reduce_boolean_pair | train | 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 | {
"resource": ""
} |
q232670 | Collection.get_collection | train | 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 | {
"resource": ""
} |
q232671 | Collection._delete_collection | train | 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 | {
"resource": ""
} |
q232672 | Resource._activate_URI | train | 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 | {
"resource": ""
} |
q232673 | Resource._check_create_parameters | train | 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 | {
"resource": ""
} |
q232674 | Resource._minimum_one_is_missing | train | 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 | {
"resource": ""
} |
q232675 | Resource._check_load_parameters | train | 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 | {
"resource": ""
} |
q232676 | Resource._load | train | 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 | {
"resource": ""
} |
q232677 | Resource._delete | train | 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 | {
"resource": ""
} |
q232678 | AsmResource._delete | train | 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 | {
"resource": ""
} |
q232679 | AsmResource.exists | train | 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 | {
"resource": ""
} |
q232680 | AsmTaskResource._fetch | train | 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 | {
"resource": ""
} |
q232681 | ClusterManager._check_device_number | train | 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 | {
"resource": ""
} |
q232682 | ClusterManager.manage_extant | train | 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 | {
"resource": ""
} |
q232683 | Policy._filter_version_specific_options | train | 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 | {
"resource": ""
} |
q232684 | Policy._create | train | 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 | {
"resource": ""
} |
q232685 | Policy._modify | train | 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 | {
"resource": ""
} |
q232686 | Policy._update | train | 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 | {
"resource": ""
} |
q232687 | Policy.publish | train | 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 | {
"resource": ""
} |
q232688 | Policy.draft | train | 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 | {
"resource": ""
} |
q232689 | Member.delete | train | 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 | {
"resource": ""
} |
q232690 | Failover.exec_cmd | train | 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 | {
"resource": ""
} |
q232691 | Failover.toggle_standby | train | 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 | {
"resource": ""
} |
q232692 | Ocsp_Stapling_Params.update | train | 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 | {
"resource": ""
} |
q232693 | Interfaces._check_tagmode_and_tmos_version | train | 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 | {
"resource": ""
} |
q232694 | Policies.load | train | 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 | {
"resource": ""
} |
q232695 | Policies._load_11_5_4 | train | 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 | {
"resource": ""
} |
q232696 | Policies.create | train | 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 | {
"resource": ""
} |
q232697 | Policies_s.get_collection | train | 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 | {
"resource": ""
} |
q232698 | get_device_names_to_objects | train | 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 | {
"resource": ""
} |
q232699 | UrlParametersResource.create | train | 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 | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.