Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def get_environmental_configuration(self, id_or_uri):
uri = self._client.build_uri(id_or_uri) + "/environmentalConfiguration"
return self._client.get(uri) | [
"\n Returns a description of the environmental configuration (supported feature set, calibrated minimum & maximum\n power, location & dimensions, ...) of the resource.\n\n Args:\n id_or_uri:\n Can be either the Unmanaged Device id or the uri\n\n Returns:\n ... |
Please provide a description of the function:def get_script(self):
uri = "{}/script".format(self.data["uri"])
return self._helper.do_get(uri) | [
"\n Gets the configuration script of the logical enclosure by ID or URI.\n\n Return:\n str: Configuration script.\n "
] |
Please provide a description of the function:def update_script(self, information, timeout=-1):
uri = "{}/script".format(self.data["uri"])
return self._helper.update(information, uri=uri, timeout=timeout) | [
"\n Updates the configuration script of the logical enclosure and on all enclosures in the logical enclosure with\n the specified ID.\n\n Args:\n information: Updated script.\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the... |
Please provide a description of the function:def generate_support_dump(self, information, timeout=-1):
uri = "{}/support-dumps".format(self.data["uri"])
return self._helper.create(information, uri=uri, timeout=timeout) | [
"\n Generates a support dump for the logical enclosure with the specified ID. A logical enclosure support dump\n includes content for logical interconnects associated with that logical enclosure. By default, it also contains\n appliance support dump content.\n\n Args:\n inform... |
Please provide a description of the function:def update_from_group(self, data=None, timeout=-1):
uri = "{}/updateFromGroup".format(self.data["uri"])
return self._helper.update(data, uri, timeout=timeout) | [
"\n Use this action to make a logical enclosure consistent with the enclosure group when the logical enclosure is\n in the Inconsistent state.\n\n Args:\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in On... |
Please provide a description of the function:def create_bulk(self, resource, timeout=-1):
uri = self.URI + '/bulk'
default_values = self._get_default_values(self.BULK_DEFAULT_VALUES)
updated_data = self._helper.update_resource_fields(resource, default_values)
self._helper.creat... | [
"\n Creates bulk Ethernet networks.\n\n Args:\n resource (dict): Specifications to create in bulk.\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in OneView; it just stops waiting for ... |
Please provide a description of the function:def get_range(self, name_prefix, vlan_id_range):
filter = '"\'name\' matches \'{}\_%\'"'.format(name_prefix)
ethernet_networks = self.get_all(filter=filter, sort='vlanId:ascending')
vlan_ids = self.dissociate_values_or_ranges(vlan_id_range)
... | [
"\n Gets a list of Ethernet Networks that match the 'given name_prefix' and the 'vlan_id_range'.\n\n Examples:\n >>> enet.get_range('Enet_name', '1-2,5')\n # The result contains the ethernet network with names:\n ['Enet_name_1', 'Enet_name_2', 'Enet_name_5']\n\... |
Please provide a description of the function:def dissociate_values_or_ranges(self, vlan_id_range):
values_or_ranges = vlan_id_range.split(',')
vlan_ids = []
# The expected result is different if the vlan_id_range contains only one value
if len(values_or_ranges) == 1 and '-' not ... | [
"\n Build a list of vlan ids given a combination of ranges and/or values\n\n Examples:\n >>> enet.dissociate_values_or_ranges('1-2,5')\n [1, 2, 5]\n\n >>> enet.dissociate_values_or_ranges('5')\n [1, 2, 3, 4, 5]\n\n >>> enet.dissociate_valu... |
Please provide a description of the function:def get_associated_profiles(self):
uri = "{}/associatedProfiles".format(self.data['uri'])
return self._helper.do_get(uri) | [
"\n Gets the URIs of profiles which are using an Ethernet network.\n\n Args:\n id_or_uri: Can be either the logical interconnect group id or the logical interconnect group uri\n\n Returns:\n list: URIs of the associated profiles.\n\n "
] |
Please provide a description of the function:def get_associated_uplink_groups(self):
uri = "{}/associatedUplinkGroups".format(self.data['uri'])
return self._helper.do_get(uri) | [
"\n Gets the uplink sets which are using an Ethernet network.\n\n Returns:\n list: URIs of the associated uplink sets.\n\n "
] |
Please provide a description of the function:def merge_resources(resource1, resource2):
merged = resource1.copy()
merged.update(resource2)
return merged | [
"\n Updates a copy of resource1 with resource2 values and returns the merged dictionary.\n\n Args:\n resource1: original resource\n resource2: resource to update resource1\n\n Returns:\n dict: merged resource\n "
] |
Please provide a description of the function:def merge_default_values(resource_list, default_values):
def merge_item(resource):
return merge_resources(default_values, resource)
return lmap(merge_item, resource_list) | [
"\n Generate a new list where each item of original resource_list will be merged with the default_values.\n\n Args:\n resource_list: list with items to be merged\n default_values: properties to be merged with each item list. If the item already contains some property\n the original va... |
Please provide a description of the function:def transform_list_to_dict(list):
ret = {}
for value in list:
if isinstance(value, dict):
ret.update(value)
else:
ret[str(value)] = True
return ret | [
"\n Transforms a list into a dictionary, putting values as keys\n Args:\n id:\n Returns:\n dict: dictionary built\n "
] |
Please provide a description of the function:def ensure_resource_data(self, update_data=False):
# Check for unique identifier in the resource data
if not any(key in self.data for key in self.UNIQUE_IDENTIFIERS):
raise exceptions.HPOneViewMissingUniqueIdentifiers(MISSING_UNIQUE_IDENT... | [
"Retrieves data from OneView and updates resource object.\n\n Args:\n update_data: Flag to update resource data when it is required.\n "
] |
Please provide a description of the function:def create(self, data=None, uri=None, timeout=-1, custom_headers=None, force=False):
if not data:
data = {}
default_values = self._get_default_values()
data = self._helper.update_resource_fields(data, default_values)
log... | [
"Makes a POST request to create a resource when a request body is required.\n\n Args:\n data: Additional fields can be passed to create the resource.\n uri: Resouce uri\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operatio... |
Please provide a description of the function:def delete(self, timeout=-1, custom_headers=None, force=False):
uri = self.data['uri']
logger.debug("Delete resource (uri = %s)" % (str(uri)))
return self._helper.delete(uri, timeout=timeout,
custom_header... | [
"Deletes current resource.\n\n Args:\n timeout: Timeout in seconds.\n custom_headers: Allows to set custom http headers.\n force: Flag to force the operation.\n "
] |
Please provide a description of the function:def update(self, data=None, timeout=-1, custom_headers=None, force=False):
uri = self.data['uri']
resource = deepcopy(self.data)
resource.update(data)
logger.debug('Update async (uri = %s, resource = %s)' %
(uri... | [
"Makes a PUT request to update a resource when a request body is required.\n\n Args:\n data: Data to update the resource.\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in OneView; it just stops waiting for i... |
Please provide a description of the function:def get_by(self, field, value):
if not field:
logger.exception(RESOURCE_CLIENT_INVALID_FIELD)
raise ValueError(RESOURCE_CLIENT_INVALID_FIELD)
filter = "\"{0}='{1}'\"".format(field, value)
results = self.get_all(filter... | [
"Get the resource by passing a field and its value.\n\n Note:\n This function uses get_all passing a filter.The search is case-insensitive.\n\n Args:\n field: Field name to filter.\n value: Value to filter.\n\n Returns:\n dict\n "
] |
Please provide a description of the function:def get_by_name(self, name):
result = self.get_by("name", name)
if result:
data = result[0]
new_resource = self.new(self._connection, data)
else:
new_resource = None
return new_resource | [
"Retrieves a resource by its name.\n\n Args:\n name: Resource name.\n\n Returns:\n Resource object or None if resource does not exist.\n "
] |
Please provide a description of the function:def get_by_uri(self, uri):
self._helper.validate_resource_uri(uri)
data = self._helper.do_get(uri)
if data:
new_resource = self.new(self._connection, data)
else:
new_resource = None
return new_resourc... | [
"Retrieves a resource by its URI\n\n Args:\n uri: URI of the resource\n\n Returns:\n Resource object\n "
] |
Please provide a description of the function:def _get_default_values(self, default_values=None):
if not default_values:
default_values = self.DEFAULT_VALUES
if default_values:
api_version = str(self._connection._apiVersion)
values = default_values.get(api_v... | [
"Gets the default values set for a resource"
] |
Please provide a description of the function:def _merge_default_values(self):
values = self._get_default_values()
for key, value in values.items():
if not self.data.get(key):
self.data[key] = value | [
"Merge default values with resource data."
] |
Please provide a description of the function:def get_all(self, start=0, count=-1, filter='', query='', sort='', view='', fields='', uri=None, scope_uris=''):
if not uri:
uri = self._base_uri
uri = self.build_query_uri(uri=uri,
start=start,
... | [
"Gets all items according with the given arguments.\n\n Args:\n start: The first item to return, using 0-based indexing.\n If not specified, the default is 0 - start with the first available item.\n count: The number of resources to return. A count of -1 requests all item... |
Please provide a description of the function:def delete_all(self, filter, force=False, timeout=-1):
uri = "{}?filter={}&force={}".format(self._base_uri, quote(filter), force)
logger.debug("Delete all resources (uri = %s)" % uri)
return self.delete(uri) | [
"\n Deletes all resources from the appliance that match the provided filter.\n\n Args:\n filter:\n A general filter/query string to narrow the list of items deleted.\n force:\n If set to true, the operation completes despite any problems with network... |
Please provide a description of the function:def create(self, data=None, uri=None, timeout=-1, custom_headers=None, force=False):
if not uri:
uri = self._base_uri
if force:
uri += '?force={}'.format(force)
logger.debug('Create (uri = %s, resource = %s)' % (uri,... | [
"Makes a POST request to create a resource when a request body is required.\n\n Args:\n data: Additional fields can be passed to create the resource.\n uri: Resouce uri\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operatio... |
Please provide a description of the function:def delete(self, uri, force=False, timeout=-1, custom_headers=None):
if force:
uri += '?force=True'
logger.debug("Delete resource (uri = %s)" % (str(uri)))
task, body = self._connection.delete(uri, custom_headers=custom_headers)... | [
"Deletes current resource.\n\n Args:\n force: Flag to delete the resource forcefully, default is False.\n timeout: Timeout in seconds.\n custom_headers: Allows to set custom http headers.\n "
] |
Please provide a description of the function:def update(self, resource, uri=None, force=False, timeout=-1, custom_headers=None):
logger.debug('Update async (uri = %s, resource = %s)' %
(uri, str(resource)))
if not uri:
uri = resource['uri']
if force:
... | [
"Makes a PUT request to update a resource when a request body is required.\n\n Args:\n resource: Data to update the resource.\n uri: Resource uri\n force: If set to true, the operation completes despite any problems\n with network connectivity or errors on the ... |
Please provide a description of the function:def create_report(self, uri, timeout=-1):
logger.debug('Creating Report (uri = %s)'.format(uri))
task, _ = self._connection.post(uri, {})
if not task:
raise exceptions.HPOneViewException(RESOURCE_CLIENT_TASK_EXPECTED)
ta... | [
"\n Creates a report and returns the output.\n\n Args:\n uri: URI\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in OneView; it just stops waiting for its completion.\n\n Return... |
Please provide a description of the function:def get_collection(self, uri=None, filter='', path=''):
if not uri:
uri = self._base_uri
if filter:
filter = self.make_query_filter(filter)
filter = "?" + filter[1:]
uri = "{uri}{path}{filter}".format(uri... | [
"Retrieves a collection of resources.\n\n Use this function when the 'start' and 'count' parameters are not allowed in the GET call.\n Otherwise, use get_all instead.\n\n Optional filtering criteria may be specified.\n\n Args:\n filter (list or str): General filter/query strin... |
Please provide a description of the function:def build_query_uri(self, uri=None, start=0, count=-1, filter='', query='', sort='', view='', fields='', scope_uris=''):
if filter:
filter = self.make_query_filter(filter)
if query:
query = "&query=" + quote(query)
i... | [
"Builds the URI from given parameters.\n\n More than one request can be send to get the items, regardless the query parameter 'count', because the actual\n number of items in the response might differ from the requested count. Some types of resource have a limited\n number of items returned on ... |
Please provide a description of the function:def build_uri(self, id_or_uri):
if not id_or_uri:
logger.exception(RESOURCE_CLIENT_INVALID_ID)
raise ValueError(RESOURCE_CLIENT_INVALID_ID)
if "/" in id_or_uri:
self.validate_resource_uri(id_or_uri)
re... | [
"Helps to build the URI from resource id and validate the URI.\n\n Args:\n id_or_uri: ID/URI of the resource.\n\n Returns:\n Returns a valid resource URI\n "
] |
Please provide a description of the function:def build_subresource_uri(self, resource_id_or_uri=None, subresource_id_or_uri=None, subresource_path=''):
if subresource_id_or_uri and "/" in subresource_id_or_uri:
return subresource_id_or_uri
else:
if not resource_id_or_uri... | [
"Helps to build a URI with resource path and its sub resource path.\n\n Args:\n resoure_id_or_uri: ID/URI of the main resource.\n subresource_id__or_uri: ID/URI of the sub resource.\n subresource_path: Sub resource path to be added with the URI.\n\n Returns:\n ... |
Please provide a description of the function:def validate_resource_uri(self, path):
if self._base_uri not in path:
logger.exception('Get by uri : unrecognized uri: (%s)' % path)
raise exceptions.HPOneViewUnknownType(UNRECOGNIZED_URI) | [
"Helper method to validate URI of the resource."
] |
Please provide a description of the function:def update_resource_fields(self, data, data_to_add):
for key, value in data_to_add.items():
if not data.get(key):
data[key] = value
return data | [
"Update resource data with new fields.\n\n Args:\n data: resource data\n data_to_update: dict of data to update resource data\n\n Returnes:\n Returnes dict\n "
] |
Please provide a description of the function:def do_requests_to_getall(self, uri, requested_count):
items = []
while uri:
logger.debug('Making HTTP request to get all resources. Uri: {0}'.format(uri))
response = self._connection.get(uri)
members = self.get_m... | [
"Helps to make http request for get_all method.\n\n Note:\n This method will be checking for the pagination URI in the response\n and make request to pagination URI to get all the resources.\n "
] |
Please provide a description of the function:def do_get(self, uri):
self.validate_resource_uri(uri)
return self._connection.get(uri) | [
"Helps to make get requests\n\n Args:\n uri: URI of the resource\n\n Returns:\n Returns: Returns the resource data\n "
] |
Please provide a description of the function:def do_post(self, uri, resource, timeout, custom_headers):
self.validate_resource_uri(uri)
task, entity = self._connection.post(uri, resource, custom_headers=custom_headers)
if not task:
return entity
return self._task_... | [
"Helps to make post requests.\n\n Args:\n uri: URI of the resource.\n resource: Resource data to post.\n timeout: Time out for the request in seconds.\n cutom_headers: Allows to add custom http headers.\n\n Returns:\n Retunrs Task object.\n ... |
Please provide a description of the function:def do_put(self, uri, resource, timeout, custom_headers):
self.validate_resource_uri(uri)
task, body = self._connection.put(uri, resource, custom_headers=custom_headers)
if not task:
return body
return self._task_monito... | [
"Helps to make put requests.\n\n Args:\n uri: URI of the resource\n timeout: Time out for the request in seconds.\n custom_headers: Allows to set custom http headers.\n\n Retuns:\n Returns Task object\n "
] |
Please provide a description of the function:def add_new_fields(data, data_to_add):
for key, value in data_to_add.items():
if not data.get(key):
data[key] = value
return data | [
"Update resource data with new fields.\n\n Args:\n data: resource data\n data_to_update: dict of data to update resource data\n\n Returnes:\n Returnes dict\n "
] |
Please provide a description of the function:def patch(self, operation, path, value, custom_headers=None, timeout=-1):
patch_request_body = [{'op': operation, 'path': path, 'value': value}]
resource_uri = self.data['uri']
self.data = self.patch_request(resource_uri,
... | [
"Uses the PATCH to update a resource.\n\n Only one operation can be performed in each PATCH call.\n\n Args\n operation: Patch operation\n path: Path\n value: Value\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort... |
Please provide a description of the function:def patch_request(self, uri, body, custom_headers=None, timeout=-1):
logger.debug('Patch resource (uri = %s, data = %s)' % (uri, body))
if not custom_headers:
custom_headers = {}
if self._connection._apiVersion >= 300 and 'Conte... | [
"Uses the PATCH to update a resource.\n\n Only one operation can be performed in each PATCH call.\n\n Args:\n body (list): Patch request body\n timeout (int): Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in One... |
Please provide a description of the function:def download(self, uri, file_path):
with open(file_path, 'wb') as file:
return self._connection.download_to_stream(file, uri) | [
"Downloads the contents of the requested URI to a stream.\n\n Args:\n uri: URI\n file_path: File path destination\n\n Returns:\n bool: Indicates if the file was successfully downloaded.\n "
] |
Please provide a description of the function:def get_utilization(self, fields=None, filter=None, refresh=False, view=None):
resource_uri = self.data['uri']
query = ''
if filter:
query += self._helper.make_query_filter(filter)
if fields:
query += "&field... | [
"Retrieves historical utilization data for the specified resource, metrics, and time span.\n\n Args:\n fields: Name of the supported metric(s) to be retrieved in the format METRIC[,METRIC]...\n If unspecified, all metrics supported are returned.\n\n filter (list or str): ... |
Please provide a description of the function:def create_with_zero_body(self, uri=None, timeout=-1, custom_headers=None):
if not uri:
uri = self.URI
logger.debug('Create with zero body (uri = %s)' % uri)
resource_data = self._helper.do_post(uri, {}, timeout, custom_headers)
... | [
"Makes a POST request to create a resource when no request body is required.\n\n Args:\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in OneView; it just stops waiting for its completion.\n custom_headers: Al... |
Please provide a description of the function:def update_with_zero_body(self, uri=None, timeout=-1, custom_headers=None):
if not uri:
uri = self.data['uri']
logger.debug('Update with zero length body (uri = %s)' % uri)
resource_data = self._helper.do_put(uri, None, timeout, ... | [
"Makes a PUT request to update a resource when no request body is required.\n\n Args:\n uri: Allows to use a different URI other than resource URI\n timeout: Timeout in seconds. Wait for task completion by default.\n The timeout does not abort the operation in OneView; it... |
Please provide a description of the function:def build_query_uri(self, start=0, count=-1, filter='', query='', sort='', view='', fields='', uri=None, scope_uris=''):
if filter:
filter = self.__make_query_filter(filter)
if query:
query = "&query=" + quote(query)
... | [
"\n Builds the URI given the parameters.\n\n More than one request can be send to get the items, regardless the query parameter 'count', because the actual\n number of items in the response might differ from the requested count. Some types of resource have a limited\n number of items ret... |
Please provide a description of the function:def get_all(self, start=0, count=-1, filter='', query='', sort='', view='', fields='', uri=None, scope_uris=''):
uri = self.build_query_uri(start=start, count=count, filter=filter,
query=query, sort=sort, view=view, fields... | [
"\n Gets all items according with the given arguments.\n\n Args:\n start:\n The first item to return, using 0-based indexing.\n If not specified, the default is 0 - start with the first available item.\n count:\n The number of resource... |
Please provide a description of the function:def delete_all(self, filter, force=False, timeout=-1):
uri = "{}?filter={}&force={}".format(self._uri, quote(filter), force)
logger.debug("Delete all resources (uri = %s)" % uri)
task, body = self._connection.delete(uri)
if not task... | [
"\n Deletes all resources from the appliance that match the provided filter.\n\n Args:\n filter:\n A general filter/query string to narrow the list of items deleted.\n force:\n If set to true, the operation completes despite any problems with network... |
Please provide a description of the function:def get(self, id_or_uri):
uri = self.build_uri(id_or_uri)
logger.debug('Get resource (uri = %s, ID = %s)' %
(uri, str(id_or_uri)))
return self._connection.get(uri) | [
"\n Args:\n id_or_uri: Can be either the resource ID or the resource URI.\n\n Returns:\n The requested resource.\n "
] |
Please provide a description of the function:def get_collection(self, id_or_uri, filter=''):
if filter:
filter = self.__make_query_filter(filter)
filter = "?" + filter[1:]
uri = "{uri}{filter}".format(uri=self.build_uri(id_or_uri), filter=filter)
logger.debug('G... | [
"\n Retrieves a collection of resources.\n\n Use this function when the 'start' and 'count' parameters are not allowed in the GET call.\n Otherwise, use get_all instead.\n\n Optional filtering criteria may be specified.\n\n Args:\n id_or_uri: Can be either the resource ... |
Please provide a description of the function:def update_with_zero_body(self, uri, timeout=-1, custom_headers=None):
logger.debug('Update with zero length body (uri = %s)' % uri)
return self.__do_put(uri, None, timeout, custom_headers) | [
"\n Makes a PUT request to update a resource when no request body is required.\n\n Args:\n uri:\n Can be either the resource ID or the resource URI.\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does not abort the ... |
Please provide a description of the function:def update(self, resource, uri=None, force=False, timeout=-1, custom_headers=None, default_values={}):
if not resource:
logger.exception(RESOURCE_CLIENT_RESOURCE_WAS_NOT_PROVIDED)
raise ValueError(RESOURCE_CLIENT_RESOURCE_WAS_NOT_PROV... | [
"\n Makes a PUT request to update a resource when a request body is required.\n\n Args:\n resource:\n OneView resource dictionary.\n uri:\n Can be either the resource ID or the resource URI.\n force:\n If set to true, the op... |
Please provide a description of the function:def create_with_zero_body(self, uri=None, timeout=-1, custom_headers=None):
if not uri:
uri = self._uri
logger.debug('Create with zero body (uri = %s)' % uri)
return self.__do_post(uri, {}, timeout, custom_headers) | [
"\n Makes a POST request to create a resource when no request body is required.\n\n Args:\n uri:\n Can be either the resource ID or the resource URI.\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does not abort the... |
Please provide a description of the function:def create(self, resource, uri=None, timeout=-1, custom_headers=None, default_values={}):
if not resource:
logger.exception(RESOURCE_CLIENT_RESOURCE_WAS_NOT_PROVIDED)
raise ValueError(RESOURCE_CLIENT_RESOURCE_WAS_NOT_PROVIDED)
... | [
"\n Makes a POST request to create a resource when a request body is required.\n\n Args:\n resource:\n OneView resource dictionary.\n uri:\n Can be either the resource ID or the resource URI.\n timeout:\n Timeout in seconds.... |
Please provide a description of the function:def upload(self, file_path, uri=None, timeout=-1):
if not uri:
uri = self._uri
upload_file_name = os.path.basename(file_path)
task, entity = self._connection.post_multipart_with_response_handling(uri, file_path, upload_file_name)... | [
"\n Makes a multipart request.\n\n Args:\n file_path:\n File to upload.\n uri:\n A specific URI (optional).\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n ... |
Please provide a description of the function:def patch(self, id_or_uri, operation, path, value, timeout=-1, custom_headers=None):
patch_request_body = [{'op': operation, 'path': path, 'value': value}]
return self.patch_request(id_or_uri=id_or_uri,
body=patch_r... | [
"\n Uses the PATCH to update a resource.\n\n Only one operation can be performed in each PATCH call.\n\n Args:\n id_or_uri: Can be either the resource ID or the resource URI.\n operation: Patch operation\n path: Path\n value: Value\n timeou... |
Please provide a description of the function:def patch_request(self, id_or_uri, body, timeout=-1, custom_headers=None):
uri = self.build_uri(id_or_uri)
logger.debug('Patch resource (uri = %s, data = %s)' % (uri, body))
custom_headers_copy = custom_headers.copy() if custom_headers else... | [
"\n Uses the PATCH to update a resource.\n\n Only one operation can be performed in each PATCH call.\n\n Args:\n id_or_uri: Can be either the resource ID or the resource URI.\n body: Patch request body\n timeout: Timeout in seconds. Wait for task completion by d... |
Please provide a description of the function:def get_by(self, field, value, uri=None):
if not field:
logger.exception(RESOURCE_CLIENT_INVALID_FIELD)
raise ValueError(RESOURCE_CLIENT_INVALID_FIELD)
if not uri:
uri = self._uri
self.__validate_resource_... | [
"\n This function uses get_all passing a filter.\n\n The search is case-insensitive.\n\n Args:\n field: Field name to filter.\n value: Value to filter.\n uri: Resource uri.\n\n Returns:\n dict\n "
] |
Please provide a description of the function:def get_utilization(self, id_or_uri, fields=None, filter=None, refresh=False, view=None):
if not id_or_uri:
raise ValueError(RESOURCE_CLIENT_INVALID_ID)
query = ''
if filter:
query += self.__make_query_filter(filter... | [
"\n Retrieves historical utilization data for the specified resource, metrics, and time span.\n\n Args:\n id_or_uri:\n Resource identification\n fields:\n Name of the supported metric(s) to be retrieved in the format METRIC[,METRIC]...\n ... |
Please provide a description of the function:def get_by(self, field, value):
firmwares = self.get_all()
matches = []
for item in firmwares:
if item.get(field) == value:
matches.append(item)
return matches | [
"\n Gets the list of firmware baseline resources managed by the appliance. Optional parameters can be used to\n filter the list of resources returned.\n\n The search is case-insensitive.\n\n Args:\n field: Field name to filter.\n value: Value to filter.\n\n R... |
Please provide a description of the function:def update(self, data, timeout=-1, force=False):
uri = self.data["uri"]
self.data = self._helper.update(data, uri=uri, timeout=timeout, force=force)
return self | [
"\n Updates one or more attributes for a server hardware type resource.\n Args:\n data (dict): Object to update.\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in OneView; it just stop... |
Please provide a description of the function:def get_statistics(self, id_or_uri, port_name=''):
uri = self._client.build_uri(id_or_uri) + "/statistics"
if port_name:
uri = uri + "/" + port_name
return self._client.get(uri) | [
"\n Gets the statistics from an interconnect.\n\n Args:\n id_or_uri: Can be either the interconnect id or the interconnect uri.\n port_name (str): A specific port name of an interconnect.\n\n Returns:\n dict: The statistics for the interconnect that matches id... |
Please provide a description of the function:def get_subport_statistics(self, id_or_uri, port_name, subport_number):
uri = self._client.build_uri(id_or_uri) + "/statistics/{0}/subport/{1}".format(port_name, subport_number)
return self._client.get(uri) | [
"\n Gets the subport statistics on an interconnect.\n\n Args:\n id_or_uri: Can be either the interconnect id or the interconnect uri.\n port_name (str): A specific port name of an interconnect.\n subport_number (int): The subport.\n\n Returns:\n dic... |
Please provide a description of the function:def get_name_servers(self, id_or_uri):
uri = self._client.build_uri(id_or_uri) + "/nameServers"
return self._client.get(uri) | [
"\n Gets the named servers for an interconnect.\n\n Args:\n id_or_uri: Can be either the interconnect id or the interconnect uri.\n\n Returns:\n dict: the name servers for an interconnect.\n "
] |
Please provide a description of the function:def update_port(self, port_information, id_or_uri, timeout=-1):
uri = self._client.build_uri(id_or_uri) + "/ports"
return self._client.update(port_information, uri, timeout) | [
"\n Updates an interconnect port.\n\n Args:\n id_or_uri: Can be either the interconnect id or the interconnect uri.\n port_information (dict): object to update\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\... |
Please provide a description of the function:def update_ports(self, ports, id_or_uri, timeout=-1):
resources = merge_default_values(ports, {'type': 'port'})
uri = self._client.build_uri(id_or_uri) + "/update-ports"
return self._client.update(resources, uri, timeout) | [
"\n Updates the interconnect ports.\n\n Args:\n id_or_uri: Can be either the interconnect id or the interconnect uri.\n ports (list): Ports to update.\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n ... |
Please provide a description of the function:def reset_port_protection(self, id_or_uri, timeout=-1):
uri = self._client.build_uri(id_or_uri) + "/resetportprotection"
return self._client.update_with_zero_body(uri, timeout) | [
"\n Triggers a reset of port protection.\n\n Cause port protection to be reset on all the interconnects of the logical interconnect that matches ID.\n\n Args:\n id_or_uri: Can be either the interconnect id or the interconnect uri.\n timeout: Timeout in seconds. Wait for ta... |
Please provide a description of the function:def get_ports(self, id_or_uri, start=0, count=-1):
uri = self._client.build_subresource_uri(resource_id_or_uri=id_or_uri, subresource_path="ports")
return self._client.get_all(start, count, uri=uri) | [
"\n Gets all interconnect ports.\n\n Args:\n id_or_uri: Can be either the interconnect id or the interconnect uri.\n start:\n The first item to return, using 0-based indexing.\n If not specified, the default is 0 - start with the first available item... |
Please provide a description of the function:def get_port(self, id_or_uri, port_id_or_uri):
uri = self._client.build_subresource_uri(id_or_uri, port_id_or_uri, "ports")
return self._client.get(uri) | [
"\n Gets an interconnect port.\n\n Args:\n id_or_uri: Can be either the interconnect id or uri.\n port_id_or_uri: The interconnect port id or uri.\n\n Returns:\n dict: The interconnect port.\n "
] |
Please provide a description of the function:def get_pluggable_module_information(self, id_or_uri):
uri = self._client.build_uri(id_or_uri) + "/pluggableModuleInformation"
return self._client.get(uri) | [
"\n Gets all the pluggable module information.\n\n Args:\n id_or_uri: Can be either the interconnect id or uri.\n\n Returns:\n array: dicts of the pluggable module information.\n "
] |
Please provide a description of the function:def update_configuration(self, id_or_uri, timeout=-1):
uri = self._client.build_uri(id_or_uri) + "/configuration"
return self._client.update_with_zero_body(uri, timeout=timeout) | [
"\n Reapplies the appliance's configuration on the interconnect. This includes running the same configure steps\n that were performed as part of the interconnect add by the enclosure.\n\n Args:\n id_or_uri: Can be either the resource ID or the resource URI.\n timeout: Time... |
Please provide a description of the function:def update(self, resource, id_or_uri):
return self._client.update(resource=resource, uri=id_or_uri) | [
"\n Updates a registered Device Manager.\n\n Args:\n resource (dict): Object to update.\n id_or_uri: Can be either the Device manager ID or URI.\n\n Returns:\n dict: The device manager resource.\n "
] |
Please provide a description of the function:def add(self, resource, provider_uri_or_id, timeout=-1):
uri = self._provider_client.build_uri(provider_uri_or_id) + "/device-managers"
return self._client.create(resource=resource, uri=uri, timeout=timeout) | [
"\n Adds a Device Manager under the specified provider.\n\n Args:\n resource (dict): Object to add.\n provider_uri_or_id: ID or URI of provider.\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does not abort the operatio... |
Please provide a description of the function:def get_provider_uri(self, provider_display_name):
providers = self._provider_client.get_by('displayName', provider_display_name)
return providers[0]['uri'] if providers else None | [
"\n Gets uri for a specific provider.\n\n Args:\n provider_display_name: Display name of the provider.\n\n Returns:\n uri\n "
] |
Please provide a description of the function:def get_default_connection_info(self, provider_name):
provider = self._provider_client.get_by_name(provider_name)
if provider:
return provider['defaultConnectionInfo']
else:
return {} | [
"\n Gets default connection info for a specific provider.\n\n Args:\n provider_name: Name of the provider.\n\n Returns:\n dict: Default connection information.\n "
] |
Please provide a description of the function:def get_by_name(self, name):
san_managers = self._client.get_all()
result = [x for x in san_managers if x['name'] == name]
return result[0] if result else None | [
"\n Gets a SAN Manager by name.\n\n Args:\n name: Name of the SAN Manager\n\n Returns:\n dict: SAN Manager.\n "
] |
Please provide a description of the function:def get_by_provider_display_name(self, provider_display_name):
san_managers = self._client.get_all()
result = [x for x in san_managers if x['providerDisplayName'] == provider_display_name]
return result[0] if result else None | [
"\n Gets a SAN Manager by provider display name.\n\n Args:\n provider_display_name: Name of the Provider Display Name\n\n Returns:\n dict: SAN Manager.\n "
] |
Please provide a description of the function:def update_configuration(self, configuration):
return self._client.update(configuration, uri=self.URI + "/configuration") | [
"\n Updates the metrics configuration with the new values. Overwrites the existing configuration.\n\n Args:\n configuration (dict):\n Dictionary with a list of objects which contain frequency, sample interval, and source type for each\n resource-type.\n\n ... |
Please provide a description of the function:def delete_all(self, filter=None, timeout=-1):
return self._client.delete_all(filter=filter, timeout=timeout) | [
"\n Delete an SNMPv3 User based on User name specified in filter. The user will be deleted only if it has no associated destinations.\n\n Args:\n username: ID or URI of SNMPv3 user.\n filter: A general filter/query string to narrow the list of items returned.\n ... |
Please provide a description of the function:def update_ports(self, ports, id_or_uri):
ports = merge_default_values(ports, {'type': 'port'})
uri = self._client.build_uri(id_or_uri) + "/update-ports"
return self._client.update(uri=uri, resource=ports) | [
"\n Updates the switch ports. Only the ports under the management of OneView and those that are unlinked are\n supported for update.\n\n Note:\n This method is available for API version 300 or later.\n\n Args:\n ports: List of Switch Ports.\n id_or_uri: C... |
Please provide a description of the function:def from_json_file(cls, file_name):
with open(file_name) as json_data:
config = json.load(json_data)
return cls(config) | [
"\n Construct OneViewClient using a json file.\n\n Args:\n file_name: json full path.\n\n Returns:\n OneViewClient:\n "
] |
Please provide a description of the function:def from_environment_variables(cls):
ip = os.environ.get('ONEVIEWSDK_IP', '')
image_streamer_ip = os.environ.get('ONEVIEWSDK_IMAGE_STREAMER_IP', '')
api_version = int(os.environ.get('ONEVIEWSDK_API_VERSION', OneViewClient.DEFAULT_API_VERSION)... | [
"\n Construct OneViewClient using environment variables.\n\n Allowed variables: ONEVIEWSDK_IP (required), ONEVIEWSDK_USERNAME (required), ONEVIEWSDK_PASSWORD (required),\n ONEVIEWSDK_AUTH_LOGIN_DOMAIN, ONEVIEWSDK_API_VERSION, ONEVIEWSDK_IMAGE_STREAMER_IP, ONEVIEWSDK_SESSIONID, ONEVIEWSDK_SSL_CE... |
Please provide a description of the function:def __set_proxy(self, config):
if "proxy" in config and config["proxy"]:
proxy = config["proxy"]
splitted = proxy.split(':')
if len(splitted) != 2:
raise ValueError(ONEVIEW_CLIENT_INVALID_PROXY)
... | [
"\n Set proxy if needed\n Args:\n config: Config dict\n "
] |
Please provide a description of the function:def create_image_streamer_client(self):
image_streamer = ImageStreamerClient(self.__image_streamer_ip,
self.__connection.get_session_id(),
self.__connection._apiVersion... | [
"\n Create the Image Streamer API Client.\n\n Returns:\n ImageStreamerClient:\n "
] |
Please provide a description of the function:def certificate_authority(self):
if not self.__certificate_authority:
self.__certificate_authority = CertificateAuthority(self.__connection)
return self.__certificate_authority | [
"\n Gets the Certificate Authority API client.\n\n Returns:\n CertificateAuthority:\n "
] |
Please provide a description of the function:def connections(self):
if not self.__connections:
self.__connections = Connections(
self.__connection)
return self.__connections | [
"\n Gets the Connections API client.\n\n Returns:\n Connections:\n "
] |
Please provide a description of the function:def fcoe_networks(self):
if not self.__fcoe_networks:
self.__fcoe_networks = FcoeNetworks(self.__connection)
return self.__fcoe_networks | [
"\n Gets the FcoeNetworks API client.\n\n Returns:\n FcoeNetworks:\n "
] |
Please provide a description of the function:def fabrics(self):
if not self.__fabrics:
self.__fabrics = Fabrics(self.__connection)
return self.__fabrics | [
"\n Gets the Fabrics API client.\n\n Returns:\n Fabrics:\n "
] |
Please provide a description of the function:def restores(self):
if not self.__restores:
self.__restores = Restores(self.__connection)
return self.__restores | [
"\n Gets the Restores API client.\n\n Returns:\n Restores:\n "
] |
Please provide a description of the function:def scopes(self):
if not self.__scopes:
self.__scopes = Scopes(self.__connection)
return self.__scopes | [
"\n Gets the Scopes API client.\n\n Returns:\n Scopes:\n "
] |
Please provide a description of the function:def datacenters(self):
if not self.__datacenters:
self.__datacenters = Datacenters(self.__connection)
return self.__datacenters | [
"\n Gets the Datacenters API client.\n\n Returns:\n Datacenters:\n "
] |
Please provide a description of the function:def network_sets(self):
if not self.__network_sets:
self.__network_sets = NetworkSets(self.__connection)
return self.__network_sets | [
"\n Gets the NetworkSets API client.\n\n Returns:\n NetworkSets:\n "
] |
Please provide a description of the function:def server_hardware(self):
if not self.__server_hardware:
self.__server_hardware = ServerHardware(self.__connection)
return self.__server_hardware | [
"\n Gets the ServerHardware API client.\n\n Returns:\n ServerHardware:\n "
] |
Please provide a description of the function:def server_hardware_types(self):
if not self.__server_hardware_types:
self.__server_hardware_types = ServerHardwareTypes(
self.__connection)
return self.__server_hardware_types | [
"\n Gets the ServerHardwareTypes API client.\n\n Returns:\n ServerHardwareTypes:\n "
] |
Please provide a description of the function:def id_pools_vsn_ranges(self):
if not self.__id_pools_vsn_ranges:
self.__id_pools_vsn_ranges = IdPoolsRanges('vsn', self.__connection)
return self.__id_pools_vsn_ranges | [
"\n Gets the IdPoolsRanges API Client for VSN Ranges.\n\n Returns:\n IdPoolsRanges:\n "
] |
Please provide a description of the function:def id_pools_vmac_ranges(self):
if not self.__id_pools_vmac_ranges:
self.__id_pools_vmac_ranges = IdPoolsRanges('vmac', self.__connection)
return self.__id_pools_vmac_ranges | [
"\n Gets the IdPoolsRanges API Client for VMAC Ranges.\n\n Returns:\n IdPoolsRanges:\n "
] |
Please provide a description of the function:def id_pools_vwwn_ranges(self):
if not self.__id_pools_vwwn_ranges:
self.__id_pools_vwwn_ranges = IdPoolsRanges('vwwn', self.__connection)
return self.__id_pools_vwwn_ranges | [
"\n Gets the IdPoolsRanges API Client for VWWN Ranges.\n\n Returns:\n IdPoolsRanges:\n "
] |
Please provide a description of the function:def id_pools_ipv4_ranges(self):
if not self.__id_pools_ipv4_ranges:
self.__id_pools_ipv4_ranges = IdPoolsIpv4Ranges(self.__connection)
return self.__id_pools_ipv4_ranges | [
"\n Gets the IdPoolsIpv4Ranges API client.\n\n Returns:\n IdPoolsIpv4Ranges:\n "
] |
Please provide a description of the function:def id_pools_ipv4_subnets(self):
if not self.__id_pools_ipv4_subnets:
self.__id_pools_ipv4_subnets = IdPoolsIpv4Subnets(self.__connection)
return self.__id_pools_ipv4_subnets | [
"\n Gets the IdPoolsIpv4Subnets API client.\n\n Returns:\n IdPoolsIpv4Subnets:\n "
] |
Please provide a description of the function:def id_pools(self):
if not self.__id_pools:
self.__id_pools = IdPools(self.__connection)
return self.__id_pools | [
"\n Gets the IdPools API client.\n\n Returns:\n IdPools:\n "
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.