libcloud.compute.drivers.equinixmetal module¶
Equinix Metal Driver
- class libcloud.compute.drivers.equinixmetal.EquinixMetalConnection(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶
Bases:
ConnectionKey
Connection class for the Equinix Metal driver.
Initialize user_id and key; set secure to an
int
based on passed value.- responseCls¶
alias of
EquinixMetalResponse
- class libcloud.compute.drivers.equinixmetal.EquinixMetalNodeDriver(key, project=None)[source]¶
Bases:
NodeDriver
Equinix Metal NodeDriver
Initialize a NodeDriver for Equinix Metal using the API token and optionally the project (name or id).
If project name is specified we validate it lazily and populate self.project_id during the first access of self.projects variable
- NODE_STATE_MAP: Dict[str, NodeState] = {'active': NodeState.RUNNING, 'deleted': NodeState.TERMINATED, 'deprovisioning': NodeState.TERMINATED, 'failed': NodeState.ERROR, 'inactive': NodeState.STOPPED, 'powering_off': NodeState.REBOOTING, 'powering_on': NodeState.REBOOTING, 'provisioning': NodeState.PENDING, 'queued': NodeState.PENDING, 'rebooting': NodeState.REBOOTING, 'rebuilding': NodeState.PENDING}¶
- connectionCls¶
alias of
EquinixMetalConnection
- create_key_pair(name, public_key)[source]¶
Create a new SSH key.
- Parameters:
name (
str
) – Key name (required)public_key (
str
) – Valid public key string (required)
- create_node(name, size, image, location, ex_project_id=None, ip_addresses=None, cloud_init=None, **kwargs)[source]¶
Create a node.
- Returns:
The newly created node.
- Return type:
Node
- delete_key_pair(key)[source]¶
Delete an existing SSH key.
- Parameters:
key (
KeyPair
) – SSH key (required)
- destroy_node(node)[source]¶
Destroy a node.
Depending upon the provider, this may destroy all data associated with the node, including backups.
- Parameters:
node (
Node
) – The node to be destroyed- Returns:
True if the destroy was successful, False otherwise.
- Return type:
bool
- ex_describe_all_addresses_for_project(ex_project_id, include=None, only_associated=False)[source]¶
Returns all the reserved IP addresses for this project optionally, returns only addresses associated with nodes.
- Parameters:
only_associated (
bool
) – If true, return only the addresses that are associated with an instance.- Returns:
List of IP addresses.
- Return type:
list
ofdict
- ex_request_address_reservation(ex_project_id, location_id=None, address_family='global_ipv4', quantity=1, comments='', customdata='')[source]¶
- list_images()[source]¶
List images on a provider.
- Parameters:
location (
NodeLocation
) – The location at which to list images.- Returns:
list of node image objects.
- Return type:
list
ofNodeImage
- list_key_pairs()[source]¶
List all the available SSH keys.
- Returns:
Available SSH keys.
- Return type:
list
ofKeyPair
objects
- list_locations()[source]¶
List data centers for a provider
- Returns:
list of node location objects
- Return type:
list
ofNodeLocation
- list_nodes(ex_project_id=None)[source]¶
List all nodes.
- Returns:
list of node objects
- Return type:
list
ofNode
- list_sizes(ex_project_id=None)[source]¶
List sizes on a provider
- Parameters:
location (
NodeLocation
) – The location at which to list sizes- Returns:
list of node size objects
- Return type:
list
ofNodeSize
- property projects¶
Lazily retrieve projects and set self.project_id variable on initial access to self.projects variable.
- reboot_node(node)[source]¶
Reboot a node.
- Parameters:
node (
Node
) – The node to be rebooted- Returns:
True if the reboot was successful, otherwise False
- Return type:
bool
- start_node(node)[source]¶
Start a node.
- Parameters:
node (
Node
) – The node to be started- Returns:
True if the start was successful, otherwise False
- Return type:
bool
- class libcloud.compute.drivers.equinixmetal.EquinixMetalResponse(response, connection)[source]¶
Bases:
JsonResponse
- 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
- success()[source]¶
Determine if our request was successful.
The meaning of this can be arbitrary; did we receive OK status? Did the node get created? Were we authenticated?
- Return type:
bool
- Returns:
True
orFalse
- valid_response_codes = [<HTTPStatus.OK: 200>, <HTTPStatus.ACCEPTED: 202>, <HTTPStatus.CREATED: 201>, <HTTPStatus.NO_CONTENT: 204>]¶