Module netapp_ontap.utils

Copyright © 2021 NetApp Inc. All rights reserved.

This module contains some of the common utility funcions used in the library.


def poll(response: requests.models.Response, connection: HostConnection = None, timeout: int = None, interval: int = None) -> NetAppResponse

Poll for a job to complete on the host.

This function accepts an HTTP 202 response from the server and follows the associated job link. As long as the state of the job is not terminal, it continues retrieving the job and logs a status message as it changes.


The initial API response which contains 202 and the job link.
An optional HostConnection object. This is required if there is no globally usable connection set for the library.
Seconds to wait before timing out of a poll request. If set, the value overrides the timeout set in the connection. Otherwise, the timeout set in the connection is used.
Seconds to wait between REST API calls when checking the job status. If set, the value overrides the interval in the connection object. Otherwise, the interval set in connection object is used.


The API response.


NetAppRestError: If there was no connection available when the request was made (either passed in or set for the library), or if the job times out.