Examples#
Invoking an operation#
Initialize the API#
ignore_window_api_instance = IgnoreWindowApi(api_client=client) # client configured in previous step
extId = 'extId_example' # UUID.
# Get an ignore window.
try:
api_response = ignore_window_api_instance.get_ignore_window_by_id(extId)
except ApiException as e:
Setting headers for individual operations#
Headers can be configured globally on the python client using the method to set default headers. However, sometimes headers need to be set on an individual operation basis. Nutanix APIs require that concurrent updates are protected using ETag headers.
Setting headers#
ignore_window_api_instance = IgnoreWindowApi(api_client=client) # client configured in previous step
extId = 'extId_example' # UUID.
# Get an ignore window.
try:
api_response = ignore_window_api_instance.get_ignore_window_by_id(extId)
except ApiException as e:
# Extract E-Tag Header
etag_value = ApiClient.get_etag(api_response)
# Update an ignore window.
try:
# The body parameter in the following operation is received from the previous GET request's response which needs to be updated.
api_response = ignore_window_api_instance.update_ignore_window(body, extId, if_match=etag_value) # Use the extracted etag value
except ApiException as e:
List Operations#
List Operations for Nutanix APIs support pagination, filtering, sorting and projections. The table below details the parameters that can be used to set the options for pagination etc.
List Operations#
cluster_api_instance = ClusterApi(api_client=client) # client configured in previous step
extId = 'extId_example' # UUID.
# Returns information regarding the total, used and available resources (cpu, memory, storage) for all the clusters in Prism Central
try:
api_response = cluster_api_instance.list_resources_for_all_clusters(
_page=page, # if page parameter is present
_limit=limit, # if limit parameter is present
_filter=_filter, # if filter parameter is present
_orderby=_orderby, # if orderby parameter is present
_select=select, # if select parameter is present
_expand=expand) # if expand parameter is present
except ApiException as e: