libcloud.compute.drivers.upcloud module
Upcloud node driver
- class libcloud.compute.drivers.upcloud.UpcloudConnection(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 UpcloudDriver
Initialize user_id and key; set secure to an
int
based on passed value.- responseCls
alias of
UpcloudResponse
- class libcloud.compute.drivers.upcloud.UpcloudDriver(username, password, **kwargs)[source]
Bases:
NodeDriver
Upcloud node driver
- Parameters:
username (
str
) – Username required for authenticationpassword (
str
) – Password required for authenticationkey (
str
) – API key or username to be used (required)secret (
str
) – 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
- NODE_STATE_MAP: Dict[str, NodeState] = {'error': NodeState.ERROR, 'maintenance': NodeState.RECONFIGURING, 'started': NodeState.RUNNING, 'stopped': NodeState.STOPPED}
- connectionCls
alias of
UpcloudConnection
- create_node(name, size, image, location, auth=None, ex_hostname='localhost', ex_username='root')[source]
Creates instance to upcloud.
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. If empty, undefined behavior will be selected. (optional)auth (
NodeAuthSSHKey
) – Initial authentication information for the node (optional)ex_hostname (
str
) – Hostname. Default is ‘localhost’. (optional)ex_username (
str
) – User’s username, which is created. Default is ‘root’. (optional)
- Returns:
The newly created node.
- Return type:
- destroy_node(node)[source]
Destroy the given node
The disk resources, attached to node, will not be removed.
- Parameters:
node (
Node
) – the node to destroy- Return type:
bool
- features: Dict[str, List[str]] = {'create_node': ['ssh_key', 'generates_password']}
- 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_sizes(location=None)[source]
List available plans
- Parameters:
location – Location of the deployment. Price depends on
location. lf location is not given or price not found for location, price will be None (optional) :type location:
NodeLocation
- Return type:
list
ofNodeSize
- class libcloud.compute.drivers.upcloud.UpcloudResponse(response, connection)[source]
Bases:
JsonResponse
Response class for UpcloudDriver
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.