controllers_v2.base_controller module

class controllers_v2.base_controller.BaseController(config=None, client=None, call_back=None)[source]

Bases: object

All controllers inherit from this base class.

Attributes:
http_client (HttpClient): The HttpClient which a specific controller

instance will use. By default all the controller objects share the same HttpClient. A user can use his own custom HttpClient as well.

http_call_back (HttpCallBack): An object which holds call back

methods to be called before and after the execution of an HttpRequest.

global_headers (dict): The global headers of the API which are sent with

every request.

execute_request(request, binary=False, name=None)[source]

Executes an HttpRequest.

Args:

request (HttpRequest): The HttpRequest to execute. binary (bool): A flag which should be set to True if

a binary response is expected.

Returns:
HttpContext: The HttpContext of the request. It contains,

both, the request itself and the HttpResponse object.

global_headers = {'user-agent': 'cohesity-python/1.6.7'}
http_call_back = None
http_client = <cohesity_management_sdk.http.requests_client.RequestsClient object>
validate_parameters(**kwargs)[source]

Validates required parameters of an endpoint.

Args:

kwargs (dict): A dictionary of the required parameters.

validate_response(context)[source]

Validates an HTTP response by checking for global errors.

Args:

context (HttpContext): The HttpContext of the API call.