Examples#

Invoking an operation#

Initialize the API#
    hardenings_api_instance = HardeningsApi(api_client=client) # client configured in previous step
    extId = 'extId_example' # UUID.

    # Fetch the hardening settings for a cluster
    try:
    api_response = hardenings_api_instance.get_hardening_statuses_by_ext_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#
    hardenings_api_instance = HardeningsApi(api_client=client) # client configured in previous step
    extId = 'extId_example' # UUID.

    # Fetch the hardening settings for a cluster
    try:
    api_response = hardenings_api_instance.get_hardening_statuses_by_ext_id(extId)
    except ApiException as e:

    # Extract E-Tag Header
    etag_value = ApiClient.get_etag(api_response)

    # Update the hardening settings for a cluster
    try:
    # The body parameter in the following operation is received from the previous GET request's response which needs to be updated.
    api_response = hardenings_api_instance.update_hardening_statuses_by_ext_id(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#
    hardenings_api_instance = HardeningsApi(api_client=client) # client configured in previous step
    extId = 'extId_example' # UUID.

    # List of hardening settings for all clusters
    try:
    api_response = hardenings_api_instance.list_hardening_statuses(
    _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: