Module netapp_ontap.resources.autosupport_message

Copyright © 2023 NetApp Inc. All rights reserved.

This file has been automatically generated based on the ONTAP REST API documentation.

Overview

Use this API to invoke and retrieve AutoSupport messages from the nodes in the cluster.

This API supports POST and GET calls. Use a POST call to invoke AutoSupport and a GET call to retrieve AutoSupport messages.


Examples

Invoking an AutoSupport on all nodes in the cluster

The following example invokes an AutoSupport on every node in the cluster. Note that AutoSupport is invoked on all nodes in the cluster if the node parameter is omitted. Also, note that the subject line is the same when invoking on all nodes.

By default, the response is an empty object. If return_records=true is passed in the request, the response includes information about the node and the index of the invoked AutoSupport message.

from netapp_ontap import HostConnection
from netapp_ontap.resources import AutosupportMessage

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = AutosupportMessage()
    resource.message = "test_msg"
    resource.type = "all"
    resource.post(hydrate=True)
    print(resource)

AutosupportMessage(
    {
        "index": 4,
        "node": {
            "name": "node1",
            "_links": {
                "self": {
                    "href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
                }
            },
            "uuid": "092e0298-f250-11e8-9a05-005056bb6666",
        },
    }
)


Invoking an AutoSupport on a single node

The following examples invoke an AutoSupport on a single node in the cluster. Note that AutoSupport is invoked on all nodes in the cluster if the node parameter is omitted. You can specify the node-name with either node or node.name parameter. You can also specify UUID of the node with the node.uuid parameter.

By default, the response is an empty object. If return_records=true is passed in the request, the response includes information about the node and the index of the invoked AutoSupport message.

from netapp_ontap import HostConnection
from netapp_ontap.resources import AutosupportMessage

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = AutosupportMessage()
    resource.message = "test_msg"
    resource.type = "test"
    resource.node = {"name": "node1"}
    resource.post(hydrate=True)
    print(resource)

AutosupportMessage(
    {
        "index": 8,
        "node": {
            "name": "node1",
            "_links": {
                "self": {
                    "href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
                }
            },
            "uuid": "092e0298-f250-11e8-9a05-005056bb6666",
        },
    }
)

from netapp_ontap import HostConnection
from netapp_ontap.resources import AutosupportMessage

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = AutosupportMessage()
    resource.message = "test_msg"
    resource.type = "test"
    resource.node.name = "node2"
    resource.post(hydrate=True)
    print(resource)

AutosupportMessage(
    {
        "index": 4,
        "node": {
            "name": "node2",
            "_links": {
                "self": {
                    "href": "/api/cluster/nodes/e47d2630-f250-11e8-b186-005056bb5cab"
                }
            },
            "uuid": "e47d2630-f250-11e8-b186-005056bb5cab",
        },
    }
)

from netapp_ontap import HostConnection
from netapp_ontap.resources import AutosupportMessage

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = AutosupportMessage()
    resource.message = "test_msg"
    resource.type = "test"
    resource.node.uuid = "092e0298-f250-11e8-9a05-005056bb6666"
    resource.post(hydrate=True)
    print(resource)

AutosupportMessage(
    {
        "index": 5,
        "node": {
            "name": "node1",
            "_links": {
                "self": {
                    "href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
                }
            },
            "uuid": "092e0298-f250-11e8-9a05-005056bb6666",
        },
    }
)


Retrieving AutoSupport messages from all nodes in the cluster

The following example retrieves AutoSupport messages from every node in the cluster. Note that if the fields=* parameter is not specified, only node, index, and destination fields are returned. Filters can be added on the fields to limit the results.

from netapp_ontap import HostConnection
from netapp_ontap.resources import AutosupportMessage

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    print(list(AutosupportMessage.get_collection(fields="*", return_timeout=15)))

[
    AutosupportMessage(
        {
            "index": 1,
            "destination": "smtp",
            "node": {
                "name": "node1",
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
                    }
                },
                "uuid": "092e0298-f250-11e8-9a05-005056bb6666",
            },
            "state": "ignore",
            "generated_on": "2019-03-28T10:18:04-04:00",
            "subject": "USER_TRIGGERED (TEST:test_msg)",
        }
    ),
    AutosupportMessage(
        {
            "index": 1,
            "destination": "http",
            "node": {
                "name": "node1",
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
                    }
                },
                "uuid": "092e0298-f250-11e8-9a05-005056bb6666",
            },
            "state": "sent_successful",
            "generated_on": "2019-03-28T10:18:04-04:00",
            "subject": "USER_TRIGGERED (TEST:test_msg)",
        }
    ),
    AutosupportMessage(
        {
            "index": 1,
            "destination": "noteto",
            "node": {
                "name": "node1",
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
                    }
                },
                "uuid": "092e0298-f250-11e8-9a05-005056bb6666",
            },
            "state": "ignore",
            "generated_on": "2019-03-28T10:18:04-04:00",
            "subject": "USER_TRIGGERED (TEST:test_msg)",
        }
    ),
    AutosupportMessage(
        {
            "index": 1,
            "destination": "smtp",
            "node": {
                "name": "node2",
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/e47d2630-f250-11e8-b186-005056bb5cab"
                    }
                },
                "uuid": "e47d2630-f250-11e8-b186-005056bb5cab",
            },
            "state": "ignore",
            "generated_on": "2019-03-28T10:18:06-04:00",
            "subject": "USER_TRIGGERED (TEST:test_msg)",
        }
    ),
    AutosupportMessage(
        {
            "index": 1,
            "destination": "http",
            "node": {
                "name": "node2",
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/e47d2630-f250-11e8-b186-005056bb5cab"
                    }
                },
                "uuid": "e47d2630-f250-11e8-b186-005056bb5cab",
            },
            "state": "sent_successful",
            "generated_on": "2019-03-28T10:18:06-04:00",
            "subject": "USER_TRIGGERED (TEST:test_msg)",
        }
    ),
    AutosupportMessage(
        {
            "index": 1,
            "destination": "noteto",
            "node": {
                "name": "node2",
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/e47d2630-f250-11e8-b186-005056bb5cab"
                    }
                },
                "uuid": "e47d2630-f250-11e8-b186-005056bb5cab",
            },
            "state": "ignore",
            "generated_on": "2019-03-28T10:18:06-04:00",
            "subject": "USER_TRIGGERED (TEST:test_msg)",
        }
    ),
]


Retrieving AutoSupport messages from a specific node and has 'sent_successful' state

The following example retrieves AutoSupport messages from a specific node in the cluster. Note that if the fields=* parameter is not specified, only node, index, and destination fields are returned. This example uses a filter on the node.name and state fields. You can add filters to any fields in the response.

from netapp_ontap import HostConnection
from netapp_ontap.resources import AutosupportMessage

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    print(
        list(
            AutosupportMessage.get_collection(
                state="sent_successful",
                fields="*",
                return_timeout=15,
                **{"node.name": "node1"}
            )
        )
    )

[
    AutosupportMessage(
        {
            "index": 1,
            "destination": "http",
            "node": {
                "name": "node1",
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/092e0298-f250-11e8-9a05-005056bb6666"
                    }
                },
                "uuid": "092e0298-f250-11e8-9a05-005056bb6666",
            },
            "state": "sent_successful",
            "generated_on": "2019-03-28T10:18:04-04:00",
            "subject": "USER_TRIGGERED (TEST:test_msg)",
        }
    )
]


Classes

class AutosupportMessage (*args, **kwargs)

Allows interaction with AutosupportMessage objects on the host

Initialize the instance of the resource.

Any keyword arguments are set on the instance as properties. For example, if the class was named 'MyResource', then this statement would be true:

MyResource(name='foo').name == 'foo'

Args

*args
Each positional argument represents a parent key as used in the URL of the object. That is, each value will be used to fill in a segment of the URL which refers to some parent object. The order of these arguments must match the order they are specified in the URL, from left to right.
**kwargs
each entry will have its key set as an attribute name on the instance and its value will be the value of that attribute.

Ancestors

Static methods

def count_collection (*args, connection: HostConnection = None, **kwargs) -> int

Returns a count of all AutosupportMessage resources that match the provided query


This calls GET on the object to determine the number of records. It is more efficient than calling get_collection() because it will not construct any objects. Query parameters can be passed in as kwargs to determine a count of objects that match some filtered criteria.

Args

*args
Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the count of bars for a particular foo, the foo.name value should be passed.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will be sent as query parameters to the host. These query parameters can affect the count. A return_records query param will be ignored.

Returns

On success, returns an integer count of the objects of this type. On failure, returns -1.

Raises

NetAppRestError: If the API call returned a status code >= 400, or if there is no connection available to use either passed in or on the library.

def find (*args, connection: HostConnection = None, **kwargs) -> Resource

Retrieves AutoSupport message history from all nodes in the cluster.

There can be a short delay on invoked AutoSupport messages showing in history, dependent on processing of other AutoSupports in the queue.

  • system node autosupport history show

Learn more


Find an instance of an object on the host given a query.

The host will be queried with the provided key/value pairs to find a matching resource. If 0 are found, None will be returned. If more than 1 is found, an error will be raised or returned. If there is exactly 1 matching record, then it will be returned.

Args

*args
Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to find a bar for a particular foo, the foo.name value should be passed.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will be sent as query parameters to the host.

Returns

A Resource object containing the details of the object or None if no matches were found.

Raises

NetAppRestError: If the API call returned more than 1 matching resource.

def get_collection (*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> Iterable[Resource]

Retrieves AutoSupport message history from all nodes in the cluster.

There can be a short delay on invoked AutoSupport messages showing in history, dependent on processing of other AutoSupports in the queue.

  • system node autosupport history show

Learn more


Fetch a list of all objects of this type from the host.

This is a lazy fetch, making API calls only as necessary when the result of this call is iterated over. For instance, if max_records is set to 5, then iterating over the collection causes an API call to be sent to the server once for every 5 records. If the client stops iterating before getting to the 6th record, then no additional API calls are made.

Args

*args
Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the collection of bars for a particular foo, the foo.name value should be passed.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
max_records
The maximum number of records to return per call
**kwargs
Any key/value pairs passed will be sent as query parameters to the host.

Returns

A list of Resource objects

Raises

NetAppRestError: If there is no connection available to use either passed in or on the library. This would be not be raised when get_collection() is called, but rather when the result is iterated.

def post_collection (records: Iterable[_ForwardRef('AutosupportMessage')], *args, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> Union[List[AutosupportMessage], NetAppResponse]

Creates and sends an AutoSupport message with the provided input parameters.

Important note: * By default, the response is an empty object. If return_records=true is passed in the request, the response includes information about the node and the index of the invoked AutoSupport message.

  • message - Message included in the AutoSupport subject. Use this to identify the generated AutoSupport message.

Default property values

If not specified in POST, the following are the default property values: * type - all * node.name or node.uuid - Not specifying these properties invokes AutoSupport on all nodes in the cluster.

  • system node autosupport invoke

Learn more


Send this collection of objects to the host as a creation request.

Args

records
A list of Resource objects to send to the server to be created.
*args
Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to create a bar for a particular foo, the foo.name value should be passed.
hydrate
If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of each object. When hydrate is set to True, poll must also be set to True.
poll
If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
poll_interval
If the operation returns a job, this specifies how often to query the job for updates.
poll_timeout
If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will be sent as query parameters to the host. Only resources matching this query will be patched.

Returns

A list of Resource objects matching the provided type which have been created by the host and returned. This is not the same list that was provided, so to continue using the object, you should save this list. If poll is set to False, then a NetAppResponse object is returned instead.

Raises

NetAppRestError: If the API call returned a status code >= 400

Methods

def post (self, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse

Creates and sends an AutoSupport message with the provided input parameters.

Important note: * By default, the response is an empty object. If return_records=true is passed in the request, the response includes information about the node and the index of the invoked AutoSupport message.

  • message - Message included in the AutoSupport subject. Use this to identify the generated AutoSupport message.

Default property values

If not specified in POST, the following are the default property values: * type - all * node.name or node.uuid - Not specifying these properties invokes AutoSupport on all nodes in the cluster.

  • system node autosupport invoke

Learn more


Send this object to the host as a creation request.

Args

hydrate
If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of the object.
poll
If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
poll_interval
If the operation returns a job, this specifies how often to query the job for updates.
poll_timeout
If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will normally be sent as query parameters to the host. If any of these pairs are parameters that are sent as formdata then only parameters of that type will be accepted and all others will be discarded.

Returns

A NetAppResponse object containing the details of the HTTP response.

Raises

NetAppRestError: If the API call returned a status code >= 400

Inherited members

class AutosupportMessageSchema (*, only: Union[Sequence[str], Set[str]] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Dict = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: str = None)

The fields of the AutosupportMessage object

Ancestors

  • netapp_ontap.resource.ResourceSchema
  • marshmallow.schema.Schema
  • marshmallow.base.SchemaABC

Class variables

destination: str GET

Destination for the AutoSupport

Valid choices:

  • smtp
  • http
  • noteto
  • retransmit
error: AutosupportMessageError GET POST PATCH

The error field of the autosupport_message.

generated_on: ImpreciseDateTime GET

Date and Time of AutoSupport generation in ISO-8601 format

Example: 2019-03-25T21:30:04.000+0000

index: Size GET

Sequence number of the AutoSupport

Example: 9

message: str POST

Message included in the AutoSupport subject

Example: invoked_test_autosupport_rest

node: Node GET POST

The node field of the autosupport_message.

state: str GET

State of AutoSupport delivery

Valid choices:

  • initializing
  • collection_failed
  • collection_in_progress
  • queued
  • transmitting
  • sent_successful
  • ignore
  • re_queued
  • transmission_failed
  • ondemand_ignore
  • cancelled
subject: str GET

Subject line for the AutoSupport

Example: WEEKLY_LOG

type: str POST

Type of AutoSupport collection to issue

Valid choices:

  • test
  • performance
  • all
uri: str POST

Alternate destination for the AutoSupport

Example: http://1.2.3.4/delivery_uri