hpOneView.resources.search package

Submodules

hpOneView.resources.search.index_resources module

class hpOneView.resources.search.index_resources.IndexResources(con)[source]

Bases: object

Index Resources API client.

URI = u'/rest/index/resources'
get(uri)[source]

Gets an index resource by URI.

Parameters:uri – The resource URI.
Returns:The index resource.
Return type:dict
get_aggregated(attribute, category, child_limit=6, filter=u'', query=u'', user_query=u'')[source]

Gets a list of index resources based on optional sorting and filtering and is constrained by start and count parameters.

Parameters:
  • attribute (list or str) – Attribute to pass in as query filter.
  • category (str) – Category of resources. Multiple Category parameters are applied with an OR condition.
  • child_limit (int) – Number of resources to be retrieved. Default=6.
  • filter (list or str) – A general filter/query string to narrow the list of items returned. The default is no filter; all resources are returned.
  • query (str) – A general query string to narrow the list of resources returned. The default is no query - all resources are returned.
  • user_query (str) – Free text Query string to search the resources. This will match the string in any field that is indexed.
Returns:

An aggregated list of index resources.

Return type:

list

get_all(category=u'', count=-1, fields=u'', filter=u'', padding=0, query=u'', reference_uri=u'', sort=u'', start=0, user_query=u'', view=u'')[source]

Gets a list of index resources based on optional sorting and filtering and is constrained by start and count parameters.

Parameters:
  • category (str or list) – Category of resources. Multiple Category parameters are applied with OR condition.
  • count (int) – The number of resources to return. A count of -1 requests all items. The actual number of items in the response might differ from the requested count if the sum of start and count exceeds the total number of items.
  • fields (str) – Specifies which fields should be returned in the result set.
  • filter (list or str) – A general filter/query string to narrow the list of items returned. The default is no filter; all resources are returned.
  • padding (int) – Number of resources to be returned before the reference URI resource.
  • query (str) – A general query string to narrow the list of resources returned. The default is no query - all resources are returned.
  • reference_uri (str) – Load one page of resources, pagination is applied with reference to referenceUri provided.
  • sort (str) – The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first.
  • start (int) – The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the first available item.
  • user_query (str) – Free text Query string to search the resources. This will match the string in any field that is indexed.
  • view (str) – Return a specific subset of the attributes of the resource or collection, by specifying the name of a predefined view.
Returns:

A list of index resources.

Return type:

list

hpOneView.resources.search.labels module

class hpOneView.resources.search.labels.Labels(con)[source]

Bases: object

Labels API client.

RESOURCES_PATH = u'/resources'
URI = u'/rest/labels'
create(resource)[source]

Set all the labels for a resource.

Parameters:resource – The object containing the resource URI and a list of labels
Returns:Resource Labels
Return type:dict
delete(resource, timeout=-1)[source]

Delete all the labels for a resource.

Parameters:
  • resource (dict) – Object to delete.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView, just stop waiting for its completion.
get(id_or_uri)[source]

Gets a label by ID or URI.

Parameters:id_or_uri – Can be either the label ID or the label URI.
Returns:The label.
Return type:dict
get_all(start=0, count=-1, filter=u'', sort=u'')[source]

Gets a list of labels based on optional sorting and filtering and is constrained by start and count parameters.

Parameters:
  • start – The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the first available item.
  • count – The number of resources to return. A count of -1 requests all items. The actual number of items in the response might differ from the requested count if the sum of start and count exceeds the total number of items.
  • filter (list or str) – A general filter/query string to narrow the list of items returned. The default is no filter; all resources are returned.
  • sort – The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first.
Returns:

A list of labels.

Return type:

list

get_by_resource(resource_uri)[source]

Gets all the labels for the specified resource

Parameters:resource_uri – The resource URI
Returns:Resource Labels
Return type:dict
update(resource)[source]

Set all the labels for a resource.

Parameters:resource (dict) – Object to update.
Returns:Resource Labels
Return type:dict

Module contents