controllers.access_tokens_controller module

class controllers.access_tokens_controller.AccessTokensController(config=None, client=None, call_back=None)[source]

Bases: cohesity_management_sdk.controllers.base_controller.BaseController

A Controller to access Endpoints in the cohesity_management_sdk API.

create_generate_access_token(body)[source]

Does a POST request to /public/accessTokens.

Before making other REST API requests, your REST client must make a ‘POST /public/accessToken’ request with a valid Cohesity username and password. This POST request returns an access token and type in the response that is generated by the Cohesity Cluster. Subsequent requests to other Cohesity REST API operations must specify the returned access token and type by setting ‘Authorization’ in the http header in the following format: Authorization: token_type access_token The generated token is valid for 24 hours. If a request is made with an expired token, the ‘Token expired’ error message is returned. Add code to your REST client to check for this error and request another access token before reissuing the request.

Args:

body (AccessTokenCredential): Request to generate access token.

Returns:

AccessToken: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.