hpOneView.resources.activity package

Submodules

hpOneView.resources.activity.alerts module

class hpOneView.resources.activity.alerts.Alerts(con)[source]

Bases: object

URI = u'/rest/alerts'
delete(resource)[source]

Deletes an alert.

Parameters:resource – dict object to delete
Returns:Indicates if the resource was successfully deleted.
Return type:bool
delete_alert_change_log(id_or_uri)[source]

Deletes alert change log by alert ID or URI.

Parameters:id_or_uri – alert ID or URI.
delete_all(filter, timeout=-1)[source]

Deletes all Alert objects from the appliance that match the provided filter.

Parameters:
  • filter (list or str) – A general filter string to narrow the list of items to delete. The default is no filter; all resources are deleted.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

Indicates whether the alerts were successfully deleted.

Return type:

bool

get(id_or_uri)[source]

Retrieve an alert by its URI or ID.

Parameters:id_or_uri – alert ID or URI.
Returns:The alert.
Return type:dict
get_all(start=0, count=-1, filter=u'', query=u'', sort=u'', view=u'')[source]

Gets all the alerts based upon filters provided.

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 may differ from the requested count if the sum of start and count exceed 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.
  • query – A general query string to narrow the list of resources returned. The default is no query (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.
  • view – Returns a specific subset of the attributes of the resource or collection, by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of collections of resources).
Returns:

A list of alerts.

Return type:

list

get_by(field, value)[source]

Gets all alerts that match the filter.

The search is case-insensitive.

Parameters:
  • field – Field name to filter.
  • value – Value to filter.
Returns:

List of alerts.

Return type:

list

update(resource, id_or_uri=None, timeout=-1)[source]

Updates the specified alert resource.

Parameters:
  • resource (dict) – Object to update.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

Updated alert.

Return type:

dict

hpOneView.resources.activity.events module

class hpOneView.resources.activity.events.Events(con)[source]

Bases: object

DEFAULT_VALUES = {u'200': {u'type': u'EventResourceV3'}, u'300': {u'type': u'EventResourceV3'}}
URI = u'/rest/events'
create(resource, timeout=-1)[source]

Creates an Event.

Parameters:
  • resource (dict) – Object to create.
  • 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.
Returns:

Created resource.

Return type:

dict

get(id_or_uri)[source]

Retrieve an event by its URI or ID.

Parameters:id_or_uri – event ID or URI.
Returns:The event.
Return type:dict
get_all(start=0, count=-1, filter=u'', query=u'', sort=u'', view=u'')[source]

Gets all the events based upon filters provided.

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 may differ from the requested count if the sum of start and count exceed 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.
  • query – A general query string to narrow the list of resources returned. The default is no query (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.
  • view – Returns a specific subset of the attributes of the resource or collection, by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of collections of resources).
Returns:

A list of events.

Return type:

list

get_by(field, value)[source]

Gets all events that match the filter.

The search is case-insensitive.

Parameters:
  • field – Field name to filter.
  • value – Value to filter.
Returns:

List of events.

Return type:

list

hpOneView.resources.activity.tasks module

class hpOneView.resources.activity.tasks.Tasks(con)[source]

Bases: object

Tasks API client.

URI = u'/rest/tasks'
get(id_or_uri)[source]

Retrieve a task by its uri.

Parameters:id_or_uri – task id (or uri)
Returns:The task.
Return type:dict
get_all(start=0, count=-1, fields=u'', filter=u'', query=u'', sort=u'', view=u'')[source]

Gets all the tasks based upon filters provided.

Note

Filters are optional.

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 may differ from the requested count if the sum of start and count exceed the total number of items.
  • fields – 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.
  • query – A general query string to narrow the list of resources returned. The default is no query (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.
  • view – Returns a specific subset of the attributes of the resource or collection, by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of collections of resources).
Returns:

A list of tasks.

Return type:

list

Module contents