libcloud.compute.drivers.kamatera module
Kamatera node driver
- class libcloud.compute.drivers.kamatera.KamateraConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]
Bases:
ConnectionUserAndKey
Connection class for KamateraDriver
Initialize user_id and key; set secure to an
int
based on passed value.- responseCls
alias of
KamateraResponse
- class libcloud.compute.drivers.kamatera.KamateraNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]
Bases:
NodeDriver
Kamatera node driver
- Parameters:
key (
str
) – API Client ID, required for authenticationsecret (
str
) – API Secret, required for authentcaiontkey – API key or username to be used (required)
secret – Secret password to be used (required)
secure (
bool
) – Whether to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default.host (
str
) – Override hostname used for connections.port (
int
) – Override port used for connections.api_version (
str
) – Optional API version. Only used by drivers which support multiple API versions.region (
str
) – Optional driver region. Only used by drivers which support multiple regions.
- Return type:
None
- EX_BILLINGCYCLE_HOURLY = 'hourly'
- EX_BILLINGCYCLE_MONTHLY = 'monthly'
- connectionCls
alias of
KamateraConnection
- create_node(name, size, image, location, auth=None, ex_networks=None, ex_dailybackup=False, ex_managed=False, ex_billingcycle='hourly', ex_poweronaftercreate=True, ex_wait=True)[source]
Creates a Kamatera node.
If auth is not given then password will be generated.
- Parameters:
name (
str
) – String with a name for this new node (required)size (
NodeSize
) – The size of resources allocated to this node (required)image (
NodeImage
) – OS Image to boot on node. (required)location (
NodeLocation
) – Which data center to create a node in. (required)auth (
NodeAuthSSHKey
orNodeAuthPassword
) – Authentication information for the node (optional)ex_networks (
list
ofdict
) – Network configurations (optional)ex_dailybackup (
bool
) – Whether to create daily backups (optional)ex_managed (
bool
) – Whether to provide managed support (optional)ex_billingcycle (
str
) – billing cycle (hourly / monthly) (optional)ex_poweronaftercreate (
bool
) – power on after creation (optional)ex_wait (
bool
) – wait for server to be running (optional)
- Returns:
The newly created node.
- Return type:
- destroy_node(node, ex_wait=True)[source]
Destroy the given node
- Parameters:
node (
Node
) – the node to destroyex_wait (
bool
) – wait for destroy to complete (optional)
- Return type:
bool
- ex_get_command_status(command_id)[source]
Get Kamatera command status details
- Parameters:
command_id (
int
) – Command ID to get details for. (required)- Returns:
dict
- ex_get_location(id, name=None, country=None)[source]
Get a NodeLocation object to use for other methods
- Parameters:
id (
str
) – Location ID - uppercase letters code (required)name (
str
) – Location Name (optional)name – Location country (optional)
- Return type:
- ex_get_node(id=None, name=None, state=NodeState.UNKNOWN, public_ips=None, private_ips=None, size=None, image=None, created_at=None, location=None, dailybackup=None, managed=None, billingcycle=None, generated_password=None, create_command_id=None, poweronaftercreate=None)[source]
Get a Kamatera node object.
- Parameters:
id (
str
) – Node ID (optional)name (
str
) – Node name (optional)state (
libcloud.compute.types.NodeState
) – Node state (optional)public_ips (
list
of :str:) – Node public IPS. (optional)private_ips (
list
of :str:) – Node private IPS. (optional)size (
NodeSize
) – node size. (optional)image (
NodeImage
) – Node OS Image. (optional)created_at (
datetime.datetime
) – Node creation time. (optional)location (
NodeLocation
) – Node datacenter. (optional)dailybackup (
bool
) – create daily backups for the node (optional)managed (
bool
) – provide managed support for the node (optional)billingcycle (
str
) – billing cycle (hourly / monthly) (optional)generated_password (
str
) – server generated password (optional)create_command_id (
int
) – creation task command ID (optional)poweronaftercreate (
bool
) – power on the node after create (optional)
- Returns:
The node.
- Return type:
- ex_get_size(ramMB, diskSizeGB, cpuType, cpuCores, extraDiskSizesGB=None, monthlyTrafficPackage=None, id=None, name=None)[source]
Get a NodeSize object to use for other methods
- Parameters:
ramMB (
int
) – Amount of RAM to allocate in MB (required)diskSizeGB (
int
) – disk size GB for primary hard disk (required)cpuType (
str
) – CPU type ID (single uppercase letter), see ex_list_capabilities (required)cpuCores (
int
) – Number of CPU cores to allocate (required)extraDiskSizesGB (
list
of :int:) – additional disk sizes in GB (optional)monthlyTrafficPackage (
str
) – ID of monthly traffic package see ex_list_capabilities (optional)id (
str
) – Size ID (optional)name (
str
) – Size Name (optional)
- Return type:
- ex_list_capabilities(location)[source]
List capabilities for given location.
- Parameters:
location (
NodeLocation
) – Location of the deployment.- Returns:
dict
- ex_node_operation(node, operation, wait=True)[source]
Run custom operations on the node
- Parameters:
node (
Node
) – the node to run operation onoperation (
str
) – the operation to runex_wait (
bool
) – wait for destroy to complete (optional)
- Return type:
bool
- ex_wait_command(command_id, timeout_seconds=600, poll_interval_seconds=2)[source]
Wait for command to complete and return the command status details
- Parameters:
command_id (
int
) – Command ID to wait for. (required)timeout_seconds (
int
) – Max seconds to wait for command. (optional)poll_interval_seconds (
int
) – Poll interval in seconds (optional)
- Returns:
dict
- features: Dict[str, List[str]] = {'create_node': ['password', 'generates_password', 'ssh_key']}
- List of available features for a driver.
libcloud.compute.base.NodeDriver.create_node()
ssh_key: Supports
NodeAuthSSHKey
as an authentication method for nodes.password: Supports
NodeAuthPassword
as an authentication method for nodes.generates_password: Returns a password attribute on the Node object returned from creation.
- list_images(location)[source]
List available disk images.
- Parameters:
location (
NodeLocation
) – Location of the deployment. Available disk images depend on location.- Return type:
list
ofNodeImage
- list_nodes(ex_name_regex=None, ex_full_details=False, ex_id=None)[source]
List nodes
- Parameters:
ex_name_regex (
str
) – Regular expression to match node names if set returns full node details (optional)ex_full_details (
bool
) – Whether to return full node details takes longer to complete (optional)
- Returns:
List of node objects
- Return type:
list
ofNode
- list_sizes(location)[source]
List predefined sizes for the given location.
- Parameters:
location (
NodeLocation
) – Location of the deployment.
@inherits:
NodeDriver.list_sizes
- reboot_node(node, ex_wait=True)[source]
Reboot the given node
- Parameters:
node (
Node
) – the node to rebootex_wait (
bool
) – wait for reboot to complete (optional)
- Return type:
bool
- start_node(node, ex_wait=True)[source]
Start the given node
- Parameters:
node (
Node
) – the node to startex_wait (
bool
) – wait for start to complete (optional)
- Return type:
bool
- class libcloud.compute.drivers.kamatera.KamateraResponse(response, connection)[source]
Bases:
JsonResponse
Response class for KamateraDriver
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.