Dome9 Api Client - Python SDK
Author - Udi-Yehuda Tamar [email protected]
This SDK implements a Python wrapper for the Dome9 API V2.
There are 2 API classes
Dome9ApiSDK - the backend implementation, used by the client class.
Dome9ApiClient - inherit from Dome9ApiSDK class + custom client methods
Both classes implement the same constructor.
-
Dome9 API APIkey and secret
-
Python v2.7 or later
-
Python modules:
-
json
-
requests
-
urlparse
-
Install the api wit pip: # pip install .
Currently, the SDK supports only Dome9 API V2.
There are two mandatory params
apiKeyID - Dome9 API key ID
apiSecret - Dome9 secret
To create an instance of the client class:
#!/usr/bin/env python
from dome9ApiV2Py import Dome9ApiClient d9client = Dome9ApiClient( apiKeyID='XXXXXXXXXXXXXXXX', apiSecret='XXXXXXXXXXXXXXXX') call = d9client.setCloudRegionsProtectedMode(ID='056162705707', protectionMode='ReadOnly', regions=['sa_east_1']) print(call) |
-
All methods by default return a python object or no value
-
outAsJson(bool) - optional param prints json (as string stdout) to the shell’s console.
These methods use the SDK methods (below) to perform complex operations
Task: set protection mode for a cloud region. If regions are specified, it will apply to these regions, otherwise on all the user’s regions.
Params:
Mandatory: ID(str), protectionMode(str) select from: 'ReadOnly', 'FullManage', 'Reset'
Optional: regions (list[])
Task: set protection mode of all attached security groups in a specific VPC
Params:
Mandatory: vpcID(str), protectionMode(str) select one from: 'ReadOnly', 'FullManage'
Optional: outAsJson
Task: set protection mode for all security groups in specific region
Params:
Mandatory: region(str), protectionMode(str) select one from: 'ReadOnly', 'FullManage'
Optional:
Task: gets security groups attached to a VPC
Params:
Mandatory: vpcName(str)
Optional:
Task: get all security groups in a region
Params:
Mandatory: region(str), names(bool)[output list of names]
Optional:
Task: get all security group IDs for a specific VPC
Params:
Mandatory: vpcID(str)
Optional:
Task: get all security group IDs for a specific account
Params:
Mandatory: cloudAccountID(str)
Optional:
Task: Return all dome9 users
Params:
Optional: outAsJson
Task: Return all cloud accounts
Params:
Optional: outAsJson
Task: Return a specific cloud account
Params:
Mandatory: ID(str)
Optional: outAsJson
Task: Return all user’s available regions
Params:
Mandatory: ID(str)
Optional: outAsJson
Task: update cloud account ID data
Params:
Mandatory: ID(str), data (object (dict))
Optional: outAsJson
Task: Return CloudTrail info
Params:
Optional: outAsJson
Task: get all AWS security groups
Params:
Mandatory:
Optional: outAsJson
Task: get one AWS security group
Params:
Mandatory: ID(str)
Optional: outAsJson
Task: set a single security group protection mode
Params:
Mandatory: ID(str), protectionMode(str)
Optional: outAsJson