Introduction ============ The *Cohesity Management SDK* provides an easy-to-use language binding to harness the power of *Cohesity REST APIs* in your python applications. ------- .. sidebar:: About Cohesity * **Website**: `www.cohesity.com/ `_ * **Source code**: `https://github.com/cohesity/management-sdk-python `_ * **Twitter**: `@cohesity `_ Installation ++++++++++++ Cohesity Management Sdk can be either installed from source or through pip. **Install via pip** | ``pip install cohesity-management-sdk`` **Install from source** The generated code uses Python packages named requests, jsonpickle and dateutil. You can resolve these dependencies using `pip `_. This SDK uses the Requests library and will work for Python **2 >=2.7.9** and Python **3 >=3.4**. :: * git clone https://github.com/cohesity/management-sdk-python.git * cd management-sdk-python * pip install -r requirements.txt * python setup.py install ------ Upgrade +++++++ To upgrade the package: | ``pip install cohesity-management-sdk --upgrade`` To upgade the package to specific release: | ``pip install cohesity-management-sdk==1.6.1`` .. note:: Refer `Python docs `_ for your cluster version. ------- How to Use ++++++++++ This SDK exposes all the functionality provided by *Cohesity REST API*. To initialize the API client, the following parameters need to be passed. +--------------+---------+-----------------------------------------------------------+ | Parameter | Type | Description | +==============+=========+===========================================================+ | username | string | Specifies the login name of the Cohesity user. | +--------------+---------+-----------------------------------------------------------+ | password | string | Specifies the password of the Cohesity user account. | +--------------+---------+----------------+------------------------------------------+ | domain | string | Specifies the | * For a Local user model, the domain is | | | | domain the user| always LOCAL. | | | | is logging in. | * For LDAP / AD user models, the domain | | | | | will map to an LDAP connection string. | | | | | * A user is uniquely identified by a | | | | | combination of username and domain. | +--------------+---------+----------------+------------------------------------------+ | cluster_vip | string | VIP or DNS name of cohesity cluster. | | | | Default: '{CLUSTER_VIP}' | +--------------+---------+-----------------------------------------------------------+ .. important :: If **domain** is not set '**LOCAL**' is assigned. **Initializing the Client** .. code-block:: python :linenos: :emphasize-lines: 3, 9, 11 """ Sample code to create a cohesity client. """ from cohesity_management_sdk.cohesity_client_v2 import CohesityClientV2 username = 'Username' password = 'Password' domain = 'Domain' #optional cluster_vip = 'cluster_vip' client = CohesityClientV2(cluster_vip, username, password, domain) policies_controller = client.protection_policies result = policies_controller.get_protection_policies().policies print([policy.name for policy in result]) **Output** ["Gold", "Bronze", "Silver"] ------- Questions or Feedback +++++++++++++++++++++ We would love to hear from you. Please send your questions and feedback to: cohesity-api-sdks@cohesity.com