Contributions via GitHub pull requests are gladly accepted from their original author. Along with any pull requests, please state that the contribution is your original work and that you license the work to the project under the project's open source license. Whether or not you state this explicitly, by submitting any copyrighted material via pull request, email, or other means you agree to license the material under the project's open source license and warrant that you have the legal authority to do so.
-
Clone the Python SDK repository
git clone https://github.com/rubrikinc/rubrik-sdk-for-python.git
-
Change directory to the repository root dir
cd rubrik-sdk-for-python
-
Switch to the
devel
branchgit checkout devel
-
Create a virtual environment
python3 -m venv venv
(or for Python 2virtualenv venv
)Note: This requires you to install the virtualenv package:
pip install virtualenv
-
Activate the virtual environment
. venv/bin/activate
-
Install the SDK from Source
python setup.py install
The /rubrik-sdk-for-python/rubrik_cdm
directory contains all functions for the SDK.
At a high level the directory contains the following:
api.py
- Base API Functions (get, post, etc.) that should only be touched for bug fixes.cloud.py
- Cloud relation functionscluster.py
- Functions involving the configuration of the Rubrik cluster itself (think Day 0 configurations)data_management.py
- Functions related to "Data Protection" taks (ex. on-demand-snapshot)physical.py
- Functions involving the management of Physical serversrubrik_cdm.py
- Several internal functions and theConnect
class that all other functions are accessed through. This should only be touched for bug fixes.
When adding a new function, it would ideally fit into one of these files. Each function should have the following:
- Each function must be idempotent. Before making any configuration changes (post, patch, delete) you should first check to see if that change is necessary. If it's not you must return a message formated as
No change required. {message}:
For example, theassign_sla
function first checks to see if the Rubrik object is already assigned to the provided SLA Domain. - A doc string using the docBlockr format. Visual Studio Code users can take advantage of the autoDocstring extension to simplify this process.
- Each API call made in the function should have a
self.log()
call made explaining what the API call is doing. The log message should be formated asfunction_name: message
. - A corresponding example in the
/rubrik-sdk-for-python/sample
directory named the same as the function_name. - Each function also must have associated documentation which can be autogenerated through
cd docs && python create_docs.py
Once a new function has been added you will then submit a new Pull Request which will be reviewed before merging into the devel
branch.