The Cohesity Management SDK provides an easy-to-use language binding to harness the power of Cohesity REST APIs in your python applications.
- Getting Started
- Cluster Version and Compatibility Matrix
- Documentation
- How to use
- More samples
- How can you contribute
- Suggestions and Feedback
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
To upgrade the package:
pip install cohesity-management-sdk --upgrade
To upgade the package to specific release:
pip install cohesity-management-sdk==1.5.1
Cluster Version | SDK Version |
---|---|
7.0 | 1.10.1 |
6.8.1_u1 | 1.9.2 |
6.8.1_u1 | 1.9.1 |
6.8.1_u1 | 1.9.0 |
6.6.0x | 1.8.1 |
6.6x | 1.6.0 |
6.5.1x | 1.5.0 |
6.5.0x | 1.4.0 |
6.4.1x | 1.2.0 |
6.3.1x | 1.1.3 |
6.4x | 1.1.1 |
6.3x | 1.1.0 |
Refer Python docs for your cluster version.
This SDK exposes all the functionality provided by Cohesity REST API.
Initializing the Client using username
and password
:
username = 'Username'
password = 'Password'
domain = 'Domain' #optional
cluster_vip = 'prod-cluster.eng.cohesity.com'
client = CohesityClient(cluster_vip, username, password, domain)
cluster_controller = client.cluster
result = cluster_controller.get_basic_cluster_info()
result_dict = result.__dict__
print(result_dict['cluster_software_version'])
#OUTPUT
6.4.1_release-20191219_aafe3274
Initializing the Client Using Session Id
:
cluster_vip = 'prod-cluster.eng.cohesity.com'
session_id = '<session_id>'
client = CohesityClient(cluster_vip=cluster_vip, session_id = session_id)
cluster_controller = client.cluster
result = cluster_controller.get_basic_cluster_info()
print(result_dict['cluster_software_version'])
#OUTPUT
6.4.1_release-20191219_aafe3274
Initializing the Client Using Api Key
:
cluster_vip = 'prod-cluster.eng.cohesity.com'
api_key = '<api_key>'
client = CohesityClient(cluster_vip=cluster_vip, api_key = api_key)
cluster_controller = client.cluster
result = cluster_controller.get_basic_cluster_info()
print(result_dict['cluster_software_version'])
#OUTPUT
6.4.1_release-20191219_aafe3274
Initializing the Client Using Open-Id token
:
cluster_vip = 'prod-cluster.eng.cohesity.com'
open_id_token = '<token>'
client = CohesityClient(cluster_vip=cluster_vip, open_id_token = open_id_token)
cluster_controller = client.cluster
result = cluster_controller.get_basic_cluster_info()
print(result_dict['cluster_software_version'])
#OUTPUT
6.4.1_release-20191219_aafe3274
Initializing the Client Using MFA
:
username = 'Username'
password = 'Password'
otp_type = 'Email'
otp_code = '123456'
domain = 'Domain' #optional
cluster_vip = 'prod-cluster.eng.cohesity.com'
client = CohesityClient(cluster_vip=cluster_vip, username=username, password=password, domain=domain, otp_type=otp_type, otp_code=otp_code)
cluster_controller = client.cluster
result = cluster_controller.get_basic_cluster_info()
print(result_dict['cluster_software_version'])
#OUTPUT
6.4.1_release-20191219_aafe3274
Check out the scripts included under samples
for reference.
We would love to hear from you. Please send your questions and feedback via Cohesity support portal: https://www.cohesity.com/support/