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.

add_default_headers(headers)[source]

Adds headers that are needed for all requests

host: str = 'cloudcli.cloudwm.com'
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 authentication

  • secret (str) – API Secret, required for authentcaiont

  • key – 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 or NodeAuthPassword) – Authentication information for the node (optional)

  • ex_networks (list of dict) – 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:

Node

destroy_node(node, ex_wait=True)[source]

Destroy the given node

Parameters:
  • node (Node) – the node to destroy

  • ex_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_image(name=None, id=None, extra=None)[source]
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:

NodeLocation

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:

Node

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:

NodeLocation

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 on

  • operation (str) – the operation to run

  • ex_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.
list_images(location)[source]

List available disk images.

Parameters:

location (NodeLocation) – Location of the deployment. Available disk images depend on location.

Return type:

list of NodeImage

list_locations()[source]

List available locations for deployment

Return type:

list of NodeLocation

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 of Node

list_sizes(location)[source]

List predefined sizes for the given location.

Parameters:

location (NodeLocation) – Location of the deployment.

@inherits: NodeDriver.list_sizes

name: str = 'Kamatera'
reboot_node(node, ex_wait=True)[source]

Reboot the given node

Parameters:
  • node (Node) – the node to reboot

  • ex_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 start

  • ex_wait (bool) – wait for start to complete (optional)

Return type:

bool

stop_node(node, ex_wait=True)[source]

Stop the given node

Parameters:
  • node (Node) – the node to stop

  • ex_wait (bool) – wait for stop to complete (optional)

Return type:

bool

type: Provider | str = 'kamatera'
website: str = 'https://www.kamatera.com/'
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.

parse_error()[source]

Parse the error messages.

Override in a provider’s subclass.

Returns:

Parsed error.

Return type:

str