hpeOneView.resources.activity package
Submodules
hpeOneView.resources.activity.alerts module
- class hpeOneView.resources.activity.alerts.Alerts(con)[source]
Bases:
object
- URI = '/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='', query='', sort='', view='')[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
hpeOneView.resources.activity.events module
- class hpeOneView.resources.activity.events.Events(con)[source]
Bases:
object
- DEFAULT_VALUES = {'200': {'type': 'EventResourceV3'}, '300': {'type': 'EventResourceV3'}}
- URI = '/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='', query='', sort='', view='')[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
hpeOneView.resources.activity.tasks module
- class hpeOneView.resources.activity.tasks.Tasks(connection, data=None)[source]
Bases:
ResourcePatchMixin
,Resource
Tasks API client.
- URI = '/rest/tasks'
- get_all(start=0, count=-1, fields='', filter='', query='', sort='', view='', topCount=0, childLimit=0)[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).
childLimit – Total number of associated resources in an aggregated manner. Default value is 10.
topCount – Total number of immediate children the task should send back. Otherwise, the task sends back the aggregated view of the tree. Default value is 3.
- Returns
A list of tasks.
- Return type
list
- patch(uri, timeout=-1)[source]
Sets the state of task to cancelling only if IsCancellable is set to true for the task and its children or children are in terminal state.
- Parameters
uri – URI of task resource.
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 resource.
- Return type
dict