libcloud.compute.drivers package

Submodules

libcloud.compute.drivers.abiquo module

Abiquo Compute Driver

The driver implements the compute Abiquo functionality for the Abiquo API. This version is compatible with the following versions of Abiquo:

class libcloud.compute.drivers.abiquo.AbiquoNodeDriver(user_id, secret, endpoint, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Implements the NodeDriver’s for the Abiquo Compute Provider

Initializes Abiquo Driver

Initializes the NodeDriver object and populate the cache.

Parameters:
  • user_id (str) – identifier of Abiquo user (required)
  • secret (str) – password of the Abiquo user (required)
  • endpoint (str that can be parsed as URL) – Abiquo API endpoint (required)
AR_MIME_TYPE = 'application/vnd.abiquo.acceptedrequest+xml'
DCRS_MIME_TYPE = 'application/vnd.abiquo.datacenterrepositories+xml'
DCR_MIME_TYPE = 'application/vnd.abiquo.datacenterrepository+xml'
DCS_MIME_TYPE = 'application/vnd.abiquo.datacenters+xml'
ENT_MIME_TYPE = 'application/vnd.abiquo.enterprise+xml'
GIGABYTE = 1073741824
NICS_MIME_TYPE = 'application/vnd.abiquo.nics+xml'
NODES_MIME_TYPE = 'application/vnd.abiquo.virtualmachines+xml'
NODE_MIME_TYPE = 'application/vnd.abiquo.virtualmachine+xml'
USER_MIME_TYPE = 'application/vnd.abiquo.user+xml'
VAPPS_MIME_TYPE = 'application/vnd.abiquo.virtualappliances+xml'
VAPP_MIME_TYPE = 'application/vnd.abiquo.virtualappliance+xml'
VDCS_MIME_TYPE = 'application/vnd.abiquo.virtualdatacenters+xml'
VDC_MIME_TYPE = 'application/vnd.abiquo.virtualdatacenter+xml'
VMTPLS_MIME_TYPE = 'application/vnd.abiquo.virtualmachinetemplates+xml'
VMTPL_MIME_TYPE = 'application/vnd.abiquo.virtualmachinetemplate+xml'
VM_TASK_MIME_TYPE = 'application/vnd.abiquo.virtualmachinetask+xml'
connectionCls

alias of libcloud.common.abiquo.AbiquoConnection

create_node(image, name=None, size=None, location=None, ex_group_name=None)[source]

Create a new node instance in Abiquo

All the Node`s need to be defined inside a VirtualAppliance (called :class:`NodeGroup here). If there is no group name defined, ‘libcloud’ name will be used instead.

This method wraps these Abiquo actions:

  1. Create a group if it does not exist.
  2. Register a new node in the group.
  3. Deploy the node and boot it.
  4. Retrieves it again to get schedule-time attributes (such as ips and vnc ports).

The rest of the driver methods has been created in a way that, if any of these actions fail, the user can not reach an inconsistent state

Parameters:
  • name (str) – The name for this new node (required)
  • size (NodeSize) – The size of resources allocated to this node.
  • 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)
  • ex_group_name (c{str}) – Which group this node belongs to. If empty, it will be created into ‘libcloud’ group. If it does not found any group in the target location (random location if you have not set the parameter), then it will create a new group with this name.
Returns:

The newly created node.

Return type:

Node

destroy_node(node)[source]

Destroy a node

Depending on 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, otherwise False
Return type:bool
ex_create_group(name, location=None)[source]

Create an empty group.

You can specify the location as well.

Parameters:
  • group (str) – name of the group (required)
  • location (NodeLocation) – location were to create the group
Returns:

the created group

Return type:

NodeGroup

ex_destroy_group(group)[source]

Destroy a group.

Be careful! Destroying a group means destroying all the Node instances there and the group itself!

If there is currently any action over any Node of the NodeGroup, then the method will raise an exception.

Parameters:name (NodeGroup) – The group (required)
Returns:If the group was destroyed successfully
Return type:bool
ex_list_groups(location=None)[source]

List all groups.

Parameters:location (a NodeLocation instance.) – filter the groups by location (optional)
Returns:the list of NodeGroup
ex_populate_cache()[source]

Populate the cache.

For each connection, it is good to store some objects that will be useful for further requests, such as the ‘user’ and the ‘enterprise’ objects.

Executes the ‘login’ resource after setting the connection parameters and, if the execution is successful, it sets the ‘user’ object into cache. After that, it also requests for the ‘enterprise’ and ‘locations’ data.

List of locations should remain the same for a single libcloud connection. However, this method is public and you are able to refresh the list of locations any time.

ex_run_node(node)[source]

Runs a node

Here there is a bit difference between Abiquo states and libcloud states, so this method is created to have better compatibility. In libcloud, if the node is not running, then it does not exist (avoiding UNKNOWN and temporal states). In Abiquo, you can define a node, and then deploy it.

If the node is in NodeState.TERMINATED libcloud’s state and in ‘NOT_DEPLOYED’ Abiquo state, there is a way to run and recover it for libcloud using this method. There is no way to reach this state if you are using only libcloud, but you may have used another Abiquo client and now you want to recover your node to be used by libcloud.

Parameters:node (Node) – The node to run
Returns:The node itself, but with the new state
Return type:Node
list_images(location=None)[source]

List images on Abiquo Repositories

Parameters:location (NodeLocation) – The location to list images for.
Returns:list of node image objects
Return type:list of NodeImage
list_locations()[source]

Return list of locations where the user has access to.

Returns:the list of NodeLocation available for the current user
Return type:list of NodeLocation
list_nodes(location=None)[source]

List all nodes.

Parameters:location (a NodeLocation instance.) – Filter the groups by location (optional)
Returns:List of node objects
Return type:list of Node
list_sizes(location=None)[source]

List sizes on a provider.

Abiquo does not work with sizes. However, this method returns a list of predefined ones (copied from DummyNodeDriver but without price neither bandwidth) to help the users to create their own.

If you call the method AbiquoNodeDriver.create_node with the size informed, it will just override the ‘ram’ value of the ‘image’ template. So it is no too much useful work with sizes…

Returns:The list of sizes
Return type:list of NodeSizes
name = 'Abiquo'
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
timeout = 2000
type = 'abiquo'
website = 'http://www.abiquo.com/'
class libcloud.compute.drivers.abiquo.NodeGroup(driver, name='libcloud', nodes=[], uri='')[source]

Bases: object

Group of virtual machines that can be managed together

All Node`s in Abiquo must be defined inside a Virtual Appliance. We offer a way to handle virtual appliances (called NodeGroup to maintain some kind of name conventions here) inside the :class:`AbiquoNodeDriver without breaking compatibility of the rest of libcloud API.

If the user does not want to handle groups, all the virtual machines will be created inside a group named ‘libcloud’

Initialize a new group object.

DEFAULT_GROUP_NAME = 'libcloud'
destroy()[source]

Destroys the group delegating the execution to AbiquoNodeDriver.

libcloud.compute.drivers.auroracompute module

class libcloud.compute.drivers.auroracompute.AuroraComputeRegion[source]

Bases: object

AMS = 'Amsterdam'
BCN = 'Barcelona'
LAX = 'Los Angeles'
MIA = 'Miami'
RTD = 'Rotterdam'
TYO = 'Tokyo'
class libcloud.compute.drivers.auroracompute.AuroraComputeNodeDriver(key, secret, path=None, host=None, url=None, region=None)[source]

Bases: libcloud.compute.drivers.cloudstack.CloudStackNodeDriver

name = 'PCextreme AuroraCompute'
type = 'aurora_compute'
website = 'https://www.pcextreme.com/aurora/compute'

libcloud.compute.drivers.azure module

Driver for Microsoft Azure Virtual Machines service.

http://azure.microsoft.com/en-us/services/virtual-machines/

class libcloud.compute.drivers.azure.AsynchronousOperationResult(request_id=None)[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.AttachedTo[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.AvailabilityResponse[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.AzureHTTPRequest[source]

Bases: object

class libcloud.compute.drivers.azure.AzureHTTPResponse(status, message, headers, body)[source]

Bases: object

class libcloud.compute.drivers.azure.AzureKeyPair(fingerprint='', path='')[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.AzureNodeDriver(subscription_id=None, key_file=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

subscription_id contains the Azure subscription id in the form of GUID key_file contains the Azure X509 certificate in .pem form

NODE_STATE_MAP = {'BusyRole': pending, 'CreatingRole': pending, 'CreatingVM': pending, 'CyclingRole': terminated, 'DeletingVM': pending, 'FailedStartingRole': terminated, 'FailedStartingVM': terminated, 'Provisioning': pending, 'ReadyRole': running, 'RestartingRole': rebooting, 'RoleStateUnknown': unknown, 'StartingRole': pending, 'StartingVM': pending, 'StoppedDeallocated': terminated, 'StoppedVM': stopped, 'StoppingRole': pending, 'StoppingVM': pending, 'UnresponsiveRole': terminated}
attach_volume()[source]

Attaches volume to node.

Parameters:
  • node (Node) – Node to attach volume to.
  • volume (StorageVolume) – Volume to attach.
  • device (str) – Where the device is exposed, e.g. ‘/dev/sdb’
Rytpe:

bool

connectionCls

alias of libcloud.common.azure.AzureServiceManagementConnection

create_node(name, size, image, ex_cloud_service_name, ex_storage_service_name=None, ex_new_deployment=False, ex_deployment_slot='Production', ex_deployment_name=None, ex_admin_user_id='azureuser', ex_custom_data=None, ex_virtual_network_name=None, ex_network_config=None, auth=None, **kwargs)[source]

Create Azure Virtual Machine

Reference: http://bit.ly/1fIsCb7 [www.windowsazure.com/en-us/documentation/]

We default to:

  • 3389/TCP - RDP - 1st Microsoft instance.
  • RANDOM/TCP - RDP - All succeeding Microsoft instances.
  • 22/TCP - SSH - 1st Linux instance
  • RANDOM/TCP - SSH - All succeeding Linux instances.

The above replicates the standard behavior of the Azure UI. You can retrieve the assigned ports to each instance by using the following private function:

_get_endpoint_ports(service_name) Returns public,private port key pair.

@inherits: NodeDriver.create_node

Parameters:
  • image (NodeImage) – The image to use when creating this node
  • size (NodeSize) – The size of the instance to create
  • ex_cloud_service_name (str) – Required. Name of the Azure Cloud Service.
  • ex_storage_service_name (str) – Optional: Name of the Azure Storage Service.
  • ex_new_deployment (boolean) – Optional. Tells azure to create a new deployment rather than add to an existing one.
  • ex_deployment_slot (str) – Optional: Valid values: production| staging. Defaults to production.
  • ex_deployment_name (str) – Optional. The name of the deployment. If this is not passed in we default to using the Cloud Service name.
  • ex_custom_data (str) – Optional script or other data which is injected into the VM when it’s beginning provisioned.
  • ex_admin_user_id (str) – Optional. Defaults to ‘azureuser’.
  • ex_virtual_network_name (str) – Optional. If this is not passed in no virtual network is used.
  • ex_network_config (ConfigurationSet) – Optional. The ConfigurationSet to use for network configuration
create_volume()[source]

Create a new volume.

Parameters:
  • size (int) – Size of volume in gigabytes (required)
  • name (str) – Name of the volume to be created
  • location (NodeLocation) – Which data center to create a volume in. If empty, undefined behavior will be selected. (optional)
  • snapshot (VolumeSnapshot) – Snapshot from which to create the new volume. (optional)
Returns:

The newly created volume.

Return type:

StorageVolume

create_volume_snapshot()[source]

Creates a snapshot of the storage volume.

Parameters:
  • volume (StorageVolume) – The StorageVolume to create a VolumeSnapshot from
  • name (str) – Name of created snapshot (optional)
Return type:

VolumeSnapshot

destroy_node(node, ex_cloud_service_name=None, ex_deployment_slot='Production')[source]

Remove Azure Virtual Machine

This removes the instance, but does not remove the disk. You will need to use destroy_volume. Azure sometimes has an issue where it will hold onto a blob lease for an extended amount of time.

Parameters:
  • ex_cloud_service_name (str) – Required. Name of the Azure Cloud Service.
  • ex_deployment_slot (str) – Optional: The name of the deployment slot. If this is not passed in we default to production.
destroy_volume()[source]

Destroys a storage volume.

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
detach_volume()[source]

Detaches a volume from a node.

Parameters:volume (StorageVolume) – Volume to be detached
Return type:bool
ex_add_instance_endpoints(node, endpoints, ex_deployment_slot='Production')[source]
ex_create_cloud_service(name, location, description=None, extended_properties=None)[source]

Create an azure cloud service.

Parameters:
  • name (str) – Name of the service to create
  • location (str) – Standard azure location string
  • description (str) – Optional description
  • extended_properties (dict) – Optional extended_properties
Return type:

bool

ex_create_storage_service(name, location, description=None, affinity_group=None, extended_properties=None)[source]

Create an azure storage service.

Parameters:
  • name (str) – Name of the service to create
  • location (str) – Standard azure location string
  • description (str) – (Optional) Description of storage service.
  • affinity_group (str) – (Optional) Azure affinity group.
  • extended_properties (dict) – (Optional) Additional configuration options support by Azure.
Return type:

bool

ex_destroy_cloud_service(name)[source]

Delete an azure cloud service.

Parameters:name (str) – Name of the cloud service to destroy.
Return type:bool
ex_destroy_storage_service(name)[source]

Destroy storage service. Storage service must not have any active blobs. Sometimes Azure likes to hold onto volumes after they are deleted for an inordinate amount of time, so sleep before calling this method after volume deletion.

Parameters:name (str) – Name of storage service.
Return type:bool
ex_list_cloud_services()[source]
ex_set_instance_endpoints(node, endpoints, ex_deployment_slot='Production')[source]

For example:

endpoint = ConfigurationSetInputEndpoint(
    name='SSH',
    protocol='tcp',
    port=port,
    local_port='22',
    load_balanced_endpoint_set_name=None,
    enable_direct_server_return=False
)
{
    'name': 'SSH',
    'protocol': 'tcp',
    'port': port,
    'local_port': '22'
}
features = {'create_node': ['password']}
list_images(location=None)[source]

Lists all images

Return type:list of NodeImage
list_locations()[source]

Lists all locations

Return type:list of NodeLocation
list_nodes(ex_cloud_service_name)[source]

List all nodes

ex_cloud_service_name parameter is used to scope the request to a specific Cloud Service. This is a required parameter as nodes cannot exist outside of a Cloud Service nor be shared between a Cloud Service within Azure.

Parameters:ex_cloud_service_name (str) – Cloud Service name
Return type:list of Node
list_sizes()[source]

Lists all sizes

Return type:list of NodeSize
list_volumes(node=None)[source]

Lists volumes of the disks in the image repository that are associated with the specified subscription.

Pass Node object to scope the list of volumes to a single instance.

Return type:list of StorageVolume
name = 'Azure Virtual machines'
raise_for_response(response, valid_response)[source]
reboot_node(node, ex_cloud_service_name=None, ex_deployment_slot=None)[source]

Reboots a node.

ex_cloud_service_name parameter is used to scope the request to a specific Cloud Service. This is a required parameter as nodes cannot exist outside of a Cloud Service nor be shared between a Cloud Service within Azure.

Parameters:
  • ex_cloud_service_name (str) – Cloud Service name
  • ex_deployment_slot (str) – Options are “production” (default) or “Staging”. (Optional)
Return type:

bool

class service_location(is_affinity_group, service_location)

Bases: tuple

Create new instance of service_location(is_affinity_group, service_location)

is_affinity_group

Alias for field number 0

service_location

Alias for field number 1

type = 'azure'
website = 'http://azure.microsoft.com/en-us/services/virtual-machines/'
class libcloud.compute.drivers.azure.AzureNodeLocation(id, name, country, driver, available_services, virtual_machine_role_sizes)[source]

Bases: libcloud.compute.base.NodeLocation

class libcloud.compute.drivers.azure.AzureXmlSerializer[source]

Bases: object

static add_role_to_xml(role_name, system_configuration_set, os_virtual_hard_disk, role_type, network_configuration_set, availability_set_name, data_virtual_hard_disks, vm_image_name, role_size)[source]
static capture_role_to_xml(post_capture_action, target_image_name, target_image_label, provisioning_configuration)[source]
static certificate_file_to_xml(data, certificate_format, password)[source]
static change_deployment_to_xml(configuration, treat_warnings_as_error, mode, extended_properties)[source]
static create_affinity_group_to_xml(name, label, description, location)[source]
static create_deployment_to_xml(name, package_url, label, configuration, start_deployment, treat_warnings_as_error, extended_properties)[source]
static create_hosted_service_to_xml(service_name, label, description, location, affinity_group=None, extended_properties=None)[source]
static create_storage_service_input_to_xml(service_name, description, label, affinity_group, location, geo_replication_enabled, extended_properties)[source]
static create_storage_service_to_xml(service_name, label, description, location, affinity_group, extended_properties=None)[source]
static data_to_xml(data, xml=None)[source]
Creates an xml fragment from the specified data.
data: Array of tuples, where first: xml element name
second: xml element text third: conversion function
static data_virtual_hard_disk_to_xml(host_caching, disk_label, disk_name, lun, logical_disk_size_in_gb, media_link, source_media_link)[source]
static disk_to_xml(has_operating_system, label, media_link, name, os)[source]
static doc_from_data(document_element_name, data, extended_properties=None)[source]
static doc_from_xml(document_element_name, inner_xml=None)[source]

Wraps the specified xml in an xml root element with default azure namespaces

static extended_properties_dict_to_xml_fragment(extended_properties)[source]
static linux_configuration_to_xml(configuration, xml)[source]
static network_configuration_to_xml(configuration, xml)[source]
static os_image_to_xml(label, media_link, name, os)[source]
static regenerate_keys_to_xml(key_type)[source]
static restart_role_operation_to_xml()[source]
static role_to_xml(availability_set_name, data_virtual_hard_disks, network_configuration_set, os_virtual_hard_disk, vm_image_name, role_name, role_size, role_type, system_configuration_set, xml)[source]
static rollback_upgrade_to_xml(mode, force)[source]
static shutdown_role_operation_to_xml()[source]
static start_role_operation_to_xml()[source]
static subscription_certificate_to_xml(public_key, thumbprint, data)[source]
static swap_deployment_to_xml(production, source_deployment)[source]
static update_affinity_group_to_xml(label, description)[source]
static update_deployment_status_to_xml(status)[source]
static update_hosted_service_to_xml(label, description, extended_properties)[source]
static update_role_to_xml(role_name, os_virtual_hard_disk, role_type, network_configuration_set, availability_set_name, data_virtual_hard_disks, vm_image_name, role_size)[source]
static update_storage_service_input_to_xml(description, label, geo_replication_enabled, extended_properties)[source]
static upgrade_deployment_to_xml(mode, package_url, configuration, label, role_to_upgrade, force, extended_properties)[source]
static virtual_machine_deployment_to_xml(deployment_name, deployment_slot, label, role_name, system_configuration_set, os_virtual_hard_disk, role_type, network_configuration_set, availability_set_name, data_virtual_hard_disks, role_size, virtual_network_name, vm_image_name)[source]
static walk_upgrade_domain_to_xml(upgrade_domain)[source]
static windows_configuration_to_xml(configuration, xml)[source]
class libcloud.compute.drivers.azure.CertificateSetting(thumbprint='', store_name='', store_location='')[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

Initializes a certificate setting.

thumbprint:
Specifies the thumbprint of the certificate to be provisioned. The thumbprint must specify an existing service certificate.
store_name:
Specifies the name of the certificate store from which retrieve certificate.
store_location:
Specifies the target certificate store location on the virtual machine The only supported value is LocalMachine.
class libcloud.compute.drivers.azure.ComputeCapability[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.ConfigurationSet[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.ConfigurationSetInputEndpoint(name='', protocol='', port='', local_port='', load_balanced_endpoint_set_name='', enable_direct_server_return=False)[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.ConfigurationSetInputEndpoints[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of ConfigurationSetInputEndpoint

xml_element_name = 'InputEndpoint'
class libcloud.compute.drivers.azure.ConfigurationSets[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of ConfigurationSet

class libcloud.compute.drivers.azure.Credentials[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.Deployment[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.Deployments[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of Deployment

class libcloud.compute.drivers.azure.Disk[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.Disks[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of Disk

class libcloud.compute.drivers.azure.DomainJoin[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.HostedService[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData, libcloud.utils.misc.ReprMixin

class libcloud.compute.drivers.azure.HostedServiceProperties[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.HostedServices[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList, libcloud.utils.misc.ReprMixin

list_type

alias of HostedService

class libcloud.compute.drivers.azure.Images[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of OSImage

class libcloud.compute.drivers.azure.InputEndpoint[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.InputEndpoints[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of InputEndpoint

class libcloud.compute.drivers.azure.InstanceEndpoint[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.InstanceEndpoints[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of InstanceEndpoint

class libcloud.compute.drivers.azure.KeyPairs[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of AzureKeyPair

class libcloud.compute.drivers.azure.LinuxConfigurationSet(host_name=None, user_name=None, user_password=None, disable_ssh_password_authentication=None, custom_data=None)[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.LoadBalancerProbe[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.Location[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.Locations[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of Location

class libcloud.compute.drivers.azure.OSDiskConfiguration[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.OSImage[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.OSVirtualHardDisk(source_image_name=None, media_link=None, host_caching=None, disk_label=None, disk_name=None)[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.OperatingSystem[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.OperatingSystemFamilies[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of OperatingSystemFamily

class libcloud.compute.drivers.azure.OperatingSystemFamily[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.OperatingSystems[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of OperatingSystem

class libcloud.compute.drivers.azure.Operation[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.OperationError[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.PersistentVMDowntimeInfo[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.PublicKey(fingerprint='', path='')[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.PublicKeys[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of PublicKey

class libcloud.compute.drivers.azure.Role[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.RoleInstance[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.RoleInstanceList[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of RoleInstance

class libcloud.compute.drivers.azure.RoleList[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of Role

class libcloud.compute.drivers.azure.SSH[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.ScalarListOf(list_type, xml_element_name)[source]

Bases: list

A list of scalar types which carries with it the type that’s expected to go in it along with its xml element name. Used for deserializaion and construction of the lists

class libcloud.compute.drivers.azure.StoredCertificateSettings[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of CertificateSetting

class libcloud.compute.drivers.azure.Subscription[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.SubscriptionCertificate[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.SubscriptionCertificates[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of SubscriptionCertificate

class libcloud.compute.drivers.azure.UpgradeStatus[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.VMImage[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.VMImages[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of VMImage

class libcloud.compute.drivers.azure.VirtualIP[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

class libcloud.compute.drivers.azure.VirtualIPs[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureDataTypedList

list_type

alias of VirtualIP

class libcloud.compute.drivers.azure.VirtualMachinesRoleSizes[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

libcloud.compute.drivers.azure.WINDOWS_SERVER_REGEX = re.compile('Win|SQL|SharePoint|Visual|Dynamics|DynGP|BizTalk')

Sizes must be hardcoded because Microsoft doesn’t provide an API to fetch them From http://msdn.microsoft.com/en-us/library/windowsazure/dn197896.aspx

Prices are for Linux instances in East US data center. To see what pricing will actually be, visit: http://azure.microsoft.com/en-gb/pricing/details/virtual-machines/

class libcloud.compute.drivers.azure.WindowsAzureData[source]

Bases: object

This is the base of data class. It is only used to check whether it is instance or not.

class libcloud.compute.drivers.azure.WindowsAzureDataTypedList[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

list_type = None
xml_element_name = None
class libcloud.compute.drivers.azure.WindowsConfigurationSet(computer_name=None, admin_password=None, reset_password_on_first_logon=None, enable_automatic_updates=None, time_zone=None, admin_user_name=None)[source]

Bases: libcloud.compute.drivers.azure.WindowsAzureData

libcloud.compute.drivers.azure_arm module

Driver for Microsoft Azure Resource Manager (ARM) Virtual Machines provider.

http://azure.microsoft.com/en-us/services/virtual-machines/

class libcloud.compute.drivers.azure_arm.AzureComputeGalleryImage(subscription_id, resource_group, gallery, name, driver)[source]

Bases: libcloud.compute.base.NodeImage

Represents a Compute Gallery image that an Azure VM can boot from.

class libcloud.compute.drivers.azure_arm.AzureIPAddress(id, name, extra)[source]

Bases: object

Represents an Azure public IP address resource.

class libcloud.compute.drivers.azure_arm.AzureImage(version, sku, offer, publisher, location, driver)[source]

Bases: libcloud.compute.base.NodeImage

Represents a Marketplace node image that an Azure VM can boot from.

class libcloud.compute.drivers.azure_arm.AzureNetwork(id, name, location, extra)[source]

Bases: object

Represent an Azure virtual network.

class libcloud.compute.drivers.azure_arm.AzureNetworkSecurityGroup(id, name, location, extra)[source]

Bases: object

Represent an Azure network security group.

class libcloud.compute.drivers.azure_arm.AzureNic(id, name, location, extra)[source]

Bases: object

Represents an Azure virtual network interface controller (NIC).

class libcloud.compute.drivers.azure_arm.AzureNodeDriver(tenant_id, subscription_id, key, secret, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Compute node driver for Azure Resource Manager.

SNAPSHOT_STATE_MAP = {'creating': creating, 'failed': error, 'succeeded': available, 'updating': updating}
attach_volume(node, volume, ex_lun=None, ex_vhd_uri=None, ex_vhd_create=False, **ex_kwargs)[source]

Attach a volume to node.

Parameters:
  • node (Node) – A node to attach volume.
  • volume (StorageVolume) – A volume to attach.
  • ex_lun (int) – Specifies the logical unit number (LUN) location for the data drive in the virtual machine. Each data disk must have a unique LUN.
  • ex_vhd_uri (str) – Attach old-style unmanaged disk from VHD blob. (optional)
  • ex_vhd_create (bool) – Create a new VHD blob for unmanaged disk. (optional)
Return type:

bool

connectionCls

alias of libcloud.common.azure_arm.AzureResourceManagementConnection

create_node(name, size, image, auth, ex_resource_group, ex_storage_account=None, ex_blob_container='vhds', location=None, ex_user_name='azureuser', ex_network=None, ex_subnet=None, ex_nic=None, ex_tags={}, ex_customdata='', ex_use_managed_disks=False, ex_disk_size=None, ex_storage_account_type='Standard_LRS', ex_os_disk_delete=False)[source]

Create a new node instance. This instance will be started automatically.

This driver supports the ssh_key feature flag for created_node so you can upload a public key into the new instance:

>>> from libcloud.compute.drivers.azure_arm import AzureNodeDriver
>>> driver = AzureNodeDriver(...)
>>> auth = NodeAuthSSHKey('pubkey data here')
>>> node = driver.create_node("test_node", auth=auth)

This driver also supports the password feature flag for create_node so you can set a password:

>>> driver = AzureNodeDriver(...)
>>> auth = NodeAuthPassword('mysecretpassword')
>>> node = driver.create_node("test_node", auth=auth, ...)

If you don’t provide the auth argument libcloud will assign a password:

>>> driver = AzureNodeDriver(...)
>>> node = driver.create_node("test_node", ...)
>>> password = node.extra["properties"]                            ["osProfile"]["adminPassword"]
Parameters:
  • name (str) – String with a name for this new node (required)
  • size (NodeSize) – The size of resources allocated to this node. (required)
  • image (AzureImage or AzureVhdImage or AzureComputeGalleryImage) – OS Image to boot on node (required)
  • location – Which data center to create a node in.

(if None, use default location specified as ‘region’ in __init__) :type location: NodeLocation

Parameters:
  • auth (NodeAuthSSHKey or NodeAuthPassword) – Initial authentication information for the node (optional)
  • ex_resource_group – The resource group in which to create the

node :type ex_resource_group: str

Parameters:ex_storage_account – The storage account id in which to store

the node’s disk image. Note: when booting from a user image (AzureVhdImage) the source image and the node image must use the same storage account. :type ex_storage_account: str

Parameters:ex_blob_container – The name of the blob container on the

storage account in which to store the node’s disk image (optional, default “vhds”) :type ex_blob_container: str

Parameters:ex_user_name – User name for the initial admin user

(optional, default “azureuser”) :type ex_user_name: str

Parameters:ex_network – The virtual network the node will be attached to.

Must provide either ex_network (to create a default NIC for the node on the given network) or ex_nic (to supply the NIC explicitly). :type ex_network: str

Parameters:ex_subnet – If ex_network is provided, the subnet of the

virtual network the node will be attached to. Optional, default is the “default” subnet. :type ex_subnet: str

Parameters:ex_nic – A virtual NIC to attach to this Node, from

ex_create_network_interface or ex_get_nic. Must provide either ex_nic (to supply the NIC explicitly) or ex_network (to create a default NIC for the node on the given network). :type ex_nic: AzureNic

Parameters:
  • ex_tags (dict) – Optional tags to associate with this node.
  • ex_customdata (str) – Custom data that will be placed in the file /var/lib/waagent/CustomData https://azure.microsoft.com/en-us/documentation/ articles/virtual-machines-how-to-inject-custom-data/
  • ex_use_managed_disks (bool) – Enable this feature to have Azure automatically manage the availability of disks to provide data redundancy and fault tolerance, without creating and managing storage accounts on your own. Managed disks may not be available in all regions (default False).
  • ex_disk_size (int) – Custom OS disk size in GB
  • ex_storage_account_type (str) – The Storage Account type, ``Standard_LRS``(HDD disks) or ``Premium_LRS``(SSD disks).
  • ex_os_disk_delete (bool) – Enable this feature to have Azure automatically delete the OS disk when you delete the VM.
Returns:

The newly created node.

Return type:

Node

create_volume(size, name, location=None, snapshot=None, ex_resource_group=None, ex_sku_name=None, ex_tags=None, ex_zones=None, ex_iops=None, ex_throughput=None)[source]

Create a new managed volume.

Parameters:
  • size (int) – Size of volume in gigabytes.
  • name (str) – Name of the volume to be created.
  • location (NodeLocation) – Which data center to create a volume in. (required)
  • snapshot (VolumeSnapshot) – Snapshot from which to create the new volume.
  • ex_resource_group (str) – The name of resource group in which to create the volume. (required)
  • ex_sku_name (str) – The Disk SKU name. Refer to the API reference for options.
  • ex_tags (dict) – Optional tags to associate with this resource.
  • ex_zones (list of str) – The list of availability zones to create the volume in. Options are any or all of [“1”, “2”, “3”]. (optional)
  • ex_iops (int) – The max IOPS this volume is capable of.
  • ex_throughput (int) – The max throughput of this volume in MBps.
Returns:

The newly created volume.

Return type:

StorageVolume

create_volume_snapshot(volume, name=None, location=None, ex_resource_group=None, ex_tags=None)[source]

Create snapshot from volume.

Parameters:
  • volume (:class`StorageVolume`) – Instance of StorageVolume.
  • name (str) – Name of snapshot. (required)
  • location (NodeLocation) – Which data center to create a volume in. (required)
  • ex_resource_group (str) – The name of resource group in which to create the snapshot. (required)
  • ex_tags (dict) – Optional tags to associate with this resource.
Return type:

VolumeSnapshot

destroy_node(node, ex_destroy_nic=True, ex_destroy_vhd=True, ex_poll_qty=10, ex_poll_wait=10)[source]

Destroy a node.

Parameters:
  • node (Node) – The node to be destroyed
  • ex_destroy_nic – Destroy the NICs associated with

this node (default True). :type node: bool

Parameters:ex_destroy_vhd – Destroy the OS disk blob associated with

this node (default True). :type node: bool

Parameters:ex_poll_qty – Number of retries checking if the node

is gone, destroying the NIC or destroying the VHD (default 10). :type node: int

Parameters:ex_poll_wait – Delay in seconds between retries (default 10).
Returns:True if the destroy was successful, raises exception

otherwise. :rtype: bool

destroy_volume(volume)[source]

Delete a volume.

destroy_volume_snapshot(snapshot)[source]

Delete a snapshot.

detach_volume(volume, ex_node=None)[source]

Detach a managed volume from a node.

ex_check_ip_address_availability(resource_group, network, ip_address)[source]

Checks whether a private IP address is available for use. Also returns an object that contains the available IPs in the subnet.

Parameters:
  • resource_group (str) – The resource group to check the ip address in.
  • network (AzureNetwork) – The virtual network.
  • ip_address (str) – The private IP address to be verified.
ex_create_additional_capabilities(node, additional_capabilities, resource_group)[source]

Set the additional capabilities on a stopped node.

Parameters:
  • node (Node) – The node to be updated
  • ex_additional_capabilities (dict) – Optional additional capabilities allowing Ultra SSD and hibernation on this node.
  • resource_group (str) – The resource group of the node to be updated
Returns:

True if the update was successful, otherwise False

Return type:

bool

ex_create_network_interface(name, subnet, resource_group, location=None, public_ip=None)[source]

Create a virtual network interface (NIC).

Parameters:
  • name (str) – Name of the NIC resource
  • subnet (AzureSubnet) – The subnet to attach the NIC
  • resource_group (str) – The resource group to create the NIC
  • location – The location at which to create the NIC

(if None, use default location specified as ‘region’ in __init__) :type location: NodeLocation

Parameters:public_ip – Associate a public IP resource with this NIC

(optional). :type public_ip: AzureIPAddress

Returns:The newly created NIC
Return type:AzureNic
ex_create_network_security_group(name, resource_group, location=None)[source]

Update tags on any resource supporting tags.

Parameters:
  • name (str) – Name of the network security group to create
  • resource_group – The resource group to create the network

security group in :type resource_group: str

Parameters:location – The location at which to create the network security

group (if None, use default location specified as ‘region’ in __init__) :type location: NodeLocation

ex_create_public_ip(name, resource_group, location=None, public_ip_allocation_method=None)[source]

Create a public IP resources.

Parameters:
  • name (str) – Name of the public IP resource
  • resource_group (str) – The resource group to create the public IP
  • location – The location at which to create the public IP

(if None, use default location specified as ‘region’ in __init__) :type location: NodeLocation

Parameters:public_ip_allocation_method – Call ex_create_public_ip with

public_ip_allocation_method=”Static” to create a static public IP address :type public_ip_allocation_method: str

Returns:The newly created public ip object
Return type:AzureIPAddress
ex_create_tags(resource, tags, replace=False)[source]

Update tags on any resource supporting tags.

Parameters:
  • resource (str or Azure object with an id attribute.) – The resource to update.
  • tags (dict) – The tags to set.
  • replace – If true, replace all tags with the new tags.

If false (default) add or update tags. :type replace: bool

ex_delete_network_security_group(name, resource_group, location=None)[source]

Update tags on any resource supporting tags.

Parameters:
  • name (str) – Name of the network security group to delete
  • resource_group – The resource group to create the network

security group in :type resource_group: str

Parameters:location – The location at which to create the network security

group (if None, use default location specified as ‘region’ in __init__) :type location: NodeLocation

ex_delete_public_ip(public_ip)[source]

Delete a public ip address resource.

Parameters:public_ip (.AzureIPAddress) – Public ip address resource to delete
ex_delete_resource(resource)[source]

Delete a resource.

ex_destroy_nic(nic)[source]

Destroy a NIC.

Parameters:nic (.AzureNic) – The NIC to destroy.
Returns:True on success
Return type:bool
ex_get_nic(id)[source]

Fetch information about a NIC.

Parameters:id (str) – The complete resource path to the NIC resource.
Returns:The NIC object
Return type:AzureNic
ex_get_node(id)[source]

Fetch information about a node.

Parameters:id (str) – The complete resource path to the node resource.
Returns:The Node object
Return type:Node
ex_get_public_ip(id)[source]

Fetch information about a public IP resource.

Parameters:id (``str`) – The complete resource path to the public IP resource.
Returns:The public ip object
Return type:AzureIPAddress
ex_get_ratecard(offer_durable_id, currency='USD', locale='en-US', region='US')[source]

Get rate card

Parameters:offer_durable_id – ID of the offer applicable for this

user account. (e.g. “0026P”) See http://azure.microsoft.com/en-us/support/legal/offer-details/ :type offer_durable_id: str

Parameters:
  • currency (str) – Desired currency for the response (default: “USD”)
  • locale (str) – Locale (default: “en-US”)
  • region (str) – Region (two-letter code) (default: “US”)
Returns:

A dictionary of rates whose ID’s correspond to nothing at all

Return type:

dict

ex_get_snapshot(id)[source]

Fetch information about a snapshot.

Parameters:id (str) – The complete resource path to the snapshot resource.
Returns:The VolumeSnapshot object
Return type:VolumeSnapshot
ex_get_storage_account_keys(resource_group, storage_account)[source]

Get account keys required to access to a storage account (using AzureBlobsStorageDriver).

Parameters:
  • resource_group (str) – The resource group containing the storage account
  • storage_account (str) – Storage account to access
Returns:

The account keys, in the form {“key1”: “XXX”, “key2”: “YYY”}

Return type:

.dict

ex_get_volume(id)[source]

Fetch information about a volume.

Parameters:id (str) – The complete resource path to the volume resource.
Returns:The StorageVolume object
Return type:StorageVolume
ex_list_image_versions(sku)[source]

List node image versions in a sku.

Parameters:sku – The complete resource path to a sku (as returned by

ex_list_skus) :type publisher: str

Returns:A list of tuples in the form

(“version id”, “version name”) :rtype: list

ex_list_network_security_groups(resource_group)[source]

List network security groups.

Parameters:resource_group – List security groups in a specific resource

group. :type resource_group: str

Returns:A list of network security groups.
Return type:list of AzureNetworkSecurityGroup
ex_list_networks()[source]

List virtual networks.

Returns:A list of virtual networks.
Return type:list of AzureNetwork
ex_list_nics(resource_group=None)[source]

List available virtual network interface controllers in a resource group

Parameters:resource_group (str) – List NICS in a specific resource group containing the NICs(optional).
Returns:A list of NICs.
Return type:list of AzureNic
ex_list_offers(publisher)[source]

List node image offers from a publisher.

Parameters:publisher – The complete resource path to a publisher

(as returned by ex_list_publishers) :type publisher: str

Returns:A list of tuples in the form

(“offer id”, “offer name”) :rtype: list

ex_list_public_ips(resource_group)[source]

List public IP resources.

Parameters:resource_group (str) – List public IPs in a specific resource group.
Returns:List of public ip objects
Return type:list of AzureIPAddress
ex_list_publishers(location=None)[source]

List node image publishers.

Parameters:location – The location at which to list publishers

(if None, use default location specified as ‘region’ in __init__) :type location: NodeLocation

Returns:A list of tuples in the form

(“publisher id”, “publisher name”) :rtype: list

ex_list_resource_groups()[source]

List resource groups.

Returns:A list of resource groups.
Return type:list of AzureResourceGroup
ex_list_skus(offer)[source]

List node image skus in an offer.

Parameters:offer – The complete resource path to an offer (as returned by

ex_list_offers) :type offer: str

Returns:A list of tuples in the form

(“sku id”, “sku name”) :rtype: list

ex_list_subnets(network)[source]

List subnets of a virtual network.

Parameters:network (AzureNetwork) – The virtual network containing the subnets.
Returns:A list of subnets.
Return type:list of AzureSubnet
ex_resize_volume(volume, new_size, resource_group)[source]

Resize a volume.

Parameters:
  • volume (StorageVolume) – A volume to resize.
  • new_size (int) – The new size to resize the volume to in Gib.
  • resource_group (str) – The name of the resource group in which to create the volume.
ex_run_command(node, command, filerefs=[], timestamp=0, storage_account_name=None, storage_account_key=None, location=None)[source]

Run a command on the node as root.

Does not require ssh to log in, uses Windows Azure Agent (waagent) running on the node.

Parameters:
  • node (:class:.Node) – The node on which to run the command.
  • command – The actual command to run. Note this is parsed

into separate arguments according to shell quoting rules but is executed directly as a subprocess, not a shell command. :type command: str

Parameters:filerefs – Optional files to fetch by URI from Azure blob store

(must provide storage_account_name and storage_account_key), or regular HTTP. :type command: list of str

Parameters:location – The location of the virtual machine

(if None, use default location specified as ‘region’ in __init__) :type location: NodeLocation

Parameters:
  • storage_account_name (str) – The storage account from which to fetch files in filerefs
  • storage_account_key (str) – The storage key to authorize to the blob store.
Type:

list of NodeLocation

ex_start_node(node)[source]
ex_stop_node(node, deallocate=True)[source]
ex_update_network_profile_of_node(node, network_profile)[source]

Update the network profile of a node. This method can be used to attach or detach a NIC to a node.

Parameters:
  • node (Node) – A node to attach the network interface to.
  • network_profile (dict) – The new network profile to update.
ex_update_nic_properties(network_interface, resource_group, properties)[source]

Update the properties of an already existing virtual network interface (NIC).

Parameters:
  • network_interface (AzureNic) – The NIC to update.
  • resource_group (str) – The resource group to check the ip address in.
  • properties (dict) – The dictionary of the NIC’s properties
Returns:

The NIC object

Return type:

AzureNic

features = {'create_node': ['ssh_key', 'password']}
get_image(image_id, location=None)[source]

Returns a single node image from a provider.

Parameters:image_id – Either an image urn in the form

Publisher:Offer:Sku:Version or a Azure blob store URI in the form http://storageaccount.blob.core.windows.net/container/image.vhd pointing to a VHD file. :type image_id: str

Parameters:location – The location at which to search for the image

(if None, use default location specified as ‘region’ in __init__) :type location: NodeLocation

:rtype AzureImage: or AzureVhdImage: :return: AzureImage or AzureVhdImage instance on success.

list_images(location=None, ex_publisher=None, ex_offer=None, ex_sku=None, ex_version=None)[source]

List available VM images to boot from.

Parameters:location – The location at which to list images

(if None, use default location specified as ‘region’ in __init__) :type location: NodeLocation

Parameters:ex_publisher – Filter by publisher, or None to list

all publishers. :type ex_publisher: str

Parameters:
  • ex_offer (str) – Filter by offer, or None to list all offers.
  • ex_sku (str) – Filter by sku, or None to list all skus.
  • ex_version (str) – Filter by version, or None to list all versions.
Returns:

list of node image objects.

Return type:

list of AzureImage

list_locations()[source]

List data centers available with the current subscription.

Returns:list of node location objects
Return type:list of NodeLocation
list_nodes(ex_resource_group=None, ex_fetch_nic=True, ex_fetch_power_state=True)[source]

List all nodes.

Parameters:
  • ex_resource_group (str) – The resource group to list all nodes from.
  • ex_fetch_nic – Fetch NIC resources in order to get

IP address information for nodes. If True, requires an extra API call for each NIC of each node. If False, IP addresses will not be returned. :type ex_fetch_nic: bool

Parameters:ex_fetch_power_state – Fetch node power state. If True, requires

an extra API call for each node. If False, node state will be returned based on provisioning state only. :type ex_fetch_power_state: bool

Returns:list of node objects
Return type:list of Node

NOTE: With the default arguments, the function may result in M * (1 + (N * 3)) HTTP requests where M is number of API pages and N is number of nodes returned per page.

list_sizes(location=None)[source]

List available VM sizes.

Parameters:location – The location at which to list sizes

(if None, use default location specified as ‘region’ in __init__) :type location: NodeLocation

Returns:list of node size objects
Return type:list of NodeSize
list_snapshots(ex_resource_group=None)[source]

Lists all the snapshots under a resource group or subscription.

Parameters:ex_resource_group (str) – The identifier of your subscription where the managed snapshots are located (optional).
Return type:list of VolumeSnapshot
list_volume_snapshots(volume)[source]

List snapshots for a storage volume.

Return type:list of VolumeSnapshot
list_volumes(ex_resource_group=None)[source]

Lists all the disks under a resource group or subscription.

Parameters:ex_resource_group (str) – The identifier of your subscription where the managed disks are located.
Return type:list of StorageVolume
name = 'Azure Virtual machines'
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 stopped node.

Parameters:node (Node) – The node to be started
stop_node(node, ex_deallocate=True)[source]

Stop a running node.

Parameters:
  • node (Node) – The node to be stopped
  • deallocate – If True (default) stop and then deallocate the node

(release the hardware allocated to run the node). If False, stop the node but maintain the hardware allocation. If the node is not deallocated, the subscription will continue to be billed as if it were running. :type deallocate: bool

type = 'azure_arm'
website = 'http://azure.microsoft.com/en-us/services/virtual-machines/'
class libcloud.compute.drivers.azure_arm.AzureResourceGroup(id, name, location, extra)[source]

Bases: object

Represent an Azure resource group.

class libcloud.compute.drivers.azure_arm.AzureSubnet(id, name, extra)[source]

Bases: object

Represents a subnet of an Azure virtual network.

class libcloud.compute.drivers.azure_arm.AzureVhdImage(storage_account, blob_container, name, driver)[source]

Bases: libcloud.compute.base.NodeImage

Represents a VHD node image that an Azure VM can boot from.

libcloud.compute.drivers.brightbox module

Brightbox Driver

class libcloud.compute.drivers.brightbox.BrightboxNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version='1.0', **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Brightbox node driver

NODE_STATE_MAP = {'active': running, 'creating': pending, 'deleted': terminated, 'deleting': unknown, 'failed': unknown, 'inactive': unknown, 'unavailable': unknown}
connectionCls

alias of libcloud.common.brightbox.BrightboxConnection

create_node(name, size, image, location=None, ex_userdata=None, ex_servergroup=None)[source]

Create a new Brightbox node

Reference: https://api.gb1.brightbox.com/1.0/#server_create_server

@inherits: NodeDriver.create_node

Parameters:
  • ex_userdata (str) – User data
  • ex_servergroup (str or list of str) – Name or list of server group ids to add server to
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_create_cloud_ip(reverse_dns=None)[source]

Requests a new cloud IP address for the account

@note: This is an API extension for use on Brightbox

Parameters:reverse_dns (str) – Reverse DNS hostname
Return type:dict
ex_destroy_cloud_ip(cloud_ip_id)[source]

Release the cloud IP address from the account’s ownership

@note: This is an API extension for use on Brightbox

Parameters:cloud_ip_id (str) – The id of the cloud ip.
Returns:True if the unmap was successful.
Return type:bool
ex_list_cloud_ips()[source]

List Cloud IPs

@note: This is an API extension for use on Brightbox

Return type:list of dict
ex_map_cloud_ip(cloud_ip_id, interface_id)[source]

Maps (or points) a cloud IP address at a server’s interface or a load balancer to allow them to respond to public requests

@note: This is an API extension for use on Brightbox

Parameters:
  • cloud_ip_id (str) – The id of the cloud ip.
  • interface_id (str) – The Interface ID or LoadBalancer ID to which this Cloud IP should be mapped to
Returns:

True if the mapping was successful.

Return type:

bool

ex_unmap_cloud_ip(cloud_ip_id)[source]

Unmaps a cloud IP address from its current destination making it available to remap. This remains in the account’s pool of addresses

@note: This is an API extension for use on Brightbox

Parameters:cloud_ip_id (str) – The id of the cloud ip.
Returns:True if the unmap was successful.
Return type:bool
ex_update_cloud_ip(cloud_ip_id, reverse_dns)[source]

Update some details of the cloud IP address

@note: This is an API extension for use on Brightbox

Parameters:
  • cloud_ip_id (str) – The id of the cloud ip.
  • reverse_dns (str) – Reverse DNS hostname
Return type:

dict

list_images(location=None)[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 of NodeImage
list_locations()[source]

List data centers for a provider

Returns:list of node location objects
Return type:list of NodeLocation
list_nodes()[source]

List all nodes.

Returns:list of node objects
Return type:list of Node
list_sizes()[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 of NodeSize
name = 'Brightbox'
type = 'brightbox'
website = 'http://www.brightbox.co.uk/'

libcloud.compute.drivers.cloudscale module

A driver for cloudscale.ch.

class libcloud.compute.drivers.cloudscale.CloudscaleConnection(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]

Bases: libcloud.common.base.ConnectionKey

Connection class for the cloudscale.ch driver.

Initialize user_id and key; set secure to an int based on passed value.

add_default_headers(headers)[source]

Add headers that are necessary for every request

This method adds token to the request.

host = 'api.cloudscale.ch'
responseCls

alias of CloudscaleResponse

class libcloud.compute.drivers.cloudscale.CloudscaleNodeDriver(key, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Cloudscale’s node driver.

NODE_STATE_MAP = {'changing': pending, 'paused': paused, 'running': running, 'stopped': stopped}
connectionCls

alias of CloudscaleConnection

create_node(name, size, image, location=None, ex_create_attr=None)[source]

Create a node.

The ex_create_attr parameter can include the following dictionary key and value pairs:

  • ssh_keys: list of str ssh public keys
  • volume_size_gb: int defaults to 10.
  • bulk_volume_size_gb: defaults to None.
  • use_public_network: bool defaults to True
  • use_private_network: bool defaults to False
  • use_ipv6: bool defaults to True
  • anti_affinity_with: uuid of a server to create an anti-affinity group with that server or add it to the same group as that server.
  • user_data: str for optional cloud-config data
Parameters:ex_create_attr (dict) – A dictionary of optional attributes for droplet creation
Returns:The newly created node.
Return type:Node
destroy_node(node)[source]

Delete a node. It’s also possible to use node.destroy(). This will irreversibly delete the cloudscale.ch server and all its volumes. So please be cautious.

ex_node_by_uuid(uuid)[source]
Parameters:ex_user_data (str) – A valid uuid that references your existing cloudscale.ch server.
Returns:The server node you asked for.
Return type:Node
ex_start_node(node)[source]
ex_stop_node(node)[source]
list_images()[source]

List all images.

Images are identified by slugs on cloudscale.ch. This means that minor version upgrades (e.g. Ubuntu 16.04.1 to Ubuntu 16.04.2) will be possible within the same id ubuntu-16.04.

list_nodes()[source]

List all your existing compute nodes.

list_sizes()[source]

Lists all available sizes. On cloudscale these are known as flavors.

name = 'Cloudscale'
reboot_node(node)[source]

Reboot a node. It’s also possible to use node.reboot().

start_node(node)[source]

Start a node. This is only possible if the node is stopped.

stop_node(node)[source]

Stop a specific node. Similar to shutdown -h now. This is only possible if the node is running.

type = 'cloudscale'
website = 'https://www.cloudscale.ch'
class libcloud.compute.drivers.cloudscale.CloudscaleResponse(response, connection)[source]

Bases: libcloud.common.base.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 or False
valid_response_codes = [<HTTPStatus.OK: 200>, <HTTPStatus.ACCEPTED: 202>, <HTTPStatus.CREATED: 201>, <HTTPStatus.NO_CONTENT: 204>]

libcloud.compute.drivers.cloudsigma module

Drivers for CloudSigma API v1.0 and v2.0.

class libcloud.compute.drivers.cloudsigma.CloudSigmaNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Parameters:
  • key (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

name = 'CloudSigma'
website = 'http://www.cloudsigma.com/'
class libcloud.compute.drivers.cloudsigma.CloudSigma_1_0_NodeDriver(key, secret=None, secure=True, host=None, port=None, region='zrh', **kwargs)[source]

Bases: libcloud.compute.drivers.cloudsigma.CloudSigmaNodeDriver

IMAGING_TIMEOUT = 1200
NODE_STATE_MAP = {'active': running, 'dead': terminated, 'dumped': terminated, 'stopped': terminated}
connectionCls

alias of CloudSigma_1_0_Connection

create_node(name, size, image, smp='auto', nic_model='e1000', vnc_password=None, drive_type='hdd')[source]

Creates a CloudSigma instance

@inherits: NodeDriver.create_node

Parameters:
  • name (str) – String with a name for this new node (required)
  • smp (int) – Number of virtual processors or None to calculate based on the cpu speed.
  • nic_model (str) – e1000, rtl8139 or virtio (is not specified, e1000 is used)
  • vnc_password (bool) – If not set, VNC access is disabled.
  • drive_type (str) – Drive type (ssd|hdd). Defaults to hdd.
destroy_node(node)[source]

Destroy a node (all the drives associated with it are NOT destroyed).

If a node is still running, it’s stopped before it’s destroyed.

@inherits: NodeDriver.destroy_node

ex_destroy_drive(drive_uuid)[source]

Destroy a drive.

Parameters:drive_uuid (str) – Drive uuid which should be used
Return type:bool
ex_destroy_node_and_drives(node)[source]

Destroy a node and all the drives associated with it.

Parameters:node (libcloud.compute.base.Node) – Node which should be used
Return type:bool
ex_drive_destroy(drive_uuid)[source]

Destroy a drive with a specified uuid. If the drive is currently mounted an exception is thrown.

Parameters:drive_uuid (str) – Drive uuid which should be used
Return type:bool
ex_drives_list()[source]

Return a list of all the available drives.

Return type:list of dict
ex_set_node_configuration(node, **kwargs)[source]

Update a node configuration. Changing most of the parameters requires node to be stopped.

Parameters:
Return type:

bool

ex_shutdown_node(node)[source]

Stop (shutdown) a node.

@inherits: CloudSigmaBaseNodeDriver.ex_stop_node

ex_start_node(node)[source]

Start a node.

Parameters:node (libcloud.compute.base.Node) – Node which should be used
Return type:bool
ex_static_ip_create()[source]

Create a new static IP address.p

Return type:list of dict
ex_static_ip_destroy(ip_address)[source]

Destroy a static IP address.

Parameters:ip_address (str) – IP address which should be used
Return type:bool
ex_static_ip_list()[source]

Return a list of available static IP addresses.

Return type:list of str
ex_stop_node(node)[source]
list_images(location=None)[source]

Return a list of available standard images (this call might take up to 15 seconds to return).

@inherits: NodeDriver.list_images

list_nodes()[source]

List all nodes.

Returns:list of node objects
Return type:list of Node
list_sizes(location=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 of NodeSize
name = 'CloudSigma (API v1.0)'
reboot_node(node)[source]

Reboot a node.

Because Cloudsigma API does not provide native reboot call, it’s emulated using stop and start.

@inherits: NodeDriver.reboot_node

stop_node(node)[source]

Stop (shutdown) a node.

Parameters:node (libcloud.compute.base.Node) – Node which should be used
Return type:bool
type = 'cloudsigma'
website = 'http://www.cloudsigma.com/'
class libcloud.compute.drivers.cloudsigma.CloudSigma_2_0_NodeDriver(key, secret, secure=True, host=None, port=None, region='zrh', **kwargs)[source]

Bases: libcloud.compute.drivers.cloudsigma.CloudSigmaNodeDriver

Driver for CloudSigma API v2.0.

DRIVE_TRANSITION_SLEEP_INTERVAL = 5
DRIVE_TRANSITION_TIMEOUT = 500
NODE_STATE_MAP = {'paused': paused, 'running': running, 'starting': pending, 'stopped': stopped, 'stopping': pending, 'unavailable': error}
api_name = 'cloudsigma_zrh'
attach_volume(node, volume)[source]

Attaches volume to node.

Parameters:
  • node (Node) – Node to attach volume to.
  • volume (StorageVolume) – Volume to attach.
  • device (str) – Where the device is exposed, e.g. ‘/dev/sdb’
Rytpe:

bool

connectionCls

alias of CloudSigma_2_0_Connection

create_key_pair(name)[source]

Create a new SSH key.

Parameters:name (str) – Key pair name.
create_node(name, size, image, ex_metadata=None, ex_vnc_password=None, ex_avoid=None, ex_vlan=None, public_keys=None)[source]

Create a new server.

Server creation consists multiple steps depending on the type of the image used.

  1. Installation CD:

    1. Create a server and attach installation cd
    2. Start a server
  2. Pre-installed image:

    1. Clone provided library drive so we can use it
    2. Resize cloned drive to the desired size
    3. Create a server and attach cloned drive
    4. Start a server
Parameters:
  • ex_metadata (dict) – Key / value pairs to associate with the created node. (optional)
  • ex_vnc_password (str) – Password to use for VNC access. If not provided, random password is generated.
  • ex_avoid (list) – A list of server UUIDs to avoid when starting this node. (optional)
  • ex_vlan (str) – Optional UUID of a VLAN network to use. If specified, server will have two nics assigned - 1 with a public ip and 1 with the provided VLAN.
  • public_keys (list of str) – Optional list of SSH key UUIDs
create_volume(name, size, media='disk', ex_avoid=None)[source]

Create a new volume.

Parameters:
  • size (int) – Size of volume in gigabytes (required)
  • name (str) – Name of the volume to be created
  • location (NodeLocation) – Which data center to create a volume in. If empty, undefined behavior will be selected. (optional)
  • snapshot (VolumeSnapshot) – Snapshot from which to create the new volume. (optional)
Returns:

The newly created volume.

Return type:

StorageVolume

delete_key_pair(key_pair)[source]

Delete an existing key pair.

Parameters:key_pair (KeyPair) – Key pair object
Return type:bool
destroy_node(node, ex_delete_drives=False)[source]

Destroy the node and all the associated drives.

Returns:True on success, False otherwise.
Return type:bool
destroy_volume(drive)[source]

Destroys a storage volume.

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
detach_volume(node, volume)[source]

Detaches a volume from a node.

Parameters:volume (StorageVolume) – Volume to be detached
Return type:bool
ex_attach_drive(node, drive)[source]

Attach drive to node

Parameters:
Returns:

True on success, False otherwise.

Return type:

bool

ex_attach_firewall_policy(policy, node, nic_mac=None)[source]

Attach firewall policy to a public NIC interface on the server.

Parameters:
  • policy (CloudSigmaFirewallPolicy) – Firewall policy to attach.
  • node (libcloud.compute.base.Node) – Node to attach policy to.
  • nic_mac (str) – Optional MAC address of the NIC to add the policy to. If not specified, first public interface is used instead.
Returns:

Node object to which the policy was attached to.

Return type:

libcloud.compute.base.Node

ex_clone_drive(drive, name=None, ex_avoid=None)[source]

Clone a library or a standard drive.

Parameters:
  • drive (libcloud.compute.base.NodeImage or CloudSigmaDrive) – Drive to clone.
  • name (str) – Optional name for the cloned drive.
  • ex_avoid (list) – A list of other drive uuids to avoid when creating this drive. If provided, drive will attempt to be created on a different physical infrastructure from other drives specified using this argument. (optional)
Returns:

New cloned drive.

Return type:

CloudSigmaDrive

ex_clone_node(node, name=None, random_vnc_password=None)[source]

Clone the provided node.

Parameters:
  • name (str) – Optional name for the cloned node.
  • random_vnc_password (bool) – If True, a new random VNC password will be generated for the cloned node. Otherwise password from the cloned node will be reused.
Returns:

Cloned node.

Return type:

libcloud.compute.base.Node

ex_close_vnc_tunnel(node)[source]

Close a VNC server to the provided node.

Parameters:node (libcloud.compute.base.Node) – Node to close the VNC tunnel to.
Returns:True on success, False otherwise.
Return type:bool
ex_create_drive(name, size, media='disk', ex_avoid=None)[source]

Create a new drive.

Parameters:
  • name (str) – Drive name.
  • size (int) – Drive size in GBs.
  • media (str) – Drive media type (cdrom, disk).
  • ex_avoid (list) – A list of other drive uuids to avoid when creating this drive. If provided, drive will attempt to be created on a different physical infrastructure from other drives specified using this argument. (optional)
Returns:

Created drive object.

Return type:

CloudSigmaDrive

ex_create_firewall_policy(name, rules=None)[source]

Create a firewall policy.

Parameters:
  • name (str) – Policy name.
  • rules (list of dict) – List of firewall policy rules to associate with this policy. (optional)
Returns:

Created firewall policy object.

Return type:

CloudSigmaFirewallPolicy

ex_create_subscription(amount, period, resource, auto_renew=False)[source]

Create a new subscription.

Parameters:
  • amount (int) – Subscription amount. For example, in dssd case this would be disk size in gigabytes.
  • period (str) – Subscription period. For example: 30 days, 1 week, 1 month, …
  • resource (str) – Resource the purchase the subscription for.
  • auto_renew (bool) – True to automatically renew the subscription.
ex_create_tag(name, resource_uuids=None)[source]

Create a tag.

Parameters:
  • name (str) – Tag name.
  • resource_uuids (list of str) – Optional list of resource UUIDs to assign this tag go.
Returns:

Created tag object.

Return type:

CloudSigmaTag

ex_delete_firewall_policy(policy)[source]

Delete a firewall policy.

Parameters:policy (CloudSigmaFirewallPolicy) – Policy to delete to.
Returns:True on success, False otherwise.
Return type:bool
ex_delete_tag(tag)[source]

Delete a tag.

Parameters:tag (CloudSigmaTag) – Tag to delete.
Returns:True on success, False otherwise.
Return type:bool
ex_destroy_drive(drive)[source]
ex_detach_drive(node, drive)[source]
ex_edit_node(node, params)[source]

Edit a node.

Parameters:

:return Edited node. :rtype: libcloud.compute.base.Node

ex_get_balance()[source]

Retrieve account balance information.

Returns:Dictionary with two items (“balance” and “currency”).
Return type:dict
ex_get_drive(drive_id)[source]

Retrieve information about a single drive.

Parameters:drive_id (str) – ID of the drive to retrieve.
Returns:Drive object.
Return type:CloudSigmaDrive
ex_get_node(node_id, return_json=False)[source]
ex_get_pricing()[source]

Retrieve pricing information that are applicable to the cloud.

Returns:Dictionary with pricing information.
Return type:dict
ex_get_tag(tag_id)[source]

Retrieve a single tag.

Parameters:tag_id (str) – ID of the tag to retrieve.
Return type:list of CloudSigmaTag objects
ex_get_usage()[source]

Retrieve account current usage information.

Returns:Dictionary with two items (“balance” and “usage”).
Return type:dict
ex_list_capabilities()[source]

Retrieve all the basic and sensible limits of the API.

Return type:dict
ex_list_drives_availability_groups()[source]

Return which drives share the same physical storage host.

Returns:A list of drive UUIDs which share the same physical storage host. Drives which share the same host will be stored under the same list index.
Return type:list of list
ex_list_firewall_policies()[source]

List firewall policies.

Return type:list of CloudSigmaFirewallPolicy
ex_list_library_drives()[source]

Return a list of all the available library drives (pre-installed and installation CDs).

Return type:list of CloudSigmaDrive objects
ex_list_servers_availability_groups()[source]

Return which running servers share the same physical compute host.

Returns:A list of server UUIDs which share the same physical compute host. Servers which share the same host will be stored under the same list index.
Return type:list of list
ex_list_subscriptions(status='all', resources=None)[source]

List subscriptions for this account.

Parameters:
  • status (str) – Only return subscriptions with the provided status (optional).
  • resources (list) – Only return subscriptions for the provided resources (optional).
Return type:

list

ex_list_tags()[source]

List all the available tags.

Return type:list of CloudSigmaTag objects
ex_list_user_drives()[source]

Return a list of all the available user’s drives.

Return type:list of CloudSigmaDrive objects
ex_open_vnc_tunnel(node)[source]

Open a VNC tunnel to the provided node and return the VNC url.

Parameters:node (libcloud.compute.base.Node) – Node to open the VNC tunnel to.
Returns:URL of the opened VNC tunnel.
Return type:str
ex_resize_drive(drive, size)[source]

Resize a drive.

Parameters:
  • drive – Drive to resize.
  • size (int) – New drive size in GBs.
Returns:

Drive object which is being resized.

Return type:

CloudSigmaDrive

ex_start_node(node, ex_avoid=None)[source]
ex_stop_node(node)[source]

Stop a node.

ex_tag_resource(resource, tag)[source]

Associate tag with the provided resource.

Parameters:
Returns:

Updated tag object.

Return type:

CloudSigmaTag

ex_tag_resources(resources, tag)[source]

Associate tag with the provided resources.

Parameters:
Returns:

Updated tag object.

Return type:

CloudSigmaTag

ex_toggle_subscription_auto_renew(subscription)[source]

Toggle subscription auto renew status.

Parameters:subscription (CloudSigmaSubscription) – Subscription to toggle the auto renew flag for.
Returns:True on success, False otherwise.
Return type:bool
get_key_pair(key_uuid)[source]

Retrieve a single key pair.

Parameters:name (str) – The uuid of the key pair to retrieve.
Return type:KeyPair
import_key_pair_from_string(name, key_material)[source]

Import a new public key from string.

Parameters:
  • name (str) – Key pair name.
  • key_material (str) – Public key material.
Return type:

KeyPair object

list_images()[source]

Return a list of available pre-installed library drives.

Note: If you want to list all the available library drives (both pre-installed and installation CDs), use ex_list_library_drives() method.

list_key_pairs()[source]

List all the available key pair objects.

Return type:list of KeyPair objects
list_nodes(ex_tag=None)[source]

List available nodes.

Parameters:ex_tag (CloudSigmaTag) – If specified, only return servers tagged with the provided tag.
list_sizes()[source]

List available sizes.

list_volumes()[source]

List storage volumes.

Return type:list of StorageVolume
name = 'CloudSigma (API v2.0)'
reboot_node(node)[source]

Reboot a node.

Because Cloudsigma API does not provide native reboot call, it’s emulated using stop and start.

Parameters:node (libcloud.compute.base.Node) – Node to reboot.
start_node(node, ex_avoid=None)[source]

Start a node.

Parameters:
  • node (libcloud.compute.base.Node) – Node to start.
  • ex_avoid (list) – A list of other server uuids to avoid when starting this node. If provided, node will attempt to be started on a different physical infrastructure from other servers specified using this argument. (optional)
stop_node(node)[source]

Stop a node

Parameters:node (Node) – The node to be stopped.
Returns:True if the stop was successful, otherwise False
Return type:bool
website = 'http://www.cloudsigma.com/'
exception libcloud.compute.drivers.cloudsigma.CloudSigmaError(http_code, error_type, error_msg, error_point, driver)[source]

Bases: libcloud.common.types.ProviderError

Represents CloudSigma API error.

Parameters:
  • http_code (int) – HTTP status code.
  • error_type (str) – Type of error (validation / notexist / backend / permissions database / concurrency / billing / payment)
  • error_msg (str) – A description of the error that occurred.
  • error_point (str or None) – Point at which the error occurred. Can be None.
class libcloud.compute.drivers.cloudsigma.CloudSigmaNodeSize(id, name, cpu, ram, disk, bandwidth, price, driver, extra=None)[source]

Bases: libcloud.compute.base.NodeSize

class libcloud.compute.drivers.cloudsigma.CloudSigmaDrive(id, name, size, media, status, driver, extra=None)[source]

Bases: libcloud.compute.base.NodeImage

Represents a CloudSigma drive.

Parameters:
  • id (str) – Drive ID.
  • name (str) – Drive name.
  • size (float) – Drive size (in GBs).
  • media (str) – Drive media (cdrom / disk).
  • status (str) – Drive status (unmounted / mounted).
class libcloud.compute.drivers.cloudsigma.CloudSigmaTag(id, name, resources=None)[source]

Bases: object

Represents a CloudSigma tag object.

Parameters:
  • id (str) – Tag ID.
  • name (str) – Tag name.
  • resource – IDs of resources which are associated with this tag.
class libcloud.compute.drivers.cloudsigma.CloudSigmaSubscription(id, resource, amount, period, status, price, start_time, end_time, auto_renew, subscribed_object=None)[source]

Bases: object

Represents CloudSigma subscription.

Parameters:
  • id (str) – Subscription ID.
  • resource (str) – Resource (e.g vlan, ip, etc.).
  • period (str) – Subscription period.
  • status (str) – Subscription status (active / inactive).
  • price (str) – Subscription price.
  • start_time (datetime.datetime) – Start time for this subscription.
  • end_time (datetime.datetime) – End time for this subscription.
  • auto_renew (bool) – True if the subscription is auto renewed.
  • subscribed_object (str) – Optional UUID of the subscribed object.
class libcloud.compute.drivers.cloudsigma.CloudSigmaFirewallPolicy(id, name, rules)[source]

Bases: object

Represents a CloudSigma firewall policy.

Parameters:
  • id (str) – Policy ID.
  • name (str) – Policy name.
  • rules (list of CloudSigmaFirewallPolicyRule objects) – Rules associated with this policy.
class libcloud.compute.drivers.cloudsigma.CloudSigmaFirewallPolicyRule(action, direction, ip_proto=None, src_ip=None, src_port=None, dst_ip=None, dst_port=None, comment=None)[source]

Bases: object

Represents a CloudSigma firewall policy rule.

Parameters:
  • action (str) – Action (drop / accept).
  • direction (str) – Rule direction (in / out / both)>
  • ip_proto (str.) – IP protocol (tcp / udp).
  • src_ip (str) – Source IP in CIDR notation.
  • src_port (str) – Source port or a port range.
  • dst_ip (str) – Destination IP in CIDR notation.
  • src_port – Destination port or a port range.
  • comment (str) – Comment associated with the policy.

libcloud.compute.drivers.cloudstack module

class libcloud.compute.drivers.cloudstack.CloudStackAddress(id, address, driver, associated_network_id=None, vpc_id=None, virtualmachine_id=None)[source]

Bases: object

A public IP address.

Parameters:
  • id (str) – UUID of the Public IP
  • address (str) – The public IP address
  • associated_network_id (str) – The ID of the network where this address has been associated with
  • vpc_id (str) – VPC the ip belongs to
  • virtualmachine_id (str) – The ID of virtual machine this address is assigned to
release()[source]
class libcloud.compute.drivers.cloudstack.CloudStackAffinityGroup(id, account, description, domain, domainid, name, group_type, virtualmachine_ids)[source]

Bases: object

Class representing a CloudStack AffinityGroup.

A CloudStack Affinity Group.

@note: This is a non-standard extension API, and only works for
CloudStack.
Parameters:
  • id (str) – CloudStack Affinity Group ID
  • account (str) – An account for the affinity group. Must be used with domainId.
  • description (str) – optional description of the affinity group
  • domain (str) – the domain name of the affinity group
  • domainid (str) – domain ID of the account owning the affinity group
  • name (str) – name of the affinity group
  • group_type (CloudStackAffinityGroupType) – the type of the affinity group
  • virtualmachine_ids (str) – virtual machine Ids associated with this affinity group
Return type:

CloudStackAffinityGroup

class libcloud.compute.drivers.cloudstack.CloudStackAffinityGroupType(type_name)[source]

Bases: object

Class representing a CloudStack AffinityGroupType.

A CloudStack Affinity Group Type.

@note: This is a non-standard extension API, and only works for
CloudStack.
Parameters:type_name (str) – the type of the affinity group
Return type:CloudStackAffinityGroupType
class libcloud.compute.drivers.cloudstack.CloudStackDiskOffering(id, name, size, customizable)[source]

Bases: object

A disk offering within CloudStack.

class libcloud.compute.drivers.cloudstack.CloudStackEgressFirewallRule(id, network_id, cidr_list, protocol, icmp_code=None, icmp_type=None, start_port=None, end_port=None)[source]

Bases: object

A egress firewall rule.

A egress firewall rule.

@note: This is a non-standard extension API, and only works for
CloudStack.
Parameters:
  • id (int) – Firewall Rule ID
  • network_id (str) – the id network network for the egress firwall services
  • protocol (str) – TCP/IP Protocol (TCP, UDP)
  • cidr_list (str) – cidr list
  • icmp_code (int) – Error code for this icmp message
  • icmp_type (int) – Type of the icmp message being sent
  • start_port (int) – start of port range
  • end_port (int) – end of port range
Return type:

CloudStackEgressFirewallRule

class libcloud.compute.drivers.cloudstack.CloudStackFirewallRule(id, address, cidr_list, protocol, icmp_code=None, icmp_type=None, start_port=None, end_port=None)[source]

Bases: object

A firewall rule.

A Firewall rule.

@note: This is a non-standard extension API, and only works for
CloudStack.
Parameters:
  • id (int) – Firewall Rule ID
  • address (CloudStackAddress) – External IP address
  • cidr_list (str) – cidr list
  • protocol (str) – TCP/IP Protocol (TCP, UDP)
  • icmp_code (int) – Error code for this icmp message
  • icmp_type (int) – Type of the icmp message being sent
  • start_port (int) – start of port range
  • end_port (int) – end of port range
Return type:

CloudStackFirewallRule

class libcloud.compute.drivers.cloudstack.CloudStackIPForwardingRule(node, id, address, protocol, start_port, end_port=None)[source]

Bases: object

A NAT/firewall forwarding rule.

A NAT/firewall forwarding rule.

@note: This is a non-standard extension API, and only works for
CloudStack.
Parameters:
  • node (Node) – Node for rule
  • id (int) – Rule ID
  • address (CloudStackAddress) – External IP address
  • protocol (str) – TCP/IP Protocol (TCP, UDP)
  • start_port (int) – Start port for the rule
  • end_port (int) – End port for the rule
Return type:

CloudStackIPForwardingRule

delete()[source]
class libcloud.compute.drivers.cloudstack.CloudStackNetwork(displaytext, name, networkofferingid, id, zoneid, driver, extra=None)[source]

Bases: object

Class representing a CloudStack Network.

class libcloud.compute.drivers.cloudstack.CloudStackNetworkACL(id, protocol, acl_id, action, cidr_list, start_port, end_port, traffic_type=None)[source]

Bases: object

a ACL rule in the given network (the network has to belong to VPC)

a ACL rule in the given network (the network has to belong to VPC)

@note: This is a non-standard extension API, and only works for
Cloudstack.
Parameters:id – the ID of the ACL Item

:type id int

Parameters:
  • protocol (string) – the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number
  • acl_id (str) – Name of the network ACL List
  • action (string) – scl entry action, allow or deny
  • cidr_list (str) – the cidr list to allow traffic from/to
  • start_port (str) – the starting port of ACL
  • end_port (str) – the ending port of ACL
  • traffic_type (str) – the traffic type for the ACL,can be Ingress or Egress, defaulted to Ingress if not specified
Return type:

CloudStackNetworkACL

class libcloud.compute.drivers.cloudstack.CloudStackNetworkACLList(acl_id, name, vpc_id, driver, description=None)[source]

Bases: object

a Network ACL for the given VPC

a Network ACL for the given VPC

@note: This is a non-standard extension API, and only works for
Cloudstack.
Parameters:
  • acl_id (int) – ACL ID
  • name (str) – Name of the network ACL List
  • vpc_id (string) – Id of the VPC associated with this network ACL List
  • description (str) – Description of the network ACL List
Return type:

CloudStackNetworkACLList

class libcloud.compute.drivers.cloudstack.CloudStackNetworkOffering(name, display_text, guest_ip_type, id, service_offering_id, for_vpc, driver, extra=None)[source]

Bases: object

Class representing a CloudStack Network Offering.

class libcloud.compute.drivers.cloudstack.CloudStackNic(id, network_id, net_mask, gateway, ip_address, is_default, mac_address, driver, extra=None)[source]

Bases: object

Class representing a CloudStack Network Interface.

class libcloud.compute.drivers.cloudstack.CloudStackNode(id, name, state, public_ips, private_ips, driver, size=None, image=None, extra=None, created_at=None)[source]

Bases: libcloud.compute.base.Node

Subclass of Node so we can expose our extension methods.

Parameters:
  • id (str) – Node ID.
  • name (str) – Node name.
  • state (libcloud.compute.types.NodeState) – Node state.
  • public_ips (list) – Public IP addresses associated with this node.
  • private_ips (list) – Private IP addresses associated with this node.
  • driver (NodeDriver) – Driver this node belongs to.
  • size (NodeSize) – Size of this node. (optional)
  • image (NodeImage) – Image of this node. (optional)
  • created_at – The datetime this node was created (optional)
  • extra (dict) – Optional provider specific attributes associated with this node.
ex_allocate_public_ip()[source]

Allocate a public IP and bind it to this node.

ex_change_node_size(offering)[source]

Change virtual machine offering/size

ex_create_ip_forwarding_rule(address, protocol, start_port, end_port=None)[source]

Add a NAT/firewall forwarding rule for a port or ports.

ex_create_port_forwarding_rule(address, private_port, public_port, protocol, public_end_port=None, private_end_port=None, openfirewall=True)[source]

Add a port forwarding rule for port or ports.

ex_delete_ip_forwarding_rule(rule)[source]

Delete a port forwarding rule.

ex_delete_port_forwarding_rule(rule)[source]

Delete a NAT/firewall rule.

ex_release_public_ip(address)[source]

Release a public IP that this node holds.

ex_restore(template=None)[source]

Restore virtual machine

ex_start()[source]

Starts a stopped virtual machine.

ex_stop()[source]

Stops a running virtual machine.

class libcloud.compute.drivers.cloudstack.CloudStackNodeDriver(key, secret=None, secure=True, host=None, path=None, port=None, url=None, *args, **kwargs)[source]

Bases: libcloud.common.cloudstack.CloudStackDriverMixIn, libcloud.compute.base.NodeDriver

Driver for the CloudStack API.

Variables:
  • host – The host where the API can be reached.
  • path – The path where the API can be reached.
  • async_poll_frequency – How often (in seconds) to poll for async job completion.
Inherits:

NodeDriver.__init__

Parameters:
  • host (str) – The host where the API can be reached. (required)
  • path (str) – The path where the API can be reached. (required)
  • url (str) – Full URL to the API endpoint. Mutually exclusive with host and path argument.
NODE_STATE_MAP = {'Destroyed': terminated, 'Error': terminated, 'Expunging': pending, 'Migrating': migrating, 'Running': running, 'Starting': rebooting, 'Stopped': stopped, 'Stopping': pending}
VOLUME_STATE_MAP = {'Allocated': available, 'Creating': creating, 'Destroy': deleted, 'Destroying': deleting, 'Expunged': deleted, 'Expunging': deleting, 'Migrating': migrating, 'Ready': available, 'Snapshotting': backup, 'UploadError': error}
api_name = 'cloudstack'
attach_volume(node, volume, device=None)[source]

@inherits: NodeDriver.attach_volume :type node: CloudStackNode

Return type:bool
create_key_pair(name, **kwargs)[source]

Create a new key pair object.

Parameters:
  • name (str) – Key pair name.
  • name – Name of the keypair (required)
  • projectid (str) – An optional project for the ssh key
  • domainid (str) – An optional domainId for the ssh key. If the account parameter is used, domainId must also be used.
  • account (str) – An optional account for the ssh key. Must be used with domainId.
Returns:

Created key pair object.

Return type:

libcloud.compute.base.KeyPair

create_node(name, size, image, location=None, networks=None, project=None, diskoffering=None, ex_keyname=None, ex_userdata=None, ex_security_groups=None, ex_displayname=None, ex_ip_address=None, ex_start_vm=False, ex_rootdisksize=None, ex_affinity_groups=None)[source]

Create a new node

@inherits: NodeDriver.create_node

Parameters:
  • networks (list of CloudStackNetwork) – Optional list of networks to launch the server into.
  • project (CloudStackProject) – Optional project to create the new node under.
  • diskoffering (CloudStackDiskOffering) – Optional disk offering to add to the new node.
  • ex_keyname (str) – Name of existing keypair
  • ex_userdata (str) – String containing user data
  • ex_security_groups (list of str) – List of security groups to assign to the node
  • ex_displayname (str) – String containing instance display name
  • ex_ip_address (str) – String with ipaddress for the default nic
  • ex_start_vm (bool) – Boolean to specify to start VM after creation Default Cloudstack behaviour is to start a VM, if not specified.
  • ex_rootdisksize (str) – String with rootdisksize for the template
  • ex_affinity_groups (list of CloudStackAffinityGroup) – List of affinity groups to assign to the node
Return type:

CloudStackNode

create_volume(size, name, location=None, snapshot=None, ex_volume_type=None)[source]

Creates a data volume Defaults to the first location

create_volume_snapshot(volume, name=None)[source]

Create snapshot from volume

Parameters:
  • volume (StorageVolume) – Instance of StorageVolume
  • name (str) – The name of the snapshot is disregarded by CloudStack drivers
Return type:

VolumeSnapshot

delete_key_pair(key_pair, **kwargs)[source]

Delete an existing key pair.

Parameters:
  • key_pair (libcloud.compute.base.KeyPair) – Key pair object.
  • projectid (str) – The project associated with keypair
  • domainid (str) – The domain ID associated with the keypair
  • account (str) – The account associated with the keypair. Must be used with the domainId parameter.
Returns:

True of False based on success of Keypair deletion

Return type:

bool

destroy_node(node, ex_expunge=False)[source]

@inherits: NodeDriver.reboot_node :type node: CloudStackNode

Parameters:ex_expunge (bool) – If true is passed, the vm is expunged immediately. False by default.
Return type:bool
destroy_volume(volume)[source]
Return type:bool
destroy_volume_snapshot(snapshot)[source]

Destroys a snapshot.

Parameters:snapshot (VolumeSnapshot) – The snapshot to delete
Return type:bool
detach_volume(volume)[source]
Return type:bool
ex_allocate_public_ip(vpc_id=None, network_id=None, location=None)[source]

Allocate a public IP.

Parameters:
  • vpc_id (str) – VPC the ip belongs to
  • network_id (''str'') – Network where this IP is connected to.
  • location (NodeLocation) – Zone
Return type:

CloudStackAddress

ex_attach_nic_to_node(node, network, ip_address=None)[source]

Add an extra Nic to a VM

Parameters:
  • network (:class:'CloudStackNetwork`) – NetworkOffering object
  • node (:class:'CloudStackNode`) – Node Object
  • ip_address (str) – Optional, specific IP for this Nic
Return type:

bool

ex_authorize_security_group_ingress(securitygroupname, protocol, cidrlist, startport=None, endport=None, icmptype=None, icmpcode=None, **kwargs)[source]

Creates a new Security Group Ingress rule

Parameters:
  • securitygroupname (str) – The name of the security group. Mutually exclusive with securitygroupid.
  • protocol (str) – Can be TCP, UDP or ICMP. Sometime other protocols can be used like AH, ESP or GRE.
  • cidrlist (str) – Source address CIDR for which this rule applies.
  • startport (int) – Start port of the range for this ingress rule. Applies to protocols TCP and UDP.
  • endport (int) – End port of the range for this ingress rule. It can be None to set only one port. Applies to protocols TCP and UDP.
  • icmptype (int) – Type of the ICMP packet (eg: 8 for Echo Request). -1 or None means “all types”. Applies to protocol ICMP.
  • icmpcode (int) – Code of the ICMP packet for the specified type. If the specified type doesn’t require a code set this value to 0. -1 or None means “all codes”. Applies to protocol ICMP.
  • account (str) – An optional account for the security group. Must be used with domainId.
  • domainid – An optional domainId for the security group. If the account parameter is used, domainId must also be used.
  • projectid (str) – An optional project of the security group
  • securitygroupid (str) – The ID of the security group. Mutually exclusive with securitygroupname
  • usersecuritygrouplist (dict) – User to security group mapping
Return type:

dict

ex_change_node_size(node, offering)[source]

Change offering/size of a virtual machine

Parameters:
  • node (CloudStackNode) – Node to change size
  • offering (NodeSize) – The new offering

:rtype str

ex_create_affinity_group(name, group_type)[source]

Creates a new Affinity Group

Parameters:
  • name (str) – Name of the affinity group
  • group_type (CloudStackAffinityGroupType) – Type of the affinity group from the available affinity/anti-affinity group types
  • description (str) – Optional description of the affinity group
  • domainid (str) – domain ID of the account owning the affinity group
Return type:

CloudStackAffinityGroup

ex_create_egress_firewall_rule(network_id, cidr_list, protocol, icmp_code=None, icmp_type=None, start_port=None, end_port=None)[source]

Creates a Firewall Rule

Parameters:
  • network_id (str) – the id network network for the egress firewall services
  • cidr_list (str) – cidr list
  • protocol (str) – TCP/IP Protocol (TCP, UDP)
  • icmp_code (int) – Error code for this icmp message
  • icmp_type (int) – Type of the icmp message being sent
  • start_port (int) – start of port range
  • end_port (int) – end of port range
Return type:

CloudStackEgressFirewallRule

ex_create_firewall_rule(address, cidr_list, protocol, icmp_code=None, icmp_type=None, start_port=None, end_port=None)[source]

Creates a Firewall Rule

Parameters:
  • address (CloudStackAddress) – External IP address
  • cidr_list (str) – cidr list
  • protocol (str) – TCP/IP Protocol (TCP, UDP)
  • icmp_code (int) – Error code for this icmp message
  • icmp_type (int) – Type of the icmp message being sent
  • start_port (int) – start of port range
  • end_port (int) – end of port range
Return type:

CloudStackFirewallRule

ex_create_ip_forwarding_rule(node, address, protocol, start_port, end_port=None)[source]

“Add a NAT/firewall forwarding rule.

Parameters:
  • node (CloudStackNode) – Node which should be used
  • address (CloudStackAddress) – CloudStackAddress which should be used
  • protocol (str) – Protocol which should be used (TCP or UDP)
  • start_port (int) – Start port which should be used
  • end_port (int) – End port which should be used
Return type:

CloudStackForwardingRule

ex_create_keypair(name, **kwargs)[source]

Creates a SSH KeyPair, returns fingerprint and private key

Parameters:
  • name (str) – Name of the keypair (required)
  • projectid (str) – An optional project for the ssh key
  • domainid (str) – An optional domainId for the ssh key. If the account parameter is used, domainId must also be used.
  • account (str) – An optional account for the ssh key. Must be used with domainId.
Returns:

A keypair dictionary

Return type:

dict

ex_create_network(display_text, name, network_offering, location, gateway=None, netmask=None, network_domain=None, vpc_id=None, project_id=None)[source]

Creates a Network, only available in advanced zones.

Parameters:
  • display_text (str) – the display text of the network
  • name (str) – the name of the network
  • network_offering (:class:'CloudStackNetworkOffering`) – NetworkOffering object
  • location (NodeLocation) – Zone object
  • gateway (str) – Optional, the Gateway of this network
  • netmask (str) – Optional, the netmask of this network
  • network_domain (str) – Optional, the DNS domain of the network
  • vpc_id (str) – Optional, the VPC id the network belongs to
  • project_id (str) – Optional, the project id the networks belongs to
Return type:

CloudStackNetwork

ex_create_network_acl(protocol, acl_id, cidr_list, start_port, end_port, action=None, traffic_type=None)[source]

Creates an ACL rule in the given network (the network has to belong to VPC)

Parameters:
  • protocol (string) – the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number
  • acl_id (str) – Name of the network ACL List
  • cidr_list (str) – the cidr list to allow traffic from/to
  • start_port (str) – the starting port of ACL
  • end_port (str) – the ending port of ACL
  • action (str) – scl entry action, allow or deny
  • traffic_type (str) – the traffic type for the ACL,can be Ingress or Egress, defaulted to Ingress if not specified
Return type:

CloudStackNetworkACL

ex_create_network_acllist(name, vpc_id, description=None)[source]

Create an ACL List for a network within a VPC.

Parameters:
  • name (string) – Name of the network ACL List
  • vpc_id (string) – Id of the VPC associated with this network ACL List
  • description (string) – Description of the network ACL List
Return type:

CloudStackNetworkACLList

ex_create_port_forwarding_rule(node, address, private_port, public_port, protocol, public_end_port=None, private_end_port=None, openfirewall=True, network_id=None)[source]

Creates a Port Forwarding Rule, used for Source NAT

Parameters:
  • address (CloudStackAddress) – IP address of the Source NAT
  • private_port (int) – Port of the virtual machine
  • protocol (str) – Protocol of the rule
  • public_port (int) – Public port on the Source NAT address
  • node (CloudStackNode) – The virtual machine
  • network_id (string) – The network of the vm the Port Forwarding rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)
Return type:

CloudStackPortForwardingRule

ex_create_security_group(name, **kwargs)[source]

Creates a new Security Group

Parameters:
  • name (str) – name of the security group (required)
  • account (str) – An optional account for the security group. Must be used with domainId.
  • domainid (str) – An optional domainId for the security group. If the account parameter is used, domainId must also be used.
  • description (str) – The description of the security group
  • projectid (str) – Deploy vm for the project
Return type:

dict

ex_create_snapshot_template(snapshot, name, ostypeid, displaytext=None)[source]

Create a template from a snapshot

Parameters:
  • snapshot – Instance of VolumeSnapshot
  • name (str) – the name of the template
  • name – the os type id
  • name – the display name of the template
Return type:

NodeImage

ex_create_tags(resource_ids, resource_type, tags)[source]

Create tags for a resource (Node/StorageVolume/etc). A list of resource types can be found at http://goo.gl/6OKphH

Parameters:
  • resource_ids (list of resource IDs) – Resource IDs to be tagged. The resource IDs must all be associated with the resource_type. For example, for virtual machines (UserVm) you can only specify a list of virtual machine IDs.
  • resource_type (str) – Resource type (eg: UserVm)
  • tags (dict) – A dictionary or other mapping of strings to strings, associating tag names with tag values.
Return type:

bool

ex_create_vpc(cidr, display_text, name, vpc_offering, zone_id, network_domain=None)[source]

Creates a VPC, only available in advanced zones.

Parameters:
  • cidr – the cidr of the VPC. All VPC guest networks’ cidrs should be within this CIDR
  • display_text (str) – the display text of the VPC
  • name (str) – the name of the VPC
  • vpc_offering (:class:'CloudStackVPCOffering`) – the ID of the VPC offering
  • zone_id (str) – the ID of the availability zone
  • network_domain (str) – Optional, the DNS domain of the network
Return type:

CloudStackVPC

ex_create_vpn_connection(vpn_customer_gateway, vpn_gateway, for_display=None, passive=None)[source]

Creates a VPN Connection.

Parameters:
  • vpn_customer_gateway (CloudStackVpnCustomerGateway) – The VPN Customer Gateway (required).
  • vpn_gateway (CloudStackVpnGateway) – The VPN Gateway (required).
  • for_display (str) – Display the Connection to the end user or not.
  • passive (bool) – If True, sets the connection to be passive.
Return type:

class:CloudStackVpnConnection

ex_create_vpn_customer_gateway(cidr_list, esp_policy, gateway, ike_policy, ipsec_psk, account=None, domain_id=None, dpd=None, esp_lifetime=None, ike_lifetime=None, name=None)[source]

Creates a VPN Customer Gateway.

Parameters:
  • cidr_list (str) – Guest CIDR list of the Customer Gateway (required).
  • esp_policy (str) – ESP policy of the Customer Gateway (required).
  • gateway (str) – Public IP address of the Customer Gateway (required).
  • ike_policy (str) – IKE policy of the Customer Gateway (required).
  • ipsec_psk (str) – IPsec preshared-key of the Customer Gateway (required).
  • account (str) – The associated account with the Customer Gateway (must be used with the domain_id param).
  • domain_id (str) – The domain ID associated with the Customer Gateway. If used with the account parameter returns the gateway associated with the account for the specified domain.
  • dpd (bool) – If DPD is enabled for the VPN connection.
  • esp_lifetime (int) – Lifetime of phase 2 VPN connection to the Customer Gateway, in seconds.
  • ike_lifetime (int) – Lifetime of phase 1 VPN connection to the Customer Gateway, in seconds.
  • name (str) – Name of the Customer Gateway.
Return type:

class:CloudStackVpnCustomerGateway

ex_create_vpn_gateway(vpc, for_display=None)[source]

Creates a VPN Gateway.

Parameters:
  • vpc – VPC to create the Gateway for (required).
  • for_display (bool) – Display the VPC to the end user or not.
Return type:

class:CloudStackVpnGateway

ex_delete_affinity_group(affinity_group)[source]

Delete an Affinity Group

Parameters:affinity_group (CloudStackAffinityGroup) – Instance of affinity group

:rtype bool

ex_delete_egress_firewall_rule(firewall_rule)[source]

Remove a Firewall rule.

Parameters:egress_firewall_rule (CloudStackEgressFirewallRule) – Firewall rule which should be used
Return type:bool
ex_delete_firewall_rule(firewall_rule)[source]

Remove a Firewall Rule.

Parameters:firewall_rule (CloudStackFirewallRule) – Firewall rule which should be used
Return type:bool
ex_delete_ip_forwarding_rule(node, rule)[source]

Remove a NAT/firewall forwarding rule.

Parameters:
  • node (CloudStackNode) – Node which should be used
  • rule (CloudStackForwardingRule) – Forwarding rule which should be used
Return type:

bool

ex_delete_keypair(keypair, **kwargs)[source]

Deletes an existing SSH KeyPair

Parameters:
  • keypair (str) – Name of the keypair (required)
  • projectid (str) – The project associated with keypair
  • domainid (str) – The domain ID associated with the keypair
  • account (str) – The account associated with the keypair. Must be used with the domainId parameter.
Returns:

True of False based on success of Keypair deletion

Return type:

bool

ex_delete_network(network, force=None)[source]

Deletes a Network, only available in advanced zones.

Parameters:
  • network – The network
  • force (bool) – Force deletion of the network?
Return type:

bool

ex_delete_port_forwarding_rule(node, rule)[source]

Remove a Port forwarding rule.

Parameters:
Return type:

bool

ex_delete_security_group(name)[source]

Deletes a given Security Group

Parameters:
  • domainid (str) – The domain ID of account owning the security group
  • id (str) – The ID of the security group. Mutually exclusive with name parameter
  • name (str) – The ID of the security group. Mutually exclusive with id parameter
  • account (str) – The account of the security group. Must be specified with domain ID
  • projectid (str) – The project of the security group
Return type:

bool

ex_delete_tags(resource_ids, resource_type, tag_keys)[source]

Delete tags from a resource.

Parameters:
  • resource_ids (list of resource IDs) – Resource IDs to be tagged. The resource IDs must all be associated with the resource_type. For example, for virtual machines (UserVm) you can only specify a list of virtual machine IDs.
  • resource_type (str) – Resource type (eg: UserVm)
  • tag_keys (list) – A list of keys to delete. CloudStack only requires the keys from the key/value pair.
Return type:

bool

ex_delete_vpc(vpc)[source]

Deletes a VPC, only available in advanced zones.

Parameters:vpc – The VPC
Return type:bool
ex_delete_vpn_connection(vpn_connection)[source]

Deletes a VPN Connection.

Parameters:vpn_connection (CloudStackVpnConnection) – The VPN Connection (required).
Return type:bool
ex_delete_vpn_customer_gateway(vpn_customer_gateway)[source]

Deletes a VPN Customer Gateway.

Parameters:vpn_customer_gateway (CloudStackVpnCustomerGateway) – The VPN Customer Gateway (required).
Return type:bool
ex_delete_vpn_gateway(vpn_gateway)[source]

Deletes a VPN Gateway.

Parameters:vpn_gateway (CloudStackVpnGateway) – The VPN Gateway (required).
Return type:bool
ex_detach_nic_from_node(nic, node)[source]

Remove Nic from a VM

Parameters:
  • nic (:class:'CloudStackNetwork`) – Nic object
  • node (:class:'CloudStackNode`) – Node Object
Return type:

bool

ex_get_node(node_id, project=None)[source]

Return a Node object based on its ID.

Parameters:
  • node_id (str) – The id of the node
  • project (CloudStackProject) – Limit node returned to those configured under the defined project.
Return type:

CloudStackNode

ex_get_volume(volume_id, project=None)[source]

Return a StorageVolume object based on its ID.

Parameters:
  • volume_id (str) – The id of the volume
  • project (CloudStackProject) – Limit volume returned to those configured under the defined project.
Return type:

CloudStackNode

ex_import_keypair(name, keyfile)[source]

Imports a new public key where the public key is passed via a filename

Parameters:
  • name (str) – The name of the public key to import.
  • keyfile (str) – The filename with path of the public key to import.
Return type:

dict

ex_import_keypair_from_string(name, key_material)[source]

Imports a new public key where the public key is passed in as a string

Parameters:
  • name (str) – The name of the public key to import.
  • key_material (str) – The contents of a public key file.
Return type:

dict

ex_limits()[source]

Extra call to get account’s resource limits, such as the amount of instances, volumes, snapshots and networks.

CloudStack uses integers as the resource type so we will convert them to a more human readable string using the resource map

A list of the resource type mappings can be found at http://goo.gl/17C6Gk

Returns:dict
Return type:dict
ex_list_affinity_group_types()[source]

List Affinity Group Types

:rtype list of CloudStackAffinityGroupTypes

ex_list_affinity_groups()[source]

List Affinity Groups

:rtype list of CloudStackAffinityGroup

ex_list_disk_offerings()[source]

Fetch a list of all available disk offerings.

Return type:list of CloudStackDiskOffering
ex_list_egress_firewall_rules()[source]

Lists all egress Firewall Rules

Return type:list of CloudStackEgressFirewallRule
ex_list_firewall_rules()[source]

Lists all Firewall Rules

Return type:list of CloudStackFirewallRule
ex_list_ip_forwarding_rules(account=None, domain_id=None, id=None, ipaddress_id=None, is_recursive=None, keyword=None, list_all=None, page=None, page_size=None, project_id=None, virtualmachine_id=None)[source]

Lists all NAT/firewall forwarding rules

Parameters:
  • account (str) – List resources by account. Must be used with the domainId parameter
  • domain_id (str) – List only resources belonging to the domain specified
  • id (str) – Lists rule with the specified ID
  • ipaddress_id (str) – list the rule belonging to this public ip address
  • is_recursive (bool) – Defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.
  • keyword (str) – List by keyword
  • list_all (bool) – If set to false, list only resources belonging to the command’s caller; if set to true - list resources that the caller is authorized to see. Default value is false
  • page (int) – The page to list the keypairs from
  • page_size (int) – The number of results per page
  • project_id (str) – list objects by project
  • virtualmachine_id (str) – Lists all rules applied to the specified Vm
Return type:

list of CloudStackIPForwardingRule

ex_list_keypairs(**kwargs)[source]

List Registered SSH Key Pairs

Parameters:
  • projectid (str) – list objects by project
  • page (int) – The page to list the keypairs from
  • keyword (str) – List by keyword
  • listall (bool) – If set to false, list only resources belonging to the command’s caller; if set to true - list resources that the caller is authorized to see. Default value is false
  • pagesize (int) – The number of results per page
  • account (str) – List resources by account. Must be used with the domainId parameter
  • isrecursive (bool) – Defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.
  • fingerprint (str) – A public key fingerprint to look for
  • name (str) – A key pair name to look for
  • domainid (str) – List only resources belonging to the domain specified
Returns:

A list of keypair dictionaries

Return type:

list of dict

ex_list_network_acl()[source]

Lists all network ACL items

Return type:list of CloudStackNetworkACL
ex_list_network_acllists()[source]

Lists all network ACLs

Return type:list of CloudStackNetworkACLList
ex_list_network_offerings()[source]

List the available network offerings

:rtype list of CloudStackNetworkOffering

ex_list_networks(project=None)[source]

List the available networks

Parameters:project (CloudStackProject) – Optional project the networks belongs to.

:rtype list of CloudStackNetwork

ex_list_nics(node)[source]

List the available networks

Parameters:vm (:class:`CloudStackNode) – Node Object

:rtype list of CloudStackNic

ex_list_os_types()[source]

List all registered os types (needed for snapshot creation)

Return type:list
ex_list_port_forwarding_rules(account=None, domain_id=None, id=None, ipaddress_id=None, is_recursive=None, keyword=None, list_all=None, network_id=None, page=None, page_size=None, project_id=None)[source]

Lists all Port Forwarding Rules

Parameters:
  • account (str) – List resources by account. Must be used with the domainId parameter
  • domain_id (str) – List only resources belonging to the domain specified
  • for_display (bool) – List resources by display flag (only root admin is eligible to pass this parameter).
  • id (str) – Lists rule with the specified ID
  • ipaddress_id (str) – list the rule belonging to this public ip address
  • is_recursive (bool) – Defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.
  • keyword (str) – List by keyword
  • list_all (bool) – If set to false, list only resources belonging to the command’s caller; if set to true - list resources that the caller is authorized to see. Default value is false
  • network_id (string) – list port forwarding rules for certain network
  • page (int) – The page to list the keypairs from
  • page_size (int) – The number of results per page
  • project_id (str) – list objects by project
Return type:

list of CloudStackPortForwardingRule

ex_list_projects()[source]

List the available projects

:rtype list of CloudStackProject

ex_list_public_ips()[source]

Lists all Public IP Addresses.

Return type:list of CloudStackAddress
ex_list_routers(vpc_id=None)[source]

List routers

:rtype list of CloudStackRouter

ex_list_security_groups(**kwargs)[source]

Lists Security Groups

Parameters:
  • domainid (str) – List only resources belonging to the domain specified
  • account (str) – List resources by account. Must be used with the domainId parameter.
  • listall (bool) – If set to false, list only resources belonging to the command’s caller; if set to true list resources that the caller is authorized to see. Default value is false
  • pagesize (int) – Number of entries per page
  • keyword (str) – List by keyword
  • tags (dict) – List resources by tags (key/value pairs)
  • id (str) – list the security group by the id provided
  • securitygroupname (str) – lists security groups by name
  • virtualmachineid (str) – lists security groups by virtual machine id
  • projectid (str) – list objects by project
  • isrecursive (bool) – (boolean) defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.
  • page (int) – (integer)

:rtype list

ex_list_vpc_offerings()[source]

List the available vpc offerings

:rtype list of CloudStackVPCOffering

ex_list_vpcs(project=None)[source]

List the available VPCs

Parameters:project (CloudStackProject) – Optional project under which VPCs are present.

:rtype list of CloudStackVPC

ex_list_vpn_connections(account=None, domain_id=None, for_display=None, id=None, is_recursive=None, keyword=None, list_all=None, page=None, page_size=None, project_id=None, vpc_id=None)[source]

List VPN Connections.

Parameters:
  • account (str) – List resources by account (must be used with the domain_id parameter).
  • domain_id (str) – List only resources belonging to the domain specified.
  • for_display (bool) – List resources by display flag (only root admin is eligible to pass this parameter).
  • id (str) – ID of the VPN Connection.
  • is_recursive (bool) – Defaults to False, but if true, lists all resources from the parent specified by the domain_id till leaves.
  • keyword (str) – List by keyword.
  • list_all (str) – If set to False, list only resources belonging to the command’s caller; if set to True - list resources that the caller is authorized to see. Default value is False.
  • page (int) – Start from page.
  • page_size (int) – Items per page.
  • project_id (str) – List objects by project.
  • vpc_id (str) – List objects by VPC.
Return type:

list of CloudStackVpnConnection

ex_list_vpn_customer_gateways(account=None, domain_id=None, id=None, is_recursive=None, keyword=None, list_all=None, page=None, page_size=None, project_id=None)[source]

List VPN Customer Gateways.

Parameters:
  • account (str) – List resources by account (must be used with the domain_id parameter).
  • domain_id (str) – List only resources belonging to the domain specified.
  • id (str) – ID of the VPN Customer Gateway.
  • is_recursive (bool) – Defaults to False, but if true, lists all resources from the parent specified by the domain_id till leaves.
  • keyword (str) – List by keyword.
  • list_all (str) – If set to False, list only resources belonging to the command’s caller; if set to True - list resources that the caller is authorized to see. Default value is False.
  • page (int) – Start from page.
  • page_size (int) – Items per page.
  • project_id (str) – List objects by project.
Return type:

list of CloudStackVpnCustomerGateway

ex_list_vpn_gateways(account=None, domain_id=None, for_display=None, id=None, is_recursive=None, keyword=None, list_all=None, page=None, page_size=None, project_id=None, vpc_id=None)[source]

List VPN Gateways.

Parameters:
  • account (str) – List resources by account (must be used with the domain_id parameter).
  • domain_id (str) – List only resources belonging to the domain specified.
  • for_display (bool) – List resources by display flag (only root admin is eligible to pass this parameter).
  • id (str) – ID of the VPN Gateway.
  • is_recursive (bool) – Defaults to False, but if true, lists all resources from the parent specified by the domain ID till leaves.
  • keyword (str) – List by keyword.
  • list_all (str) – If set to False, list only resources belonging to the command’s caller; if set to True - list resources that the caller is authorized to see. Default value is False.
  • page (int) – Start from page.
  • page_size (int) – Items per page.
  • project_id (str) – List objects by project.
  • vpc_id (str) – List objects by VPC.
Return type:

list of CloudStackVpnGateway

ex_register_iso(name, url, location=None, **kwargs)[source]

Registers an existing ISO by URL.

Parameters:
  • name (str) – Name which should be used
  • url (str) – Url should be used
  • location (NodeLocation) – Location which should be used
Return type:

str

ex_release_public_ip(address)[source]

Release a public IP.

Parameters:address (CloudStackAddress) – CloudStackAddress which should be used
Return type:bool
ex_replace_network_acllist(acl_id, network_id)[source]

Create an ACL List for a network within a VPC.Replaces ACL associated with a Network or private gateway

Parameters:
  • acl_id (string) – the ID of the network ACL
  • network_id (string) – the ID of the network
Return type:

CloudStackNetworkACLList

ex_restore(node, template=None)[source]

Restore virtual machine

Parameters:
  • node (CloudStackNode) – Node to restore
  • template (NodeImage) – Optional new template

:rtype str

ex_revoke_security_group_ingress(rule_id)[source]

Revoke/delete an ingress security rule

Parameters:id (str) – The ID of the ingress security rule
Return type:bool
ex_start(node)[source]

Starts/Resumes a stopped virtual machine

Parameters:
  • id (str) – The ID of the virtual machine (required)
  • hostid (str) – destination Host ID to deploy the VM to parameter available for root admin only

:rtype str

ex_stop(node)[source]

Stops/Suspends a running virtual machine

Parameters:node (CloudStackNode) – Node to stop.
Return type:str
ex_update_node_affinity_group(node, affinity_group_list)[source]

Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect.

Parameters:

:rtype CloudStackNode

features = {'create_node': ['generates_password']}
get_key_pair(name)[source]

Retrieve a single key pair.

Parameters:name (str) – Name of the key pair to retrieve.
Return type:KeyPair
import_key_pair_from_string(name, key_material)[source]

Import a new public key from string.

Parameters:
  • name (str) – Key pair name.
  • key_material (str) – Public key material.
Returns:

Imported key pair object.

Return type:

libcloud.compute.base.KeyPair

list_images(location=None)[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 of NodeImage
list_key_pairs(**kwargs)[source]

List registered key pairs.

Parameters:
  • projectid (str) – list objects by project
  • page (int) – The page to list the keypairs from
  • keyword (str) – List by keyword
  • listall (bool) – If set to false, list only resources belonging to the command’s caller; if set to true - list resources that the caller is authorized to see. Default value is false
  • pagesize (int) – The number of results per page
  • account (str) – List resources by account. Must be used with the domainId parameter
  • isrecursive (bool) – Defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.
  • fingerprint (str) – A public key fingerprint to look for
  • name (str) – A key pair name to look for
  • domainid (str) – List only resources belonging to the domain specified
Returns:

A list of key par objects.

Return type:

list of libcloud.compute.base.KeyPair

list_locations()[source]

:rtype list of NodeLocation

list_nodes(project=None, location=None)[source]

@inherits: NodeDriver.list_nodes

Parameters:
  • project (CloudStackProject) – Limit nodes returned to those configured under the defined project.
  • location (NodeLocation) – Limit nodes returned to those in the defined location.
Return type:

list of CloudStackNode

list_sizes(location=None)[source]

:rtype list of NodeSize

list_snapshots()[source]

Describe all snapshots.

Return type:list of VolumeSnapshot
list_volumes(node=None)[source]

List all volumes

Parameters:node (CloudStackNode) – Only return volumes for the provided node.
Return type:list of StorageVolume
name = 'CloudStack'
reboot_node(node)[source]

@inherits: NodeDriver.reboot_node :type node: CloudStackNode

Return type:bool
type = 'cloudstack'
website = 'http://cloudstack.org/'
class libcloud.compute.drivers.cloudstack.CloudStackPortForwardingRule(node, rule_id, address, protocol, public_port, private_port, public_end_port=None, private_end_port=None, network_id=None)[source]

Bases: object

A Port forwarding rule for Source NAT.

A Port forwarding rule for Source NAT.

@note: This is a non-standard extension API, and only works for EC2.

Parameters:
  • node (Node) – Node for rule
  • rule_id (int) – Rule ID
  • address (CloudStackAddress) – External IP address
  • protocol (str) – TCP/IP Protocol (TCP, UDP)
  • public_port (int) – External port for rule (or start port if public_end_port is also provided)
  • private_port (int) – Internal node port for rule (or start port if public_end_port is also provided)
  • public_end_port (int) – End of external port range
  • private_end_port (int) – End of internal port range
  • network_id (str) – The network of the vm the Port Forwarding rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)
Return type:

CloudStackPortForwardingRule

delete()[source]
class libcloud.compute.drivers.cloudstack.CloudStackProject(id, name, display_text, driver, extra=None)[source]

Bases: object

Class representing a CloudStack Project.

class libcloud.compute.drivers.cloudstack.CloudStackRouter(id, name, state, public_ip, vpc_id, driver)[source]

Bases: object

Class representing a CloudStack Router.

class libcloud.compute.drivers.cloudstack.CloudStackVPC(name, vpc_offering_id, id, cidr, driver, zone_id=None, display_text=None, extra=None)[source]

Bases: object

Class representing a CloudStack VPC.

class libcloud.compute.drivers.cloudstack.CloudStackVPCOffering(name, display_text, id, driver, extra=None)[source]

Bases: object

Class representing a CloudStack VPC Offering.

class libcloud.compute.drivers.cloudstack.CloudStackVpnConnection(id, passive, vpn_customer_gateway_id, vpn_gateway_id, state, driver, extra=None)[source]

Bases: object

Class representing a CloudStack VPN Connection.

delete()[source]
vpn_customer_gateway
vpn_gateway
class libcloud.compute.drivers.cloudstack.CloudStackVpnCustomerGateway(id, cidr_list, esp_policy, gateway, ike_policy, ipsec_psk, driver, extra=None)[source]

Bases: object

Class representing a CloudStack VPN Customer Gateway.

delete()[source]
class libcloud.compute.drivers.cloudstack.CloudStackVpnGateway(id, account, domain, domain_id, public_ip, vpc_id, driver, extra=None)[source]

Bases: object

Class representing a CloudStack VPN Gateway.

delete()[source]
vpc
libcloud.compute.drivers.cloudstack.transform_int_or_unlimited(value)[source]

libcloud.compute.drivers.digitalocean module

DigitalOcean Driver

class libcloud.compute.drivers.digitalocean.DigitalOceanNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

DigitalOcean NodeDriver defaulting to using APIv2.

Parameters:
  • key (str) – Personal Access Token required for authentication.
  • secret (str) – Previously used with API version v1. (deprecated)
  • api_version (str) – Specifies the API version to use. Defaults to using v2, currently the only valid option. (optional)
  • 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 – 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

name = 'DigitalOcean'
type = 'digitalocean'
website = 'https://www.digitalocean.com'
class libcloud.compute.drivers.digitalocean.DigitalOcean_v2_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, ex_per_page=200, **kwargs)[source]

Bases: libcloud.common.digitalocean.DigitalOcean_v2_BaseDriver, libcloud.compute.drivers.digitalocean.DigitalOceanNodeDriver

DigitalOcean NodeDriver using v2 of the API.

EX_CREATE_ATTRIBUTES = ['backups', 'ipv6', 'private_networking', 'tags', 'ssh_keys']
NODE_STATE_MAP = {'active': running, 'archive': terminated, 'new': pending, 'off': stopped}
attach_volume(node, volume, device=None)[source]

Attaches volume to node.

Parameters:
  • node (Node) – Node to attach volume to.
  • volume (StorageVolume) – Volume to attach.
  • device (str) – Where the device is exposed, e.g. ‘/dev/sdb’
Rytpe:

bool

create_image(node, name)[source]

Create an image from a Node.

@inherits: NodeDriver.create_image

Parameters:
  • node (str) – Node to use as base for image
  • node – Name for image
Return type:

bool

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_create_attr=None, ex_ssh_key_ids=None, ex_user_data=None)[source]

Create a node.

The ex_create_attr parameter can include the following dictionary key and value pairs:

  • backups: bool defaults to False
  • ipv6: bool defaults to False
  • private_networking: bool defaults to False
  • tags: list of str tags
  • user_data: str for cloud-config data
  • ssh_keys: list of int key ids or str fingerprints

ex_create_attr[‘ssh_keys’] will override ex_ssh_key_ids assignment.

Parameters:
  • ex_create_attr (dict) – A dictionary of optional attributes for droplet creation
  • ex_ssh_key_ids (list of int key ids or str key fingerprints) – A list of ssh key ids which will be added to the server. (optional)
  • ex_user_data (str) – User data to be added to the node on create. (optional)
Returns:

The newly created node.

Return type:

Node

create_volume(size, name, location=None, snapshot=None)[source]

Create a new volume.

Parameters:
  • size (int) – Size of volume in gigabytes (required)
  • name (str) – Name of the volume to be created
  • location (NodeLocation) – Which data center to create a volume in. If empty, undefined behavior will be selected. (optional)
  • snapshot (VolumeSnapshot) – Snapshot from which to create the new volume. (optional)
Returns:

The newly created volume.

Return type:

StorageVolume

create_volume_snapshot(volume, name)[source]

Create a new volume snapshot.

Parameters:volume (class:StorageVolume) – Volume to create a snapshot for
Returns:The newly created volume snapshot.
Return type:VolumeSnapshot
delete_image(image)[source]

Delete an image for node.

@inherits: NodeDriver.delete_image

Parameters:image (NodeImage) – the image to be deleted
Return type:bool
delete_key_pair(key)[source]

Delete an existing SSH key.

Parameters:key (KeyPair) – SSH key (required)
delete_volume_snapshot(snapshot)[source]

Delete a volume snapshot

Parameters:snapshot (class:VolumeSnapshot) – volume snapshot to delete
Return type:bool
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
destroy_volume(volume)[source]

Destroys a storage volume.

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
detach_volume(volume)[source]

Detaches a volume from a node.

Parameters:volume (StorageVolume) – Volume to be detached
Return type:bool
ex_attach_floating_ip_to_node(node, ip)[source]

Attach the floating IP to the node

Parameters:
  • node (Node) – node
  • ip (str or DigitalOcean_v2_FloatingIpAddress) – floating IP to attach
Return type:

bool

ex_change_kernel(node, kernel_id)[source]
ex_create_floating_ip(location)[source]

Create new floating IP reserved to a region.

The newly created floating IP will not be associated to a Droplet.

See https://developers.digitalocean.com/documentation/v2/#floating-ips

Parameters:location (NodeLocation) – Which data center to create the floating IP in.
Return type:DigitalOcean_v2_FloatingIpAddress
ex_delete_floating_ip(ip)[source]

Delete specified floating IP

Parameters:ip (DigitalOcean_v2_FloatingIpAddress) – floating IP to remove
Return type:bool
ex_detach_floating_ip_from_node(node, ip)[source]

Detach a floating IP from the given node

Note: the ‘node’ object is not used in this method but it is added to the signature of ex_detach_floating_ip_from_node anyway so it conforms to the interface of the method of the same name for other drivers like for example OpenStack.

Parameters:
  • node (Node) – Node from which the IP should be detached
  • ip (DigitalOcean_v2_FloatingIpAddress) – Floating IP to detach
Return type:

bool

ex_enable_ipv6(node)[source]
ex_get_floating_ip(ip)[source]

Get specified floating IP

Parameters:ip (str) – floating IP to get
Return type:DigitalOcean_v2_FloatingIpAddress
ex_get_node_details(node_id)[source]

Lists details of the specified server.

Parameters:node_id (str) – ID of the node which should be used
Return type:Node
ex_hard_reboot(node)[source]
ex_list_floating_ips()[source]

List floating IPs

Return type:list of DigitalOcean_v2_FloatingIpAddress
ex_power_on_node(node)[source]
ex_rebuild_node(node)[source]

Destroy and rebuild the node using its base image.

Parameters:node (Node) – Node to rebuild

:return True if the operation began successfully :rtype bool

ex_rename_node(node, name)[source]
ex_resize_node(node, size)[source]

Resize the node to a different machine size. Note that some resize operations are reversible, and others are irreversible.

Parameters:
  • node (NodeSize) – Node to rebuild
  • size – New size for this machine

:return True if the operation began successfully :rtype bool

ex_shutdown_node(node)[source]
get_image(image_id)[source]

Get an image based on an image_id

@inherits: NodeDriver.get_image

Parameters:image_id (int) – Image identifier
Returns:A NodeImage object
Return type:NodeImage
get_key_pair(name)[source]

Retrieve a single key pair.

Parameters:name (str) – Name of the key pair to retrieve.
Return type:KeyPair
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 of NodeImage
list_key_pairs()[source]

List all the available SSH keys.

Returns:Available SSH keys.
Return type:list of KeyPair
list_locations(ex_available=True)[source]

List locations

Parameters:ex_available – Only return locations which are available.
list_nodes()[source]

List all nodes.

Returns:list of node objects
Return type:list of Node
list_sizes(location=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 of NodeSize
list_volume_snapshots(volume)[source]

List snapshots for a volume.

Parameters:volume (class:StorageVolume) – Volume to list snapshots for
Returns:List of volume snapshots.
Return type:list of :class: StorageVolume
list_volumes()[source]

List storage volumes.

Return type:list of StorageVolume
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

libcloud.compute.drivers.dimensiondata module

Dimension Data Driver

class libcloud.compute.drivers.dimensiondata.DimensionDataNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region='dd-na', **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

DimensionData node driver. Default api_version is used unless specified.

api_version = 1.0
connectionCls

alias of libcloud.common.dimensiondata.DimensionDataConnection

create_node(name, image, auth, ex_network_domain=None, ex_primary_nic_private_ipv4=None, ex_primary_nic_vlan=None, ex_primary_nic_network_adapter=None, ex_additional_nics=None, ex_description=None, ex_disks=None, ex_cpu_specification=None, ex_memory_gb=None, ex_is_started=True, ex_primary_dns=None, ex_secondary_dns=None, ex_ipv4_gateway=None, ex_microsoft_time_zone=None, **kwargs)[source]

Create a new DimensionData node in MCP2. However, it is still backward compatible for MCP1 for a limited time. Please consider using MCP2 datacenter as MCP1 will phase out soon.

Legacy Create Node for MCP1 datacenter

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.base import NodeAuthPassword
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get dimension data driver
>>> libcloud.security.VERIFY_SSL_CERT = False
>>> DimensionData = get_driver(Provider.DIMENSIONDATA)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Password
>>> root_pw = NodeAuthPassword('password123')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU1')
>>>
>>> # Get network by location
>>> my_network = driver.list_networks(location=location)[0]
>>> pprint(my_network)
>>>
>>> # Get Image
>>> images = driver.list_images(location=location)
>>> image = images[0]
>>>
>>> node = driver.create_node(name='test_blah_2', image=image,
>>>                           auth=root_pw,
>>>                           ex_description='test3 node',
>>>                           ex_network=my_network,
>>>                           ex_is_started=False)
>>> pprint(node)

Create Node in MCP2 Data Center

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.base import NodeAuthPassword
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get dimension data driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.DIMENSIONDATA)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Password
>>> root_pw = NodeAuthPassword('password123')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> vlan = driver.ex_list_vlans(location=location,
>>>                             network_domain=my_network_domain)[0]
>>> pprint(vlan)
>>>
>>> # Get Image
>>> images = driver.list_images(location=location)
>>> image = images[0]
>>>
>>> # Create node using vlan instead of private IPv4
>>> node = driver.create_node(name='test_server_01', image=image,
>>>                           auth=root_pw,
>>>                           ex_description='test2 node',
>>>                           ex_network_domain=my_network_domain,
>>>                           ex_primary_nic_vlan=vlan,
>>>                           ex_is_started=False)
>>>
>>> # Option: Create node using private IPv4 instead of vlan
>>> # node = driver.create_node(name='test_server_02', image=image,
>>> #                           auth=root_pw,
>>> #                           ex_description='test2 node',
>>> #                           ex_network_domain=my_network_domain,
>>> #                           ex_primary_nic_private_ipv4='10.1.1.7',
>>> #                           ex_is_started=False)
>>>
>>> # Option: Create node using by specifying Network Adapter
>>> # node = driver.create_node(name='test_server_03', image=image,
>>> #                           auth=root_pw,
>>> #                           ex_description='test2 node',
>>> #                           ex_network_domain=my_network_domain,
>>> #                           ex_primary_nic_vlan=vlan,
>>> #                           ex_primary_nic_network_adapter='E1000',
>>> #                           ex_is_started=False)
>>>
Parameters:
  • name (str) – (required) String with a name for this new node
  • image (NodeImage or str) – (required) OS Image to boot on node.
  • auth (NodeAuthPassword or str or None) – Initial authentication information for the node. (If this is a customer LINUX image auth will be ignored)
  • ex_description (str) – (optional) description for this node
  • ex_network_domain (DimensionDataNetworkDomain or str) – (required) Network Domain or Network Domain ID to create the node
  • ex_primary_nic_private_ipv4 (:str) – Provide private IPv4. Ignore if ex_primary_nic_vlan is provided. Use one or the other. Not both.
  • ex_primary_nic_vlan – Provide VLAN for the node if ex_primary_nic_private_ipv4 NOT provided. One or the other. Not both.
  • ex_primary_nic_network_adapter (:str) – (Optional) Default value for the Operating System will be used if leave empty. Example: “E1000”.
  • ex_additional_nics (list of :class:’DimensionDataNic’ or str) – (optional) List :class:’DimensionDataNic’ or None
  • ex_memory_gb (int) – (optional) The amount of memory in GB for the server Can be used to override the memory value inherited from the source Server Image.
  • ex_cpu_specification (DimensionDataServerCpuSpecification) – (optional) The spec of CPU to deploy
  • ex_is_started (bool) – (required) Start server after creation. Default is set to true.
  • ex_primary_dns (str) – (Optional) The node’s primary DNS
  • ex_secondary_dns (str) – (Optional) The node’s secondary DNS
  • ex_ipv4_gateway (str) – (Optional) IPv4 address in dot-decimal notation, which will be used as the Primary NIC gateway instead of the default gateway assigned by the system. If ipv4Gateway is provided it does not have to be on the VLAN of the Primary NIC but MUST be reachable or the Guest OS will not be configured correctly.
  • ex_disks (List or tuple of :class:'DimensionDataServerDisk`) – (optional) Dimensiondata disks. Optional disk elements can be used to define the disk speed that each disk on the Server; inherited from the source Server Image will be deployed to. It is not necessary to include a diskelement for every disk; only those that you wish to set a disk speed value for. Note that scsiId 7 cannot be used.Up to 13 disks can be present in addition to the required OS disk on SCSI ID 0. Refer to https://docs.mcp-services.net/x/UwIu for disk
  • ex_microsoft_time_zone (str`) – (optional) For use with Microsoft Windows source Server Images only. For the exact value to use please refer to the table of time zone indexes in the following Microsoft Technet documentation. If none is supplied, the default time zone for the data center geographic region will be used.
Returns:

The newly created Node.

Return type:

Node

destroy_node(node)[source]

Deletes a node, node must be stopped before deletion

Parameters:node (Node) – The node to delete
Return type:bool
ex_add_public_ip_block_to_network_domain(network_domain)[source]
ex_add_storage_to_node(node, amount, speed='STANDARD', scsi_id=None)[source]

Add storage to the node

Parameters:
  • node (Node) – The server to add storage to
  • amount (int) – The amount of storage to add, in GB
  • speed (str) – The disk speed type
  • scsi_id (int) – The target SCSI ID (optional)
Return type:

bool

ex_apply_tag_to_asset(asset, tag_key, value=None)[source]

Apply a tag to a Dimension Data Asset

Parameters:
  • asset (Node or NodeImage or DimensionDataNewtorkDomain or DimensionDataVlan or DimensionDataPublicIpBlock) – The asset to apply a tag to. (required)
  • tag_key (DimensionDataTagKey or str) – The tag_key to apply to the asset. (required)
  • value (str) – The value to be assigned to the tag key This is only required if the DimensionDataTagKey requires it
Return type:

bool

ex_attach_node_to_vlan(node, vlan=None, private_ipv4=None)[source]

Attach a node to a VLAN by adding an additional NIC to the node on the target VLAN. The IP will be automatically assigned based on the VLAN IP network space. Alternatively, provide a private IPv4 address instead of VLAN information, and this will be assigned to the node on corresponding NIC.

Parameters:
  • node (Node) – Node which should be used
  • vlan (DimensionDataVlan) – VLAN to attach the node to (required unless private_ipv4)
  • private_ipv4 (str) – Private nic IPv4 Address (required unless vlan)
Return type:

bool

ex_audit_log_report(start_date, end_date)[source]

Get audit log report

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
Return type:

list of list

ex_backup_usage_report(start_date, end_date, location)[source]

Get audit log report

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
  • location (NodeLocation or str) – Filters the node list to nodes that are located in this location
Return type:

list of list

ex_change_nic_network_adapter(nic_id, network_adapter_name)[source]

Change network adapter of a NIC on a cloud server

Parameters:
  • nic_id (:str) – Nic ID
  • network_adapter_name (:str) – Network adapter name
Return type:

bool

ex_change_storage_size(node, disk_id, size)[source]

Change the size of a disk

Parameters:
  • node (Node) – The server to change the disk of
  • disk_id (str) – The ID of the disk to resize
  • size (int) – The disk size in GB
Return type:

bool

ex_change_storage_speed(node, disk_id, speed)[source]

Change the speed (disk tier) of a disk

Parameters:
  • node (Node) – The server to change the disk speed of
  • disk_id (str) – The ID of the disk to change
  • speed (str) – The disk speed type e.g. STANDARD
Return type:

bool

ex_clean_failed_deployment(node)[source]

Removes a node that has failed to deploy

Parameters:node (Node or str) – The failed node to clean
ex_clone_node_to_image(node, image_name, image_description=None, cluster_id=None, is_guest_Os_Customization=None, tag_key_id=None, tag_value=None)[source]

Clone a server into a customer image.

Parameters:
  • node (Node) – The server to clone
  • image_name (str) – The name of the clone image
  • description (str) – The description of the image
Return type:

bool

ex_create_anti_affinity_rule(node_list)[source]

Create an anti affinity rule given a list of nodes Anti affinity rules ensure that servers will not reside on the same VMware ESX host

Parameters:node_list (list of Node or list of str) – The list of nodes to create a rule for
Return type:bool
ex_create_firewall_rule(network_domain, rule, position, position_relative_to_rule=None)[source]

Creates a firewall rule

Parameters:
  • network_domain (DimensionDataNetworkDomain or str) – The network domain in which to create the firewall rule
  • rule (DimensionDataFirewallRule) – The rule in which to create
  • position (str) – The position in which to create the rule There are two types of positions with position_relative_to_rule arg and without it With: ‘BEFORE’ or ‘AFTER’ Without: ‘FIRST’ or ‘LAST’
  • position_relative_to_rule (DimensionDataFirewallRule or str) – The rule or rule name in which to decide positioning by
Return type:

bool

ex_create_ip_address_list(ex_network_domain, name, description, ip_version, ip_address_collection, child_ip_address_list=None)[source]

Create IP Address List. IP Address list.

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> from libcloud.common.dimensiondata import DimensionDataIpAddress
>>> import libcloud.security
>>>
>>> # Get dimension data driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.DIMENSIONDATA)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> # IP Address collection
>>> ipAddress_1 = DimensionDataIpAddress(begin='190.2.2.100')
>>> ipAddress_2 = DimensionDataIpAddress(begin='190.2.2.106',
                                         end='190.2.2.108')
>>> ipAddress_3 = DimensionDataIpAddress(begin='190.2.2.0',
                                         prefix_size='24')
>>> ip_address_collection = [ipAddress_1, ipAddress_2, ipAddress_3]
>>>
>>> # Create IPAddressList
>>> result = driver.ex_create_ip_address_list(
>>>     ex_network_domain=my_network_domain,
>>>     name='My_IP_AddressList_2',
>>>     ip_version='IPV4',
>>>     description='Test only',
>>>     ip_address_collection=ip_address_collection,
>>>     child_ip_address_list='08468e26-eeb3-4c3d-8ff2-5351fa6d8a04'
>>> )
>>>
>>> pprint(result)
Parameters:
  • ex_network_domain (DimensionDataNetworkDomain or ‘str’) – The network domain or network domain ID
  • name (:str) – IP Address List Name (required)
  • description (:str) – IP Address List Description (optional)
  • ip_version (:str) – IP Version of ip address (required)
  • ip_address_collection (:str) – List of IP Address. At least one ipAddress element or one childIpAddressListId element must be provided.
  • child_ip_address_list (:class:’DimensionDataChildIpAddressList` or str`) – Child IP Address List or id to be included in this IP Address List. At least one ipAddress or one childIpAddressListId must be provided.
Returns:

a list of DimensionDataIpAddressList objects

Return type:

list of DimensionDataIpAddressList

ex_create_nat_rule(network_domain, internal_ip, external_ip)[source]

Create a NAT rule

Parameters:
  • network_domain (DimensionDataNetworkDomain) – The network domain the rule belongs to
  • internal_ip (str) – The IPv4 address internally
  • external_ip (str) – The IPv4 address externally
Return type:

DimensionDataNatRule

ex_create_network(location, name, description=None)[source]

Create a new network in an MCP 1.0 location

Parameters:
  • location (NodeLocation or str) – The target location (MCP1)
  • name (str) – The name of the network
  • description (str) – Additional description of the network
Returns:

A new instance of DimensionDataNetwork

Return type:

Instance of DimensionDataNetwork

ex_create_network_domain(location, name, service_plan, description=None)[source]

Deploy a new network domain to a data center

Parameters:
  • location (NodeLocation or str) – The data center to list
  • name (str) – The name of the network domain to create
  • service_plan (str) – The service plan, either “ESSENTIALS” or “ADVANCED”
  • description (str) – An additional description of the network domain
Returns:

an instance of DimensionDataNetworkDomain

Return type:

DimensionDataNetworkDomain

ex_create_node_uncustomized(name, image, ex_network_domain, ex_is_started=True, ex_description=None, ex_cluster_id=None, ex_cpu_specification=None, ex_memory_gb=None, ex_primary_nic_private_ipv4=None, ex_primary_nic_vlan=None, ex_primary_nic_network_adapter=None, ex_additional_nics=None, ex_disks=None, ex_tagid_value_pairs=None, ex_tagname_value_pairs=None)[source]

This MCP 2.0 only function deploys a new Cloud Server from a CloudControl compatible Server Image, which does not utilize VMware Guest OS Customization process.

Create Node in MCP2 Data Center

Parameters:
  • name (str) – (required) String with a name for this new node
  • image (NodeImage or str) – (UUID of the Server Image being used as the target for the new Server deployment. The source Server Image (OS Image or Customer Image) must have osCustomization set to true. See Get/List OS Image(s) and Get/List Customer Image(s).
  • ex_network_domain (DimensionDataNetworkDomain or str) – (required) Network Domain or Network Domain ID to create the node
  • ex_description (str) – (optional) description for this node
  • ex_cluster_id – (optional) For multiple cluster

environments, it is possible to set a destination cluster for the new Customer Image. Note that performance of this function is optimal when either the Server cluster and destination are the same or when shared data storage is in place for the multiple clusters. :type ex_cluster_id: str

Parameters:
  • ex_primary_nic_private_ipv4 (:str) – Provide private IPv4. Ignore if ex_primary_nic_vlan is provided. Use one or the other. Not both.
  • ex_primary_nic_vlan – Provide VLAN for the node if ex_primary_nic_private_ipv4 NOT provided. One or the other. Not both.
  • ex_primary_nic_network_adapter (:str) – (Optional) Default value for the Operating System will be used if leave empty. Example: “E1000”.
  • ex_additional_nics (list of :class:’DimensionDataNic’ or str) – (optional) List :class:’DimensionDataNic’ or None
  • ex_memory_gb (int) – (optional) The amount of memory in GB for the server Can be used to override the memory value inherited from the source Server Image.
  • ex_cpu_specification (DimensionDataServerCpuSpecification) – (optional) The spec of CPU to deploy
  • ex_is_started (bool) – (required) Start server after creation. Default is set to true.
  • ex_disks (List or tuple of :class:'DimensionDataServerDisk`) – (optional) Dimensiondata disks. Optional disk elements can be used to define the disk speed that each disk on the Server; inherited from the source Server Image will be deployed to. It is not necessary to include a diskelement for every disk; only those that you wish to set a disk speed value for. Note that scsiId 7 cannot be used.Up to 13 disks can be present in addition to the required OS disk on SCSI ID 0. Refer to https://docs.mcp-services.net/x/UwIu for disk
  • ex_tagid_value_pairs – (Optional) up to 10 tag elements may be provided. A combination of tagById and tag name cannot be supplied in the same request. Note: ex_tagid_value_pairs and ex_tagname_value_pairs is mutually exclusive. Use one or other.
  • ex_tagname_value_pairs (dict`.) – (Optional) up to 10 tag elements may be provided. A combination of tagById and tag name cannot be supplied in the same request. Note: ex_tagid_value_pairs and ex_tagname_value_pairs is mutually exclusive. Use one or other.
Returns:

The newly created Node.

Return type:

Node

ex_create_portlist(ex_network_domain, name, description, port_collection, child_portlist_list=None)[source]

Create Port List.

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> from libcloud.common.dimensiondata import DimensionDataPort
>>> import libcloud.security
>>>
>>> # Get dimension data driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.DIMENSIONDATA)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> # Port Collection
>>> port_1 = DimensionDataPort(begin='1000')
>>> port_2 = DimensionDataPort(begin='1001', end='1003')
>>> port_collection = [port_1, port_2]
>>>
>>> # Create Port List
>>> new_portlist = driver.ex_create_portlist(
>>>     ex_network_domain=my_network_domain,
>>>     name='MyPortListX',
>>>     description="Test only",
>>>     port_collection=port_collection,
>>>     child_portlist_list={'a9cd4984-6ff5-4f93-89ff-8618ab642bb9'}
>>>     )
>>> pprint(new_portlist)
Parameters:
  • ex_network_domain (:str) – (required) The network domain in which to create PortList. Provide networkdomain object or its id.
  • name (:str) – Port List Name
  • description (:str) – IP Address List Description
  • port_collection (:str) – List of Port Address
  • child_portlist_list (:str or ‘’list of :class:’DimensionDataChildPortList’) – List of Child Portlist to be included in this Port List
Returns:

result of operation

Return type:

bool

ex_create_tag_key(name, description=None, value_required=True, display_on_report=True)[source]

Creates a tag key in the Dimension Data Cloud

Parameters:
  • name (str) – The name of the tag key (required)
  • description (str) – The description of the tag key
  • value_required (bool) – If a value is required for the tag Tags themselves can be just a tag, or be a key/value pair
  • display_on_report (bool) – Should this key show up on the usage reports
Return type:

bool

ex_create_vlan(network_domain, name, private_ipv4_base_address, description=None, private_ipv4_prefix_size=24)[source]

Deploy a new VLAN to a network domain

Parameters:
  • network_domain (DimensionDataNetworkDomain) – The network domain to add the VLAN to
  • name (str) – The name of the VLAN to create
  • private_ipv4_base_address (str) – The base IPv4 address e.g. 192.168.1.0
  • description (str) – An additional description of the VLAN
  • private_ipv4_prefix_size (int) – The size of the IPv4 address space, e.g 24
Returns:

an instance of DimensionDataVlan

Return type:

DimensionDataVlan

ex_delete_anti_affinity_rule(anti_affinity_rule)[source]

Remove anti affinity rule

Parameters:anti_affinity_rule (DimensionDataAntiAffinityRule or str) – The anti affinity rule to delete
Return type:bool
ex_delete_firewall_rule(rule)[source]

Delete a firewall rule

Parameters:rule (DimensionDataFirewallRule) – The rule to delete
Return type:bool
ex_delete_ip_address_list(ex_ip_address_list)[source]

Delete IP Address List by ID

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get dimension data driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.DIMENSIONDATA)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> ip_address_list_id = '5e7c323f-c885-4e4b-9a27-94c44217dbd3'
>>> result = driver.ex_delete_ip_address_list(ip_address_list_id)
>>> pprint(result)
Parameters:ex_ip_address_list (:class:’DimensionDataIpAddressList’ or str) – IP Address List object or IP Address List ID (required)
Return type:bool
ex_delete_nat_rule(rule)[source]

Delete an existing NAT rule

Parameters:rule (DimensionDataNatRule) – The rule to delete
Return type:bool
ex_delete_network(network)[source]

Delete a network from an MCP 1 data center

Parameters:network (DimensionDataNetwork) – The network to delete
Return type:bool
ex_delete_network_domain(network_domain)[source]

Delete a network domain

Parameters:network_domain (DimensionDataNetworkDomain) – The network domain to delete
Return type:bool
ex_delete_portlist(ex_portlist)[source]

Delete Port List

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get dimension data driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.DIMENSIONDATA)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Delete Port List
>>> portlist_id = '157531ce-77d4-493c-866b-d3d3fc4a912a'
>>> response = driver.ex_delete_portlist(portlist_id)
>>> pprint(response)
Parameters:ex_portlist (:str or :class:’DimensionDataPortList’) – Port List to be deleted
Return type:bool
ex_delete_public_ip_block(block)[source]
ex_delete_vlan(vlan)[source]

Deletes an existing VLAN

Parameters:vlan (DimensionDataNetworkDomain) – The VLAN to delete
Return type:bool
ex_destroy_nic(nic_id)[source]

Remove a NIC on a node, removing the node from a VLAN

Parameters:nic_id (str) – The identifier of the NIC to remove
Return type:bool
ex_detailed_usage_report(start_date, end_date)[source]

Get detailed usage information

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
Return type:

list of list

ex_disable_monitoring(node)[source]

Disables cloud monitoring for a node

Parameters:node (Node) – The node to stop monitoring
Return type:bool
ex_edit_firewall_rule(rule, position, relative_rule_for_position=None)[source]

Edit a firewall rule

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get dimension data driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.DIMENSIONDATA)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>>
>>> # List firewall rules
>>> firewall_rules = driver.ex_list_firewall_rules(my_network_domain)
>>>
>>> # Get Firewall Rule by name
>>> pprint("List specific firewall rule by name")
>>> fire_rule_under_test = (list(filter(lambda x: x.name ==
                           'My_New_Firewall_Rule', firewall_rules))[0])
>>> pprint(fire_rule_under_test.source)
>>> pprint(fire_rule_under_test.destination)
>>>
>>> # Edit Firewall
>>> fire_rule_under_test.destination.address_list_id =
        '5e7c323f-c885-4e4b-9a27-94c44217dbd3'
>>> fire_rule_under_test.destination.port_list_id =
        'b6557c5a-45fa-4138-89bd-8fe68392691b'
>>> result = driver.ex_edit_firewall_rule(fire_rule_under_test, 'LAST')
>>> pprint(result)
Parameters:
  • rule (DimensionDataFirewallRule) – (required) The rule in which to create
  • position (str) – (required) There are two types of positions with position_relative_to_rule arg and without it With: ‘BEFORE’ or ‘AFTER’ Without: ‘FIRST’ or ‘LAST’
  • relative_rule_for_position (DimensionDataFirewallRule or str) – (optional) The rule or rule name in which to decide the relative rule for positioning.
Return type:

bool

ex_edit_ip_address_list(ex_ip_address_list, description, ip_address_collection, child_ip_address_lists=None)[source]

Edit IP Address List. IP Address list.

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> from libcloud.common.dimensiondata import DimensionDataIpAddress
>>> import libcloud.security
>>>
>>> # Get dimension data driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.DIMENSIONDATA)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # IP Address collection
>>> ipAddress_1 = DimensionDataIpAddress(begin='190.2.2.100')
>>> ipAddress_2 = DimensionDataIpAddress(begin='190.2.2.106',
>>>                                      end='190.2.2.108')
>>> ipAddress_3 = DimensionDataIpAddress(
>>>                   begin='190.2.2.0', prefix_size='24')
>>> ip_address_collection = [ipAddress_1, ipAddress_2, ipAddress_3]
>>>
>>> # Edit IP Address List
>>> ip_address_list_id = '5e7c323f-c885-4e4b-9a27-94c44217dbd3'
>>> result = driver.ex_edit_ip_address_list(
>>>      ex_ip_address_list=ip_address_list_id,
>>>      description="Edit Test",
>>>      ip_address_collection=ip_address_collection,
>>>      child_ip_address_lists=None
>>>      )
>>> pprint(result)
Parameters:
  • ex_ip_address_list (:class:’DimensionDataIpAddressList’ or str) – (required) IpAddressList object or IpAddressList ID
  • description (:str) – IP Address List Description
  • ip_address_collection (''list'' of :class:'DimensionDataIpAddressList') – List of IP Address
  • child_ip_address_lists (list of :class:’DimensionDataChildIpAddressList’ or str) – Child IP Address List or id to be included in this IP Address List
Returns:

a list of DimensionDataIpAddressList objects

Return type:

list of DimensionDataIpAddressList

ex_edit_portlist(ex_portlist, description, port_collection, child_portlist_list=None)[source]

Edit Port List.

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> from libcloud.common.dimensiondata import DimensionDataPort
>>> import libcloud.security
>>>
>>> # Get dimension data driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.DIMENSIONDATA)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Port Collection
>>> port_1 = DimensionDataPort(begin='4200')
>>> port_2 = DimensionDataPort(begin='4201', end='4210')
>>> port_collection = [port_1, port_2]
>>>
>>> # Edit Port List
>>> editPortlist = driver.ex_get_portlist(
    '27dd8c66-80ff-496b-9f54-2a3da2fe679e')
>>>
>>> result = driver.ex_edit_portlist(
>>>     ex_portlist=editPortlist.id,
>>>     description="Make Changes in portlist",
>>>     port_collection=port_collection,
>>>     child_portlist_list={'a9cd4984-6ff5-4f93-89ff-8618ab642bb9'}
>>> )
>>> pprint(result)
Parameters:
  • ex_portlist (:str or :class:’DimensionDataPortList’) – Port List to be edited (required)
  • description (:str) – Port List Description
  • port_collection (:str) – List of Ports
  • child_portlist_list (:list of :class’DimensionDataChildPortList’ or ‘’str’’) – Child PortList to be included in this IP Address List
Returns:

a list of DimensionDataPortList objects

Return type:

list of DimensionDataPortList

ex_enable_monitoring(node, service_plan='ESSENTIALS')[source]

Enables cloud monitoring on a node

Parameters:
  • node (Node) – The node to monitor
  • service_plan (str) – The service plan, one of ESSENTIALS or ADVANCED
Return type:

bool

ex_exchange_nic_vlans(nic_id_1, nic_id_2)[source]

Exchange NIC Vlans

Parameters:
  • nic_id_1 (:str) – Nic ID 1
  • nic_id_2 (:str) – Nic ID 2
Return type:

bool

ex_expand_vlan(vlan)[source]

Expands the VLAN to the prefix size in private_ipv4_range_size The expansion will not be permitted if the proposed IP space overlaps with an already deployed VLANs IP space.

Parameters:vlan (DimensionDataNetworkDomain) – The VLAN to update
Returns:an instance of DimensionDataVlan
Return type:DimensionDataVlan
ex_get_base_image_by_id(id)[source]

Gets a Base image in the Dimension Data Cloud given the id

Parameters:id (str) – The id of the image
Return type:NodeImage
ex_get_customer_image_by_id(id)[source]

Gets a Customer image in the Dimension Data Cloud given the id

Parameters:id (str) – The id of the image
Return type:NodeImage
ex_get_firewall_rule(network_domain, rule_id)[source]
ex_get_image_by_id(id)[source]

Gets a Base/Customer image in the Dimension Data Cloud given the id

Note: This first checks the base image
If it is not a base image we check if it is a customer image If it is not in either of these a DimensionDataAPIException is thrown
Parameters:id (str) – The id of the image
Return type:NodeImage
ex_get_ip_address_list(ex_network_domain, ex_ip_address_list_name)[source]

Get IP Address List by name in network domain specified

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get dimension data driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.DIMENSIONDATA)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> # Get IP Address List by Name
>>> ipaddresslist_list_by_name = driver.ex_get_ip_address_list(
>>>     ex_network_domain=my_network_domain,
>>>     ex_ip_address_list_name='My_IP_AddressList_1')
>>> pprint(ipaddresslist_list_by_name)
Parameters:
  • ex_network_domain (DimensionDataNetworkDomain or ‘str’) – (required) The network domain or network domain ID in which ipaddresslist resides.
  • ex_ip_address_list_name (:str) – (required) Get ‘IP Address List’ by name
Returns:

a list of DimensionDataIpAddressList objects

Return type:

list of DimensionDataIpAddressList

ex_get_location_by_id(id)[source]

Get location by ID.

Parameters:id (str) – ID of the node location which should be used
Return type:NodeLocation
ex_get_nat_rule(network_domain, rule_id)[source]

Get a NAT rule by ID

Parameters:
  • network_domain (DimensionDataNetworkDomain) – The network domain the rule belongs to
  • rule_id (str) – The ID of the NAT rule to fetch
Return type:

DimensionDataNatRule

ex_get_network_domain(network_domain_id)[source]

Get an individual Network Domain, by identifier

Parameters:network_domain_id (str) – The identifier of the network domain
Return type:DimensionDataNetworkDomain
ex_get_node_by_id(id)[source]
ex_get_portlist(ex_portlist_id)[source]

Get Port List

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get dimension data driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.DIMENSIONDATA)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get specific portlist by ID
>>> portlist_id = '27dd8c66-80ff-496b-9f54-2a3da2fe679e'
>>> portlist = driver.ex_get_portlist(portlist_id)
>>> pprint(portlist)
Parameters:ex_portlist_id (DimensionDataNetworkDomain or ‘str’) – The ex_port_list or ex_port_list ID
Returns:DimensionDataPortList object
Return type:DimensionDataPort
ex_get_public_ip_block(block_id)[source]
ex_get_tag_key_by_id(id)[source]

Get a specific tag key by ID

Parameters:id (str) – ID of the tag key you want (required)
Return type:DimensionDataTagKey
ex_get_tag_key_by_name(name)[source]

Get a specific tag key by Name

Parameters:name (str) – Name of the tag key you want (required)
Return type:DimensionDataTagKey
ex_get_vlan(vlan_id)[source]

Get a single VLAN, by it’s identifier

Parameters:vlan_id (str) – The identifier of the VLAN
Returns:an instance of DimensionDataVlan
Return type:DimensionDataVlan
ex_list_anti_affinity_rules(network=None, network_domain=None, node=None, filter_id=None, filter_state=None)[source]

List anti affinity rules for a network, network domain, or node

Parameters:
  • network (DimensionDataNetwork or str) – The network to list anti affinity rules for One of network, network_domain, or node is required
  • network_domain (DimensionDataNetworkDomain or str) – The network domain to list anti affinity rules One of network, network_domain, or node is required
  • node (Node or str) – The node to list anti affinity rules for One of network, netwok_domain, or node is required
  • filter_id (str) – This will allow you to filter the rules by this node id
Return type:

list of DimensionDataAntiAffinityRule

ex_list_customer_images(location=None)[source]

Return a list of customer imported images

Parameters:location (NodeLocation or str) – The target location
Return type:list of NodeImage
ex_list_firewall_rules(network_domain, page_size=50, page_number=1)[source]
ex_list_ip_address_list(ex_network_domain)[source]

List IP Address List by network domain ID specified

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get dimension data driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.DIMENSIONDATA)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> # List IP Address List of network domain
>>> ipaddresslist_list = driver.ex_list_ip_address_list(
>>>     ex_network_domain=my_network_domain)
>>> pprint(ipaddresslist_list)
Parameters:ex_network_domain (DimensionDataNetworkDomain or ‘str’) – The network domain or network domain ID
Returns:a list of DimensionDataIpAddressList objects
Return type:list of DimensionDataIpAddressList
ex_list_nat_rules(network_domain)[source]

Get NAT rules for the network domain

Parameters:network_domain (DimensionDataNetworkDomain) – The network domain the rules belongs to
Return type:list of DimensionDataNatRule
ex_list_network_domains(location=None, name=None, service_plan=None, state=None)[source]

List networks domains deployed across all data center locations domain.

for your organization. The response includes the location of each network :param location: Only network domains in the location (optional) :type location: NodeLocation or str

Parameters:
  • name (str) – Only network domains of this name (optional)
  • service_plan (str) – Only network domains of this type (optional)
  • state (str) – Only network domains in this state (optional)
Returns:

a list of DimensionDataNetwork objects

Return type:

list of DimensionDataNetwork

ex_list_networks(location=None)[source]

List networks deployed across all data center locations for your organization. The response includes the location of each network.

Parameters:location (NodeLocation or str) – The target location
Returns:a list of DimensionDataNetwork objects
Return type:list of DimensionDataNetwork
ex_list_nodes_paginated(name=None, location=None, ipv6=None, ipv4=None, vlan=None, image=None, deployed=None, started=None, state=None, network=None, network_domain=None)[source]

Return a generator which yields node lists in pages

Parameters:
  • location (NodeLocation or str) – Filters the node list to nodes that are located in this location
  • name – Filters the node list to nodes that have this name

:type name str

Parameters:
  • ipv6 (str) – Filters the node list to nodes that have this ipv6 address
  • ipv4 (str) – Filters the node list to nodes that have this ipv4 address
  • vlan (DimensionDataVlan or str) – Filters the node list to nodes that are in this VLAN
  • image (NodeImage or str) – Filters the node list to nodes that have this image
  • deployed (bool) – Filters the node list to nodes that are deployed or not
  • started (bool) – Filters the node list to nodes that are started or not
  • state (str) – Filters the node list to nodes that are in this state
  • network (DimensionDataNetwork or str) – Filters the node list to nodes in this network
  • network_domain (DimensionDataNetworkDomain or str) – Filters the node list to nodes in this network domain
Returns:

a list of Node objects

Return type:

generator of list of Node

ex_list_portlist(ex_network_domain)[source]

List Portlist by network domain ID specified

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get dimension data driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.DIMENSIONDATA)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
>>>                                               networkDomainName][0]
>>>
>>> # List portlist
>>> portLists = driver.ex_list_portlist(
>>>     ex_network_domain=my_network_domain)
>>> pprint(portLists)
>>>
Parameters:ex_network_domain (DimensionDataNetworkDomain or ‘str’) – The network domain or network domain ID
Returns:a list of DimensionDataPortList objects
Return type:list of DimensionDataPortList
ex_list_public_ip_blocks(network_domain)[source]
ex_list_tag_keys(id=None, name=None, value_required=None, display_on_report=None)[source]

List tag keys in the Dimension Data Cloud

Parameters:
  • id (str) – Filter the list to the id of the tag key
  • name (str) – Filter the list to the name of the tag key
  • value_required (bool) – Filter the list to if a value is required for a tag key
  • display_on_report (bool) – Filter the list to if the tag key should show up on usage reports
Return type:

list of DimensionDataTagKey

ex_list_tags(asset_id=None, asset_type=None, location=None, tag_key_name=None, tag_key_id=None, value=None, value_required=None, display_on_report=None)[source]

List tags in the Dimension Data Cloud

Parameters:
  • asset_id (str) – Filter the list by asset id
  • asset_type (str) – Filter the list by asset type
  • location (:class:NodeLocation or str) – Filter the list by the assets location
  • tag_key_name (str) – Filter the list by a tag key name
  • tag_key_id (str) – Filter the list by a tag key id
  • value (str) – Filter the list by a tag value
  • value_required (bool) – Filter the list to if a value is required for a tag
  • display_on_report (bool) – Filter the list to if the tag should show up on usage reports
Return type:

list of DimensionDataTag

ex_list_vlans(location=None, network_domain=None, name=None, ipv4_address=None, ipv6_address=None, state=None)[source]

List VLANs available, can filter by location and/or network domain

Parameters:
  • location (NodeLocation or str) – Only VLANs in this location (optional)
  • network_domain (DimensionDataNetworkDomain) – Only VLANs in this domain (optional)
  • name (str) – Only VLANs with this name (optional)
  • ipv4_address (str) – Only VLANs with this ipv4 address (optional)
  • ipv6_address (str) – Only VLANs with this ipv6 address (optional)
  • state (str) – Only VLANs with this state (optional)
Returns:

a list of DimensionDataVlan objects

Return type:

list of DimensionDataVlan

ex_modify_tag_key(tag_key, name=None, description=None, value_required=None, display_on_report=None)[source]

Modify a specific tag key

Parameters:
  • tag_key (DimensionDataTagKey or str) – The tag key you want to modify (required)
  • name (str) – Set to modify the name of the tag key
  • description (str) – Set to modify the description of the tag key
  • value_required (bool) – Set to modify if a value is required for the tag key
  • display_on_report (bool) – Set to modify if this tag key should display on the usage reports
Return type:

bool

ex_power_off(node)[source]

This function will abruptly power-off a server. Unlike ex_shutdown_graceful, success ensures the node will stop but some OS and application configurations may be adversely affected by the equivalent of pulling the power plug out of the machine.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_reconfigure_node(node, memory_gb, cpu_count, cores_per_socket, cpu_performance)[source]

Reconfigure the virtual hardware specification of a node

Parameters:
  • node (Node) – The server to change
  • memory_gb (int) – The amount of memory in GB (optional)
  • cpu_count (int) – The number of CPU (optional)
  • cores_per_socket (int) – Number of CPU cores per socket (optional)
  • cpu_performance (str) – CPU Performance type (optional)
Return type:

bool

ex_remove_storage(disk_id)[source]

Remove storage from a node

Parameters:
  • node (Node) – The server to add storage to
  • disk_id (str) – The ID of the disk to remove
Return type:

bool

ex_remove_storage_from_node(node, scsi_id)[source]

Remove storage from a node

Parameters:
  • node (Node) – The server to add storage to
  • scsi_id (str) – The ID of the disk to remove
Return type:

bool

ex_remove_tag_from_asset(asset, tag_key)[source]

Remove a tag from an asset

Parameters:
  • asset (Node or NodeImage or DimensionDataNewtorkDomain or DimensionDataVlan or DimensionDataPublicIpBlock) – The asset to remove a tag from. (required)
  • tag_key (DimensionDataTagKey or str) – The tag key you want to remove (required)
Return type:

bool

ex_remove_tag_key(tag_key)[source]

Modify a specific tag key

Parameters:tag_key (DimensionDataTagKey or str) – The tag key you want to remove (required)
Return type:bool
ex_rename_network(network, new_name)[source]

Rename a network in MCP 1 data center

Parameters:
  • network (DimensionDataNetwork) – The network to rename
  • new_name (str) – The new name of the network
Return type:

bool

ex_reset(node)[source]

This function will abruptly reset a server. Unlike reboot_node, success ensures the node will restart but some OS and application configurations may be adversely affected by the equivalent of pulling the power plug out of the machine.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_set_firewall_rule_state(rule, state)[source]

Change the state (enabled or disabled) of a rule

Parameters:
  • rule (DimensionDataFirewallRule) – The rule to delete
  • state (bool) – The desired state enabled (True) or disabled (False)
Return type:

bool

ex_shutdown_graceful(node)[source]
ex_software_usage_report(start_date, end_date)[source]

Get detailed software usage reports

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
Return type:

list of list

ex_start_node(node)[source]
ex_summary_usage_report(start_date, end_date)[source]

Get summary usage information

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
Return type:

list of list

ex_update_monitoring_plan(node, service_plan='ESSENTIALS')[source]

Updates the service plan on a node with monitoring

Parameters:
  • node (Node) – The node to monitor
  • service_plan (str) – The service plan, one of ESSENTIALS or ADVANCED
Return type:

bool

ex_update_network_domain(network_domain)[source]

Update the properties of a network domain

Parameters:network_domain (DimensionDataNetworkDomain) – The network domain with updated properties
Returns:an instance of DimensionDataNetworkDomain
Return type:DimensionDataNetworkDomain
ex_update_node(node, name=None, description=None, cpu_count=None, ram_mb=None)[source]

Update the node, the name, CPU or RAM

Parameters:
  • node (Node) – Node which should be used
  • name (str) – The new name (optional)
  • description (str) – The new description (optional)
  • cpu_count (int) – The new CPU count (optional)
  • ram_mb (int) – The new Memory in MB (optional)
Return type:

bool

ex_update_vlan(vlan)[source]

Updates the properties of the given VLAN Only name and description are updated

Parameters:vlan (DimensionDataNetworkDomain) – The VLAN to update
Returns:an instance of DimensionDataVlan
Return type:DimensionDataVlan
ex_update_vm_tools(node)[source]

This function triggers an update of the VMware Tools software running on the guest OS of a Server.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_wait_for_state(state, func, poll_interval=2, timeout=60, *args, **kwargs)[source]

Wait for the function which returns a instance with field status to match

Keep polling func until one of the desired states is matched

Parameters:
  • state (str or list) – Either the desired state (str) or a list of states
  • func (function) – The function to call, e.g. ex_get_vlan
  • poll_interval (int) – The number of seconds to wait between checks
  • timeout (int) – The total number of seconds to wait to reach a state
  • args (Positional arguments) – The arguments for func
  • kwargs (Keyword arguments) – The arguments for func
features = {'create_node': ['password']}
import_image(ovf_package_name, name, cluster_id=None, datacenter_id=None, description=None, is_guest_os_customization=None, tagkey_name_value_dictionaries=None)[source]

Import image

Parameters:
  • ovf_package_name (str) – Image OVF package name
  • name (str) – Image name
  • cluster_id (str) – Provide either cluster_id or datacenter_id
  • datacenter_id (str) – Provide either cluster_id or datacenter_id
  • description (str) – Optional. Description of image
  • is_guest_os_customization (bool) – Optional. true for NGOC image
  • tagkey_name_value_dictionaries (dictionaries) – Optional tagkey name value dict
Returns:

Return true if successful

Return type:

bool

list_images(location=None)[source]

List images available

Note: Currently only returns the default ‘base OS images’
provided by DimensionData. Customer images (snapshots) use ex_list_customer_images
Parameters:ex_location (NodeLocation or str) – Filters the node list to nodes that are located in this location
Returns:List of images available
Return type:list of NodeImage
list_locations(ex_id=None)[source]

List locations (datacenters) available for instantiating servers and networks.

Parameters:ex_id (str) – Filters the location list to this id
Returns:List of locations
Return type:list of NodeLocation
list_networks(location=None)[source]

List networks deployed across all data center locations for your organization. The response includes the location of each network.

Parameters:location (NodeLocation or str) – The location
Returns:a list of DimensionDataNetwork objects
Return type:list of DimensionDataNetwork
list_nodes(ex_location=None, ex_name=None, ex_ipv6=None, ex_ipv4=None, ex_vlan=None, ex_image=None, ex_deployed=None, ex_started=None, ex_state=None, ex_network=None, ex_network_domain=None)[source]

List nodes deployed for your organization.

Parameters:
  • ex_location (NodeLocation or str) – Filters the node list to nodes that are located in this location
  • ex_name – Filters the node list to nodes that have this name

:type ex_name str

Parameters:
  • ex_ipv6 (str) – Filters the node list to nodes that have this ipv6 address
  • ex_ipv4 (str) – Filters the node list to nodes that have this ipv4 address
  • ex_vlan (DimensionDataVlan or str) – Filters the node list to nodes that are in this VLAN
  • ex_image (NodeImage or str) – Filters the node list to nodes that have this image
  • ex_deployed (bool) – Filters the node list to nodes that are deployed or not
  • ex_started (bool) – Filters the node list to nodes that are started or not
  • ex_state (str) – Filters the node list by nodes that are in this state
  • ex_network (DimensionDataNetwork or str) – Filters the node list to nodes in this network
  • ex_network_domain (DimensionDataNetworkDomain or str) – Filters the node list to nodes in this network domain
Returns:

a list of Node objects

Return type:

list of Node

list_sizes(location=None)[source]
return a list of available sizes
Currently, the size of the node is dictated by the chosen OS base image, they cannot be set explicitly.

@inherits: NodeDriver.list_sizes

name = 'DimensionData'
reboot_node(node)[source]

Reboots a node by requesting the OS restart via the hypervisor

Parameters:node (Node) – The node to reboot
Return type:bool
selected_region = None
start_node(node)[source]

Powers on an existing deployed server

Parameters:node (Node) – Node which should be used
Return type:bool
stop_node(node)[source]

This function will attempt to “gracefully” stop a server by initiating a shutdown sequence within the guest operating system. A successful response on this function means the system has successfully passed the request into the operating system.

Parameters:node (Node) – Node which should be used
Return type:bool
type = 'dimensiondata'
website = 'http://www.dimensiondata.com/'

libcloud.compute.drivers.dummy module

Dummy Driver

@note: This driver is out of date

class libcloud.compute.drivers.dummy.DummyConnection(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]

Bases: libcloud.common.base.ConnectionKey

Dummy connection class

Initialize user_id and key; set secure to an int based on passed value.

connect(host=None, port=None)[source]

Establish a connection with the API server.

Parameters:
  • host (str) – Optional host to override our default
  • port (int) – Optional port to override our default
Returns:

A connection

class libcloud.compute.drivers.dummy.DummyNodeDriver(creds)[source]

Bases: libcloud.compute.base.NodeDriver

Dummy node driver

This is a fake driver which appears to always create or destroy nodes successfully.

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> node=driver.create_node()
>>> node.public_ips[0]
'127.0.0.3'
>>> node.name
'dummy-3'

If the credentials you give convert to an integer then the next node to be created will be one higher.

Each time you create a node you will get a different IP address.

>>> driver = DummyNodeDriver(22)
>>> node=driver.create_node()
>>> node.name
'dummy-23'
Parameters:creds (str) – Credentials
Return type:None
create_node(name, size, image)[source]

Creates a dummy node; the node id is equal to the number of nodes in the node list

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> sorted([node.name for node in driver.list_nodes()])
['dummy-1', 'dummy-2']
>>> nodeA = driver.create_node()
>>> sorted([node.name for node in driver.list_nodes()])
['dummy-1', 'dummy-2', 'dummy-3']
>>> driver.create_node().name
'dummy-4'
>>> driver.destroy_node(nodeA)
True
>>> sorted([node.name for node in driver.list_nodes()])
['dummy-1', 'dummy-2', 'dummy-4']

@inherits: NodeDriver.create_node

destroy_node(node)[source]

Sets the node state to terminated and removes it from the node list

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> from libcloud.compute.types import NodeState
>>> node = [node for node in driver.list_nodes() if
...         node.name == 'dummy-1'][0]
>>> node.state == NodeState.RUNNING
True
>>> driver.destroy_node(node)
True
>>> node.state == NodeState.RUNNING
False
>>> [n for n in driver.list_nodes() if n.name == 'dummy-1']
[]

@inherits: NodeDriver.destroy_node

get_uuid(unique_field=None)[source]
Parameters:unique_field (bool) – Unique field
Return type:UUID
import_key_pair_from_string(name, key_material)[source]

Import a new public key from string.

Parameters:
  • name (str) – Key pair name.
  • key_material (str) – Public key material.
Return type:

KeyPair object

list_images(location=None)[source]

Returns a list of images as a cloud provider might have

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> sorted([image.name for image in driver.list_images()])
['Slackware 4', 'Ubuntu 9.04', 'Ubuntu 9.10']

@inherits: NodeDriver.list_images

list_locations()[source]

Returns a list of locations of nodes

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> sorted([loc.name + " in " + loc.country for loc in
...         driver.list_locations()])
['Island Datacenter in FJ', 'London Loft in GB', "Paul's Room in US"]

@inherits: NodeDriver.list_locations

list_nodes()[source]

List the nodes known to a particular driver; There are two default nodes created at the beginning

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> node_list=driver.list_nodes()
>>> sorted([node.name for node in node_list ])
['dummy-1', 'dummy-2']

each item in the list returned is a node object from which you can carry out any node actions you wish

>>> node_list[0].reboot()
True

As more nodes are added, list_nodes will return them

>>> node=driver.create_node()
>>> node.size.id
's1'
>>> node.image.id
'i2'
>>> sorted([n.name for n in driver.list_nodes()])
['dummy-1', 'dummy-2', 'dummy-3']

@inherits: NodeDriver.list_nodes

list_sizes(location=None)[source]

Returns a list of node sizes as a cloud provider might have

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> sorted([size.ram for size in driver.list_sizes()])
[128, 512, 4096, 8192]

@inherits: NodeDriver.list_images

name = 'Dummy Node Provider'
reboot_node(node)[source]

Sets the node state to rebooting; in this dummy driver always returns True as if the reboot had been successful.

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> node=driver.create_node()
>>> from libcloud.compute.types import NodeState
>>> node.state == NodeState.RUNNING
True
>>> node.state == NodeState.REBOOTING
False
>>> driver.reboot_node(node)
True
>>> node.state == NodeState.REBOOTING
True

Please note, dummy nodes never recover from the reboot.

@inherits: NodeDriver.reboot_node

type = 'dummy'
website = 'http://example.com'

libcloud.compute.drivers.ec2 module

Amazon EC2, Eucalyptus, Nimbus and Outscale drivers.

libcloud.compute.drivers.ec2.OUTSCALE_INSTANCE_TYPES = {'c1.medium': {'bandwidth': None, 'disk': 340, 'id': 'c1.medium', 'name': 'Compute Optimized Medium Instance', 'ram': 1740}, 'c1.xlarge': {'bandwidth': None, 'disk': 1680, 'id': 'c1.xlarge', 'name': 'Compute Optimized Extra Large Instance', 'ram': 7168}, 'c3.2xlarge': {'bandwidth': None, 'disk': 160, 'id': 'c3.2xlarge', 'name': 'Compute Optimized Double Extra Large Instance', 'ram': 15359}, 'c3.4xlarge': {'bandwidth': None, 'disk': 320, 'id': 'c3.4xlarge', 'name': 'Compute Optimized Quadruple Extra Large Instance', 'ram': 30720}, 'c3.8xlarge': {'bandwidth': None, 'disk': 640, 'id': 'c3.8xlarge', 'name': 'Compute Optimized Eight Extra Large Instance', 'ram': 61440}, 'c3.large': {'bandwidth': None, 'disk': 32, 'id': 'c3.large', 'name': 'Compute Optimized Large Instance', 'ram': 3840}, 'c3.xlarge': {'bandwidth': None, 'disk': 80, 'id': 'c3.xlarge', 'name': 'Compute Optimized Extra Large Instance', 'ram': 7168}, 'cc1.4xlarge': {'bandwidth': None, 'disk': 1680, 'id': 'cc1.4xlarge', 'name': 'Cluster Compute Quadruple Extra Large Instance', 'ram': 24576}, 'cc2.8xlarge': {'bandwidth': None, 'disk': 3360, 'id': 'cc2.8xlarge', 'name': 'Cluster Compute Eight Extra Large Instance', 'ram': 65536}, 'cr1.8xlarge': {'bandwidth': None, 'disk': 240, 'id': 'cr1.8xlarge', 'name': 'Memory Optimized Eight Extra Large Instance', 'ram': 249855}, 'g2.2xlarge': {'bandwidth': None, 'disk': 60, 'id': 'g2.2xlarge', 'name': 'GPU Double Extra Large Instance', 'ram': 15360}, 'hi1.xlarge': {'bandwidth': None, 'disk': 1680, 'id': 'hi1.xlarge', 'name': 'High Storage Extra Large Instance', 'ram': 15361}, 'm1.large': {'bandwidth': None, 'disk': 840, 'id': 'm1.large', 'name': 'Standard Large Instance', 'ram': 7680}, 'm1.medium': {'bandwidth': None, 'disk': 420, 'id': 'm1.medium', 'name': 'Standard Medium Instance', 'ram': 3840}, 'm1.small': {'bandwidth': None, 'disk': 150, 'id': 'm1.small', 'name': 'Standard Small Instance', 'ram': 1740}, 'm1.xlarge': {'bandwidth': None, 'disk': 1680, 'id': 'm1.xlarge', 'name': 'Standard Extra Large Instance', 'ram': 15360}, 'm2.2xlarge': {'bandwidth': None, 'disk': 840, 'id': 'm2.2xlarge', 'name': 'High Memory Double Extra Large Instance', 'ram': 35020}, 'm2.4xlarge': {'bandwidth': None, 'disk': 1680, 'id': 'm2.4xlarge', 'name': 'High Memory Quadruple Extra Large Instance', 'ram': 70042}, 'm2.xlarge': {'bandwidth': None, 'disk': 420, 'id': 'm2.xlarge', 'name': 'High Memory Extra Large Instance', 'ram': 17510}, 'm3.2xlarge': {'bandwidth': None, 'disk': 0, 'id': 'm3.2xlarge', 'name': 'High Storage Optimized Double Extra Large Instance', 'ram': 30720}, 'm3.xlarge': {'bandwidth': None, 'disk': 0, 'id': 'm3.xlarge', 'name': 'High Storage Optimized Extra Large Instance', 'ram': 15357}, 'm3s.2xlarge': {'bandwidth': None, 'disk': 0, 'id': 'm3s.2xlarge', 'name': 'High Storage Optimized Double Extra Large Instance', 'ram': 30719}, 'm3s.xlarge': {'bandwidth': None, 'disk': 0, 'id': 'm3s.xlarge', 'name': 'High Storage Optimized Extra Large Instance', 'ram': 15359}, 'nv1.large': {'bandwidth': None, 'disk': 840, 'id': 'nv1.large', 'name': 'GPU Large Instance', 'ram': 7679}, 'nv1.medium': {'bandwidth': None, 'disk': 420, 'id': 'nv1.medium', 'name': 'GPU Medium Instance', 'ram': 3839}, 'nv1.small': {'bandwidth': None, 'disk': 150, 'id': 'nv1.small', 'name': 'GPU Small Instance', 'ram': 1739}, 'nv1.xlarge': {'bandwidth': None, 'disk': 1680, 'id': 'nv1.xlarge', 'name': 'GPU Extra Large Instance', 'ram': 15358}, 'oc1.4xlarge': {'bandwidth': None, 'disk': 1680, 'id': 'oc1.4xlarge', 'name': 'Outscale Quadruple Extra Large Instance', 'ram': 24575}, 'oc2.8xlarge': {'bandwidth': None, 'disk': 3360, 'id': 'oc2.8xlarge', 'name': 'Outscale Eight Extra Large Instance', 'ram': 65535}, 'os1.2xlarge': {'bandwidth': None, 'disk': 60, 'id': 'os1.2xlarge', 'name': 'Memory Optimized, High Storage, Passthrough NIC Double Extra Large Instance', 'ram': 65536}, 'os1.4xlarge': {'bandwidth': None, 'disk': 120, 'id': 'os1.4xlarge', 'name': 'Memory Optimized, High Storage, Passthrough NIC Quadruple Extra Large Instance', 'ram': 131072}, 'os1.8xlarge': {'bandwidth': None, 'disk': 500, 'id': 'os1.8xlarge', 'name': 'Memory Optimized, High Storage, Passthrough NIC Eight Extra Large Instance', 'ram': 249856}, 't1.micro': {'bandwidth': None, 'disk': 0, 'id': 't1.micro', 'name': 'Micro Instance', 'ram': 615}}

The function manipulating Outscale cloud regions will be overridden because Outscale instances types are in a separate dict so also declare Outscale cloud regions in some other constants.

libcloud.compute.drivers.ec2.OUTSCALE_INC_REGION_DETAILS = {'eu-west-1': {'api_name': 'osc_inc_eu_west_1', 'country': 'FRANCE', 'endpoint': 'api.eu-west-1.outscale.com', 'instance_types': ['t1.micro', 'm1.small', 'm1.medium', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge', 'p2.xlarge', 'p2.8xlarge', 'p2.16xlarge', 'nv1.small', 'nv1.medium', 'nv1.large', 'nv1.xlarge', 'cc1.4xlarge', 'cc2.8xlarge', 'm3.xlarge', 'm3.2xlarge', 'cr1.8xlarge', 'os1.8xlarge']}, 'eu-west-2': {'api_name': 'osc_inc_eu_west_2', 'country': 'FRANCE', 'endpoint': 'fcu.eu-west-2.outscale.com', 'instance_types': ['t1.micro', 'm1.small', 'm1.medium', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge', 'nv1.small', 'nv1.medium', 'nv1.large', 'nv1.xlarge', 'cc1.4xlarge', 'cc2.8xlarge', 'm3.xlarge', 'm3.2xlarge', 'cr1.8xlarge', 'os1.8xlarge']}, 'eu-west-3': {'api_name': 'osc_inc_eu_west_3', 'country': 'FRANCE', 'endpoint': 'api-ppd.outscale.com', 'instance_types': ['t1.micro', 'm1.small', 'm1.medium', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge', 'nv1.small', 'nv1.medium', 'nv1.large', 'nv1.xlarge', 'cc1.4xlarge', 'cc2.8xlarge', 'm3.xlarge', 'm3.2xlarge', 'cr1.8xlarge', 'os1.8xlarge']}, 'us-east-1': {'api_name': 'osc_inc_us_east_1', 'country': 'USA', 'endpoint': 'api.us-east-1.outscale.com', 'instance_types': ['t1.micro', 'm1.small', 'm1.medium', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge', 'nv1.small', 'nv1.medium', 'nv1.large', 'nv1.xlarge', 'cc1.4xlarge', 'cc2.8xlarge', 'm3.xlarge', 'm3.2xlarge', 'cr1.8xlarge', 'os1.8xlarge']}, 'us-east-2': {'api_name': 'osc_inc_us_east_2', 'country': 'USA', 'endpoint': 'fcu.us-east-2.outscale.com', 'instance_types': ['t1.micro', 'm1.small', 'm1.medium', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge', 'nv1.small', 'nv1.medium', 'nv1.large', 'nv1.xlarge', 'cc1.4xlarge', 'cc2.8xlarge', 'm3.xlarge', 'm3.2xlarge', 'cr1.8xlarge', 'os1.8xlarge']}}

Define the extra dictionary for specific resources

class libcloud.compute.drivers.ec2.EC2NodeDriver(key, secret=None, secure=True, host=None, port=None, region='us-east-1', token=None, signature_version=None, **kwargs)[source]

Bases: libcloud.compute.drivers.ec2.BaseEC2NodeDriver

Amazon EC2 node driver.

NODE_STATE_MAP = {'pending': pending, 'running': running, 'shutting-down': unknown, 'stopped': stopped, 'terminated': terminated}
connectionCls

alias of EC2Connection

classmethod list_regions()[source]
name = 'Amazon EC2'
path = '/'
type = 'ec2'
website = 'http://aws.amazon.com/ec2/'
class libcloud.compute.drivers.ec2.BaseEC2NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Base Amazon EC2 node driver.

Used for main EC2 and other derivate driver classes to inherit from it.

Parameters:
  • key (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 = {'pending': pending, 'running': running, 'shutting-down': unknown, 'terminated': terminated}
SNAPSHOT_STATE_MAP = {'completed': available, 'error': error, 'pending': creating}
VOLUME_STATE_MAP = {'available': available, 'creating': creating, 'deleted': deleted, 'deleting': deleting, 'error': error, 'error_deleting': error, 'in-use': inuse}
attach_volume(node, volume, device)[source]

Attaches volume to node.

Parameters:
  • node (Node) – Node to attach volume to.
  • volume (StorageVolume) – Volume to attach.
  • device (str) – Where the device is exposed, e.g. ‘/dev/sdb’
Rytpe:

bool

connectionCls

alias of EC2Connection

copy_image(image, source_region, name=None, description=None)[source]

Copy an Amazon Machine Image from the specified source region to the current region.

@inherits: NodeDriver.copy_image

Parameters:
  • source_region (str) – The region where the image resides
  • image (NodeImage) – Instance of class NodeImage
  • name (str) – The name of the new image
  • description (str) – The description of the new image
Returns:

Instance of class NodeImage

Return type:

NodeImage

country = ''
create_image(node, name, description=None, reboot=False, block_device_mapping=None)[source]

Create an Amazon Machine Image based off of an EBS-backed instance.

@inherits: NodeDriver.create_image

Parameters:
  • node – Instance of Node
  • name (str) – The name for the new image
  • block_device_mapping (list of dict) – A dictionary of the disk layout An example of this dict is included below.
  • reboot (bool) – Whether or not to shutdown the instance before creation. Amazon calls this NoReboot and sets it to false by default to ensure a clean image.
  • description (str) – An optional description for the new image

An example block device mapping dictionary is included:

mapping = [{‘VirtualName’: None,
‘Ebs’: {‘VolumeSize’: 10,
‘VolumeType’: ‘standard’, ‘DeleteOnTermination’: ‘true’}, ‘DeviceName’: ‘/dev/sda1’}]
Returns:Instance of class NodeImage
Return type:NodeImage
create_key_pair(name)[source]

Create a new key pair object.

Parameters:name (str) – Key pair name.
Return type:KeyPair object
create_node(name, size, image, location=None, auth=None, ex_keyname=None, ex_userdata=None, ex_security_groups=None, ex_securitygroup=None, ex_security_group_ids=None, ex_metadata=None, ex_mincount=1, ex_maxcount=1, ex_clienttoken=None, ex_blockdevicemappings=None, ex_iamprofile=None, ex_ebs_optimized=None, ex_subnet=None, ex_placement_group=None, ex_assign_public_ip=False, ex_terminate_on_shutdown=False, ex_spot=False, ex_spot_max_price=None)[source]

Create a new EC2 node.

Reference: http://bit.ly/8ZyPSy [docs.amazonwebservices.com]

@inherits: NodeDriver.create_node

Parameters:
  • ex_keyname (str) – The name of the key pair
  • ex_userdata (str) – User data
  • ex_security_groups (list) – A list of names of security groups to assign to the node.
  • ex_security_group_ids (list) – A list of ids of security groups to assign to the node.[for VPC nodes only]
  • ex_metadata (dict) – Key/Value metadata to associate with a node
  • ex_mincount (int) – Minimum number of instances to launch
  • ex_maxcount (int) – Maximum number of instances to launch
  • ex_clienttoken (str) – Unique identifier to ensure idempotency
  • ex_blockdevicemappings (list of dict) – list of dict block device mappings.
  • ex_iam_profile (str) – Name or ARN of IAM profile
  • ex_ebs_optimized (bool) – EBS-Optimized if True
  • ex_subnet (EC2Subnet) – The subnet to launch the instance into.
  • ex_placement_group (str) – The name of the placement group to launch the instance into.
  • ex_assign_public_ip (bool) – If True, the instance will be assigned a public ip address. Note : It takes takes a short while for the instance to be assigned the public ip so the node returned will NOT have the public ip assigned yet.
  • ex_terminate_on_shutdown (bool) – Indicates if the instance should be terminated instead of just shut down when using the operating systems command for system shutdown.
  • ex_spot (bool) – If true, ask for a Spot Instance instead of requesting On-Demand.
  • ex_spot_max_price (float) – Maximum price to pay for the spot instance. If not specified, the on-demand price will be used.
create_volume(size, name, location=None, snapshot=None, ex_volume_type='standard', ex_iops=None, ex_encrypted=False, ex_kms_key_id=None, ex_throughput=None)[source]

Create a new volume.

Parameters:
  • size (int) – Size of volume in gigabytes (required)
  • name (str) – Name of the volume to be created
  • location (ExEC2AvailabilityZone) – Which data center to create a volume in. If empty, undefined behavior will be selected. (optional)
  • snapshot (VolumeSnapshot) – Snapshot from which to create the new volume. (optional)
  • location – Datacenter in which to create a volume in.
  • ex_volume_type (str) – Type of volume to create.
  • ex_iops (int) – The number of I/O operations per second (IOPS) that the volume supports. Only used if ex_volume_type is io1, io2 or gp3.
  • ex_encrypted (bool) – Specifies whether the volume should be encrypted.
  • ex_kms_key_id (str) – The full ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use when creating the encrypted volume. Example: arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123 -456a-a12b-a123b4cd56ef. Only used if encrypted is set to True.
  • ex_throughput (int) – The throughput to provision for a volume, with a maximum of 1,000 MiB/s. Only used if ex_volume_type is gp3.
Returns:

The newly created volume.

Return type:

StorageVolume

create_volume_snapshot(volume, name=None, ex_metadata=None)[source]

Create snapshot from volume

Parameters:
  • volume (StorageVolume) – Instance of StorageVolume
  • name (str) – Name of snapshot (optional)
  • ex_metadata (dict) – The Key/Value metadata to associate with a snapshot (optional)
Return type:

VolumeSnapshot

delete_image(image)[source]

Deletes an image at Amazon given a NodeImage object

@inherits: NodeDriver.delete_image

Parameters:image – Instance of NodeImage
Return type:bool
delete_key_pair(key_pair)[source]

Delete an existing key pair.

Parameters:key_pair (KeyPair) – Key pair object.
Return type:bool
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
destroy_volume(volume)[source]

Destroys a storage volume.

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
destroy_volume_snapshot(snapshot)[source]

Destroys a snapshot.

Parameters:snapshot (VolumeSnapshot) – The snapshot to delete
Return type:bool
detach_volume(volume, ex_force=False)[source]

Detaches a volume from a node.

Parameters:volume (StorageVolume) – Volume to be detached
Return type:bool
ex_allocate_address(domain='standard')[source]

Allocate a new Elastic IP address for EC2 classic or VPC

Parameters:domain (str) – The domain to allocate the new address in (standard/vpc)
Returns:Instance of ElasticIP
Return type:ElasticIP
ex_associate_address_with_node(node, elastic_ip, domain=None)[source]

Associate an Elastic IP address with a particular node.

Parameters:
  • node (Node) – Node instance
  • elastic_ip (ElasticIP) – Elastic IP instance
  • domain (str) – The domain where the IP resides (vpc only)
Returns:

A string representation of the association ID which is required for VPC disassociation. EC2/standard addresses return None

Return type:

None or str

ex_associate_addresses(node, elastic_ip, domain=None)[source]

Note: This method has been deprecated in favor of the ex_associate_address_with_node method.

ex_associate_route_table(route_table, subnet)[source]

Associates a route table with a subnet within a VPC.

Note: A route table can be associated with multiple subnets.

Parameters:
  • route_table (EC2RouteTable) – The route table to associate.
  • subnet (EC2Subnet) – The subnet to associate with.
Returns:

Route table association ID.

Return type:

str

ex_attach_internet_gateway(gateway, network)[source]

Attach an Internet gateway to a VPC

Parameters:
  • gateway (VPCInternetGateway) – The gateway to attach
  • network (EC2Network) – The VPC network to attach to
Return type:

bool

ex_attach_network_interface_to_node(network_interface, node, device_index)[source]

Attach a network interface to an instance.

Parameters:
  • network_interface (EC2NetworkInterface) – EC2NetworkInterface instance
  • node (Node) – Node instance
  • device_index (int) – The interface device index
Returns:

String representation of the attachment id. This is required to detach the interface.

Return type:

str

ex_authorize_security_group(name, from_port, to_port, cidr_ip, protocol='tcp')[source]

Edit a Security Group to allow specific traffic.

@note: This is a non-standard extension API, and only works for EC2.

Parameters:
  • name (str) – The name of the security group to edit
  • from_port (str) – The beginning of the port range to open
  • to_port (str) – The end of the port range to open
  • cidr_ip (str) – The ip to allow traffic for.
  • protocol (str) – tcp/udp/icmp
Return type:

bool

ex_authorize_security_group_egress(id, from_port, to_port, cidr_ips, group_pairs=None, protocol='tcp')[source]

Edit a Security Group to allow specific egress traffic using CIDR blocks or either a group ID, group name or user ID (account). This call is not supported for EC2 classic and only works for VPC groups.

Parameters:
  • id (str) – The id of the security group to edit
  • from_port (int) – The beginning of the port range to open
  • to_port (int) – The end of the port range to open
  • cidr_ips (list) – The list of ip ranges to allow traffic for.
  • group_pairs (list of dict) –

    Source user/group pairs to allow traffic for. More info can be found at http://goo.gl/stBHJF

    EC2 Classic Example: To allow access from any system associated with the default group on account 1234567890

    [{‘group_name’: ‘default’, ‘user_id’: ‘1234567890’}]

    VPC Example: Allow access from any system associated with security group sg-47ad482e on your own account

    [{‘group_id’: ‘ sg-47ad482e’}]

  • protocol (str) – tcp/udp/icmp
Return type:

bool

ex_authorize_security_group_ingress(id, from_port, to_port, cidr_ips=None, group_pairs=None, protocol='tcp', description=None)[source]

Edit a Security Group to allow specific ingress traffic using CIDR blocks or either a group ID, group name or user ID (account).

Parameters:
  • id (str) – The id of the security group to edit
  • from_port (int) – The beginning of the port range to open
  • to_port (int) – The end of the port range to open
  • cidr_ips (list) – The list of IP ranges to allow traffic for.
  • group_pairs (list of dict) –

    Source user/group pairs to allow traffic for. More info can be found at http://goo.gl/stBHJF

    EC2 Classic Example: To allow access from any system associated with the default group on account 1234567890

    [{‘group_name’: ‘default’, ‘user_id’: ‘1234567890’}]

    VPC example: To allow access from any system associated with security group sg-47ad482e on your own account

    [{‘group_id’: ‘ sg-47ad482e’}]

  • protocol (str) – tcp/udp/icmp
  • description (str) – description to be added to the rules inserted
Return type:

bool

ex_authorize_security_group_permissive(name)[source]

Edit a Security Group to allow all traffic.

@note: This is a non-standard extension API, and only works for EC2.

Parameters:name (str) – The name of the security group to edit
Return type:list of str
ex_change_node_size(node, new_size)[source]

Change the node size. Note: Node must be turned of before changing the size.

Parameters:
  • node (Node) – Node instance
  • new_size (NodeSize) – NodeSize instance
Returns:

True on success, False otherwise.

Return type:

bool

ex_create_internet_gateway(name=None)[source]

Delete a VPC Internet gateway

Return type:bool
ex_create_keypair(name)[source]

Creates a new keypair

@note: This is a non-standard extension API, and only works for EC2.

Parameters:name (str) – The name of the keypair to Create. This must be unique, otherwise an InvalidKeyPair.Duplicate exception is raised.
Return type:dict
ex_create_network(cidr_block, name=None, instance_tenancy='default')[source]

Create a network/VPC

Parameters:
  • cidr_block (str) – The CIDR block assigned to the network
  • name (str) – An optional name for the network
  • instance_tenancy (str) – The allowed tenancy of instances launched into the VPC. Valid values: default/dedicated
Returns:

Dictionary of network properties

Return type:

dict

ex_create_network_interface(subnet, name=None, description=None, private_ip_address=None)[source]

Create a network interface within a VPC subnet.

Parameters:
  • subnet (EC2NetworkSubnet) – EC2NetworkSubnet instance
  • name (str) – Optional name of the interface
  • description (str) – Optional description of the network interface
  • private_ip_address (str) – Optional address to assign as the primary private IP address of the interface. If one is not provided then Amazon will automatically auto-assign an available IP. EC2 allows assignment of multiple IPs, but this will be the primary.
Returns:

EC2NetworkInterface instance

Return type:

:class EC2NetworkInterface

ex_create_placement_group(name)[source]

Creates a new placement group.

Parameters:name (str) – The name for the new placement group
Return type:bool
ex_create_route(route_table, cidr, internet_gateway=None, node=None, network_interface=None, vpc_peering_connection=None)[source]

Creates a route entry in the route table.

Parameters:
  • route_table (EC2RouteTable) – The route table to create the route in.
  • cidr (str) – The CIDR block used for the destination match.
  • internet_gateway (VPCInternetGateway) – The Internet gateway to route traffic through.
  • node (Node) – The NAT instance to route traffic through.
  • network_interface (EC2NetworkInterface) – The network interface of the node to route traffic through.
  • vpc_peering_connection (VPCPeeringConnection) – The VPC peering connection.
Return type:

bool

Note: You must specify one of the following: internet_gateway,
node, network_interface, vpc_peering_connection.
ex_create_route_table(network, name=None)[source]

Creates a route table within a VPC.

Parameters:vpc_id (EC2Network) – The VPC that the subnet should be created in.
Return type:
class:.EC2RouteTable
ex_create_security_group(name, description, vpc_id=None)[source]

Creates a new Security Group in EC2-Classic or a targeted VPC.

Parameters:
  • name (str) – The name of the security group to create. This must be unique.
  • description (str) – Human readable description of a Security Group.
  • vpc_id (str) – Optional identifier for VPC networks
Return type:

dict

ex_create_subnet(vpc_id, cidr_block, availability_zone, name=None)[source]

Creates a network subnet within a VPC.

Parameters:
  • vpc_id (str) – The ID of the VPC that the subnet should be associated with
  • cidr_block (str) – The CIDR block assigned to the subnet
  • availability_zone (str) – The availability zone where the subnet should reside
  • name (str) – An optional name for the network
Return type:

class:EC2NetworkSubnet

ex_create_tags(resource, tags)[source]

Creates tags for a resource (Node or StorageVolume).

Parameters:
  • resource (Node or StorageVolume or VolumeSnapshot) – The resource to be tagged
  • tags (dict) – A dictionary or other mapping of strings to strings, associating tag names with tag values.
Return type:

bool

ex_delete_internet_gateway(gateway)[source]

Deletes a VPC Internet gateway.

Parameters:gateway (VPCInternetGateway) – The gateway to delete
Return type:bool
ex_delete_keypair(keypair)[source]

Deletes a key pair by name.

@note: This is a non-standard extension API, and only works with EC2.

Parameters:keypair (str) – The name of the keypair to delete.
Return type:bool
ex_delete_network(vpc)[source]

Deletes a network/VPC.

Parameters:vpc (EC2Network) – VPC to delete.
Return type:bool
ex_delete_network_interface(network_interface)[source]

Deletes a network interface.

Parameters:network_interface (EC2NetworkInterface) – EC2NetworkInterface instance
Return type:bool
ex_delete_placement_group(name)[source]

Deletes a placement group.

Parameters:name (str) – The placement group name
Return type:bool
ex_delete_route(route_table, cidr)[source]

Deletes a route entry from the route table.

Parameters:
  • route_table (EC2RouteTable) – The route table to delete the route from.
  • cidr (str) – The CIDR block used for the destination match.
Return type:

bool

ex_delete_route_table(route_table)[source]

Deletes a VPC route table.

Parameters:route_table (EC2RouteTable) – The route table to delete.
Return type:bool
ex_delete_security_group(name)[source]

A wrapper method which calls ex_delete_security_group_by_name.

Parameters:name (str) – The name of the security group
Return type:bool
ex_delete_security_group_by_id(group_id)[source]

Deletes a new Security Group using the group ID.

Parameters:group_id (str) – The ID of the security group
Return type:bool
ex_delete_security_group_by_name(group_name)[source]

Deletes a new Security Group using the group name.

Parameters:group_name (str) – The name of the security group
Return type:bool
ex_delete_subnet(subnet)[source]

Deletes a VPC subnet.

Parameters:subnet (EC2NetworkSubnet) – The subnet to delete
Return type:bool
ex_delete_tags(resource, tags)[source]

Deletes tags from a resource.

Parameters:
  • resource (Node or StorageVolume) – The resource to be tagged
  • tags (dict) – A dictionary or other mapping of strings to strings, specifying the tag names and tag values to be deleted.
Return type:

bool

ex_describe_addresses(nodes)[source]

Returns Elastic IP addresses for all the nodes in the provided list.

Parameters:nodes (list of Node) – A list of Node instances
Returns:Dictionary where a key is a node ID and the value is a list with the Elastic IP addresses associated with this node.
Return type:dict
ex_describe_addresses_for_node(node)[source]

Returns a list of Elastic IP Addresses associated with this node.

Parameters:node (Node) – Node instance
Returns:List Elastic IP Addresses attached to this node.
Return type:list of str
ex_describe_all_addresses(only_associated=False)[source]

Returns all the Elastic IP addresses for this account 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 Elastic IP addresses.
Return type:list of ElasticIP
ex_describe_all_keypairs()[source]

Returns names for all the available key pairs.

@note: This is a non-standard extension API, and only works for EC2.

Return type:list of str
ex_describe_import_snapshot_tasks(import_task_id, dry_run=None)[source]

Describes your import snapshot tasks. More information can be found at https://goo.gl/CI0MdS.

Parameters:
  • import_task_id (str) – Import task Id for the current Import Snapshot Task
  • dry_run (bool) – Checks whether you have the permission for the action, without actually making the request, and provides an error response.(optional)
Return type:

:class:DescribeImportSnapshotTasks Object

ex_describe_keypair(name)[source]

Describes a keypair by name.

@note: This is a non-standard extension API, and only works for EC2.

Parameters:name (str) – The name of the keypair to describe.
Return type:dict
ex_describe_keypairs(name)[source]

Here for backward compatibility.

ex_describe_tags(resource)[source]

Returns a dictionary of tags for a resource (e.g. Node or StorageVolume).

Parameters:resource (any resource class, such as Node, StorageVolume, or :class:NodeImage`) – The resource to be used
Returns:A dictionary of Node tags
Return type:dict
ex_describe_volumes_modifications(dry_run=False, volume_ids=None, filters=None)[source]

Describes one or more of your volume modifications.

Parameters:
  • dry_run (bool) – dry_run
  • volume_ids (dict) – The volume_ids so that the response includes information for only said volumes
  • filters (dict) – The filters so that the response includes information for only certain volumes
Returns:

List of volume modification status objects

Return type:

list of :class:`VolumeModification

ex_detach_internet_gateway(gateway, network)[source]

Detaches an Internet gateway from a VPC.

Parameters:
  • gateway (VPCInternetGateway) – The gateway to detach
  • network (EC2Network) – The VPC network to detach from
Return type:

bool

ex_detach_network_interface(attachment_id, force=False)[source]

Detach a network interface from an instance.

Parameters:
  • attachment_id (str) – The attachment ID associated with the interface
  • force (bool) – Forces the detachment.
Returns:

True on successful detachment, False otherwise.

Return type:

bool

ex_disassociate_address(elastic_ip, domain=None)[source]

Disassociates an Elastic IP address using the IP (EC2-Classic) or the association ID (VPC).

Parameters:
  • elastic_ip (ElasticIP) – ElasticIP instance
  • domain (str) – The domain where the IP resides (vpc only)
Returns:

True on success, False otherwise.

Return type:

bool

ex_dissociate_route_table(subnet_association)[source]

Dissociates a subnet from a route table.

Parameters:subnet_association (EC2SubnetAssociation or str) – The subnet association object or subnet association ID.
Return type:bool
ex_find_or_import_keypair_by_key_material(pubkey)[source]

Given a public key, look it up in the EC2 KeyPair database. If it exists, return any information we have about it. Otherwise, create it.

Keys that are created are named based on their comment and fingerprint.

Return type:dict
ex_get_console_output(node)[source]

Gets console output for the node.

Parameters:node (Node) – Node which should be used
Returns:A dictionary with the following keys: - instance_id (str) - timestamp (datetime.datetime) - last output timestamp - output (str) - console output
Return type:dict
ex_get_limits()[source]

Retrieve account resource limits.

Return type:dict
ex_get_metadata_for_node(node)[source]

Returns the metadata associated with the node.

Parameters:node (Node) – Node instance
Returns:A dictionary or other mapping of strings to strings, associating tag names with tag values.
Rtype tags:dict
ex_get_security_groups(group_ids=None, group_names=None, filters=None)[source]

Returns a list of EC2SecurityGroup objects for the current region.

Parameters:
  • group_ids (list) – Returns only groups matching the provided group IDs.
  • group_names – Returns only groups matching the provided group names.
  • filters (dict) – The filters so that the list returned includes information for specific security groups only.
Return type:

list of EC2SecurityGroup

ex_import_keypair(name, keyfile)[source]

Imports a new public key where the public key is passed via a filename.

@note: This is a non-standard extension API, and only works for EC2.

Parameters:
  • name (str) – The name of the public key to import. This must be unique, otherwise an InvalidKeyPair. Duplicate exception is raised.
  • keyfile (str) – The filename with the path of the public key to import.
Return type:

dict

ex_import_keypair_from_string(name, key_material)[source]

Imports a new public key where the public key is passed in as a string.

@note: This is a non-standard extension API, and only works for EC2.

Parameters:
  • name (str) – The name of the public key to import. This must be unique, otherwise an InvalidKeyPair.Duplicate exception is raised.
  • key_material (str) – The contents of a public key file.
Return type:

dict

ex_import_snapshot(client_data=None, client_token=None, description=None, disk_container=None, dry_run=None, role_name=None)[source]

Imports a disk into an EBS snapshot. More information can be found at https://goo.gl/sbXkYA.

Parameters:
  • client_data (dict) – Describes the client specific data (optional)
  • client_token (str) – The token to enable idempotency for VM (optional)
  • description (str) – The description string for the import snapshot task.(optional)
:param disk_container:The disk container object for the
import snapshot request.

:type disk_container:dict

Parameters:
  • dry_run (bool) – Checks whether you have the permission for the action, without actually making the request, and provides an error response.(optional)
  • role_name (str) – The name of the role to use when not using the default role, ‘vmimport’.(optional)
Return type:

class:VolumeSnapshot

ex_list_availability_zones(only_available=True)[source]

Returns a list of ExEC2AvailabilityZone objects for the current region.

Note: This is an extension method and is only available for EC2 driver.

Parameters:only_available (str) – If true, returns only availability zones with state ‘available’
Return type:list of ExEC2AvailabilityZone
ex_list_internet_gateways(gateway_ids=None, filters=None)[source]

Describes available Internet gateways and whether or not they are attached to a VPC. These are required for VPC nodes to communicate over the Internet.

Parameters:
  • gateway_ids (list) – Returns only Internet gateways matching the provided Internet gateway IDs. If not specified, a list of all the Internet gateways in the corresponding region is returned.
  • filters (dict) – The filters so the list returned includes information for certain gateways only.
Return type:

list of VPCInternetGateway

ex_list_keypairs()[source]

Lists all the keypair names and fingerprints.

Return type:list of dict
ex_list_network_interfaces()[source]

Returns all network interfaces.

Returns:List of EC2NetworkInterface instances
Return type:list of :class EC2NetworkInterface
ex_list_networks(network_ids=None, filters=None)[source]

Returns a list of EC2Network objects for the current region.

Parameters:
  • network_ids (list) – Returns only networks matching the provided network IDs. If not specified, a list of all the networks in the corresponding region is returned.
  • filters (dict) – The filters so that the list returned includes information for certain networks only.
Return type:

list of EC2Network

ex_list_placement_groups(names=None)[source]

A list of placement groups.

Parameters:names (list of str) – Placement Group names
Return type:list of EC2PlacementGroup
ex_list_reserved_nodes()[source]

Lists all reserved instances/nodes which can be purchased from Amazon for one or three year terms. Reservations are made at a region level and reduce the hourly charge for instances.

More information can be found at http://goo.gl/ulXCC7.

Return type:list of EC2ReservedNode
ex_list_route_tables(route_table_ids=None, filters=None)[source]

Describes one or more of a VPC’s route tables. These are used to determine where network traffic is directed.

Parameters:
  • route_table_ids (list) – Returns only route tables matching the provided route table IDs. If not specified, a list of all the route tables in the corresponding region is returned.
  • filters (dict) – The filters so that the list returned includes information for certain route tables only.
Return type:

list of EC2RouteTable

ex_list_security_groups()[source]

Lists existing Security Groups.

@note: This is a non-standard extension API, and only works for EC2.

Return type:list of str
ex_list_subnets(subnet_ids=None, filters=None)[source]

Returns a list of EC2NetworkSubnet objects for the current region.

Parameters:
  • subnet_ids (list) – Returns only subnets matching the provided subnet IDs. If not specified, a list of all the subnets in the corresponding region is returned.
  • filters (dict) – The filters so that the list returned includes information for certain subnets only.
Return type:

list of EC2NetworkSubnet

ex_modify_image_attribute(image, attributes)[source]

Modifies image attributes.

Parameters:
  • image (NodeImage) – NodeImage instance
  • attributes (dict) – A dictionary with node attributes
Returns:

True on success, False otherwise.

Return type:

bool

ex_modify_instance_attribute(node, attributes)[source]

Modify node attributes. A list of valid attributes can be found at http://goo.gl/gxcj8

Parameters:
  • node (Node) – Node instance
  • attributes (dict) – Dictionary with node attributes
Returns:

True on success, False otherwise.

Return type:

bool

ex_modify_snapshot_attribute(snapshot, attributes)[source]

Modify Snapshot attributes.

Parameters:
  • snapshot – VolumeSnapshot instance
  • attributes (dict) – Dictionary with snapshot attributes
Returns:

True on success, False otherwise.

Return type:

bool

ex_modify_subnet_attribute(subnet, attribute='auto_public_ip', value=False)[source]

Modifies a subnet attribute. You can only modify one attribute at a time.

Parameters:
  • subnet (EC2NetworkSubnet) – The subnet to delete
  • attribute (str) – The attribute to set on the subnet; one of: 'auto_public_ip': Automatically allocate a public IP address when a server is created 'auto_ipv6': Automatically assign an IPv6 address when a server is created
  • value (bool) – The value to set the subnet attribute to (defaults to False)
Return type:

bool

ex_modify_volume(volume, parameters)[source]

Modify volume parameters. A list of valid parameters can be found at https://goo.gl/N0rPEQ

Parameters:
  • volume (Volume) – Volume instance
  • parameters (dict) – Dictionary with updated volume parameters
Returns:

Volume modification status object

Return type:

:class:`VolumeModification

ex_register_image(name, description=None, architecture=None, image_location=None, root_device_name=None, block_device_mapping=None, kernel_id=None, ramdisk_id=None, virtualization_type=None, ena_support=None, billing_products=None, sriov_net_support=None, boot_mode: str = None, tpm_support: str = None, uefi_data: str = None, imds_support: str = None)[source]

Registers an Amazon Machine Image based off of an EBS-backed instance. Can also be used to create images from snapshots. More information can be found at http://goo.gl/hqZq0a.

Parameters:
  • name (str) – The name for the AMI being registered
  • description (str) – The description of the AMI (optional)
  • architecture (str) – The architecture of the AMI (i386/x86_64) (optional)
  • image_location (str) – The location of the AMI within Amazon S3 Required if registering an instance store-backed AMI
  • root_device_name (str) – The device name for the root device Required if registering an EBS-backed AMI
  • block_device_mapping (dict) – A dictionary of the disk layout (optional)
  • kernel_id (str) – Kernel id for AMI (optional)
  • ramdisk_id (str) – RAM disk for AMI (optional)
  • virtualization_type (str) – The type of virtualization for the AMI you are registering, paravirt or hvm (optional)
  • ena_support (bool) – Enable enhanced networking with Elastic Network Adapter for the AMI
  • billing_products (''list'') – The billing product codes
  • sriov_net_support (str) – Set to “simple” to enable enhanced networking with the Intel 82599 Virtual Function interface
  • boot_mode (str) – desired boot mode for the AMI.
  • tpm_support (str) – set to v2.0 to enable TPM support.
  • uefi_data (str) – base64 representation of the non-volatile UEFI variable store.
  • imds_support (str) – set to v2.0 to require HTTP tokens when accessing the IMDS on instances launched from the resulting image.
Return type:

NodeImage

ex_release_address(elastic_ip, domain=None)[source]

Releases an Elastic IP address using the IP (EC2-Classic) or using the allocation ID (VPC).

Parameters:
  • elastic_ip (ElasticIP) – Elastic IP instance
  • domain (str) – The domain where the IP resides (vpc only)
Returns:

True on success, False otherwise.

Return type:

bool

ex_replace_route(route_table, cidr, internet_gateway=None, node=None, network_interface=None, vpc_peering_connection=None)[source]

Replaces an existing route entry within a route table in a VPC.

Parameters:
  • route_table (EC2RouteTable) – The route table to replace the route in.
  • cidr (str) – The CIDR block used for the destination match.
  • internet_gateway (VPCInternetGateway) – The new internet gateway to route traffic through.
  • node (Node) – The new NAT instance to route traffic through.
  • network_interface (EC2NetworkInterface) – The new network interface of the node to route traffic through.
  • vpc_peering_connection (VPCPeeringConnection) – The new VPC peering connection.
Return type:

bool

Note: You must specify one of the following: internet_gateway,
node, network_interface, vpc_peering_connection.
ex_replace_route_table_association(subnet_association, route_table)[source]

Changes the route table associated with a given subnet in a VPC.

Note: This method can be used to change which table is the main route
table in the VPC (Specify the main route table’s association ID and the route table to be the new main route table).
Parameters:
  • subnet_association (EC2SubnetAssociation or str) – The subnet association object or subnet association ID.
  • route_table (EC2RouteTable) – The new route table to associate.
Returns:

A new route table association ID.

Return type:

str

ex_revoke_security_group_egress(id, from_port, to_port, cidr_ips=None, group_pairs=None, protocol='tcp')[source]

Edit a Security Group to revoke specific egress traffic using CIDR blocks or either a group ID, group name or user ID (account). This call is not supported for EC2 classic and only works for VPC groups.

Parameters:
  • id (str) – The id of the security group to edit
  • from_port (int) – The beginning of the port range to open
  • to_port (int) – The end of the port range to open
  • cidr_ips (list) – The list of ip ranges to allow traffic for.
  • group_pairs (list of dict) –

    Source user/group pairs to allow traffic for. More info can be found at http://goo.gl/stBHJF

    EC2 Classic Example: To allow access from any system associated with the default group on account 1234567890

    [{‘group_name’: ‘default’, ‘user_id’: ‘1234567890’}]

    VPC Example: Allow access from any system associated with security group sg-47ad482e on your own account

    [{‘group_id’: ‘ sg-47ad482e’}]

  • protocol (str) – tcp/udp/icmp
Return type:

bool

ex_revoke_security_group_ingress(id, from_port, to_port, cidr_ips=None, group_pairs=None, protocol='tcp')[source]

Edits a Security Group to revoke specific ingress traffic using CIDR blocks or either a group ID, group name or user ID (account).

Parameters:
  • id (str) – The ID of the security group to edit
  • from_port (int) – The beginning of the port range to open
  • to_port (int) – The end of the port range to open
  • cidr_ips (list) – The list of ip ranges to allow traffic for.
  • group_pairs (list of dict) –

    Source user/group pairs to allow traffic for. More info can be found at http://goo.gl/stBHJF

    EC2 Classic Example: To allow access from any system associated with the default group on account 1234567890

    [{‘group_name’: ‘default’, ‘user_id’: ‘1234567890’}]

    VPC Example: Allow access from any system associated with security group sg-47ad482e on your own account

    [{‘group_id’: ‘ sg-47ad482e’}]

  • protocol (str) – tcp/udp/icmp
Return type:

bool

ex_start_node(node)[source]
ex_stop_node(node)[source]
features = {'create_node': ['ssh_key']}
get_image(image_id)[source]

Gets an image based on an image_id.

Parameters:image_id (str) – Image identifier
Returns:A NodeImage object
Return type:NodeImage
get_key_pair(name)[source]

Retrieve a single key pair.

Parameters:name (str) – Name of the key pair to retrieve.
Return type:KeyPair
import_key_pair_from_string(name, key_material)[source]

Import a new public key from string.

Parameters:
  • name (str) – Key pair name.
  • key_material (str) – Public key material.
Return type:

KeyPair object

list_images(location=None, ex_image_ids=None, ex_owner=None, ex_executableby=None, ex_filters=None)[source]

Lists all images @inherits: NodeDriver.list_images

Ex_image_ids parameter is used to filter the list of images that should be returned. Only the images with the corresponding image IDs will be returned.

Ex_owner parameter is used to filter the list of images that should be returned. Only the images with the corresponding owner will be returned. Valid values: amazon|aws-marketplace|self|all|aws id

Ex_executableby parameter describes images for which the specified user has explicit launch permissions. The user can be an AWS account ID, self to return images for which the sender of the request has explicit launch permissions, or all to return images with public launch permissions. Valid values: all|self|aws id

Ex_filters parameter is used to filter the list of images that should be returned. Only images matching the filter will be returned.

Parameters:
  • ex_image_ids (list of str) – List of NodeImage.id
  • ex_owner (str) – Owner name
  • ex_executableby (str) – Executable by
  • ex_filters (dict) – Filter by
Return type:

list of NodeImage

list_key_pairs()[source]

List all the available key pair objects.

Return type:list of KeyPair objects
list_locations()[source]

List data centers for a provider

Returns:list of node location objects
Return type:list of NodeLocation
list_nodes(ex_node_ids=None, ex_filters=None)[source]

Lists all nodes.

Ex_node_ids parameter is used to filter the list of nodes that should be returned. Only the nodes with the corresponding node IDs will be returned.

Parameters:
  • ex_node_ids (list of str) – List of node.id
  • ex_filters (dict) – The filters so that the list includes information for certain nodes only.
Return type:

list of Node

list_sizes(location=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 of NodeSize
list_snapshots(snapshot=None, owner=None)[source]

Describes all snapshots.

Parameters:
  • snapshot – If provided, only returns snapshot information for the provided snapshot.
  • owner (str) – The owner of the snapshot: self|amazon|ID
Return type:

list of VolumeSnapshot

list_volume_snapshots(volume)[source]

List snapshots for a storage volume.

Return type:list of VolumeSnapshot
list_volumes(node=None, ex_filters=None)[source]

List volumes that are attached to a node, if specified and those that satisfy the filters, if specified.

Parameters:
  • node (Node) – The node to which the volumes are attached.
  • ex_filters (dict) – The dictionary of additional filters.
Returns:

The list of volumes that match the criteria.

Return type:

list of StorageVolume

path = '/'
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
region_name = ''
signature_version = '2'
start_node(node)[source]

Starts the node by passing in the node object, does not work with instance store backed instances.

Parameters:node (Node) – The node to be used
Return type:bool
stop_node(node)[source]

Stops the node by passing in the node object, does not work with instance store backed instances

Parameters:node (Node) – The node to be used
Return type:bool
class libcloud.compute.drivers.ec2.NimbusNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.ec2.BaseEC2NodeDriver

Driver class for Nimbus

Parameters:
  • key (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

api_name = 'nimbus'
connectionCls

alias of NimbusConnection

country = 'Private'
ex_create_tags(resource, tags)[source]

Nimbus doesn’t support creating tags, so this is a pass-through.

@inherits: EC2NodeDriver.ex_create_tags

ex_describe_addresses(nodes)[source]

Nimbus doesn’t support elastic IPs, so this is a pass-through.

@inherits: EC2NodeDriver.ex_describe_addresses

friendly_name = 'Nimbus Private Cloud'
list_sizes(location=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 of NodeSize
name = 'Nimbus'
region_name = 'nimbus'
signature_version = '2'
type = 'nimbus'
website = 'http://www.nimbusproject.org/'
class libcloud.compute.drivers.ec2.EucNodeDriver(key, secret=None, secure=True, host=None, path=None, port=None, api_version='3.3.0')[source]

Bases: libcloud.compute.drivers.ec2.BaseEC2NodeDriver

Driver class for Eucalyptus

@inherits: EC2NodeDriver.__init__

Parameters:
  • path (str) – The host where the API can be reached.
  • api_version (str) – The API version to extend support for Eucalyptus proprietary API calls
api_name = 'ec2_us_east'
connectionCls

alias of EucConnection

list_locations()[source]

List data centers for a provider

Returns:list of node location objects
Return type:list of NodeLocation
list_sizes()[source]

Lists available nodes sizes.

Return type:list of NodeSize
name = 'Eucalyptus'
region_name = 'us-east-1'
signature_version = '2'
website = 'http://www.eucalyptus.com/'
class libcloud.compute.drivers.ec2.OutscaleSASNodeDriver(key, secret=None, secure=True, host=None, port=None, region='us-east-1', region_details=None, **kwargs)[source]

Bases: libcloud.compute.drivers.ec2.OutscaleNodeDriver

Outscale SAS node driver

name = 'Outscale SAS'
type = 'outscale_sas'
class libcloud.compute.drivers.ec2.OutscaleINCNodeDriver(key, secret=None, secure=True, host=None, port=None, region='us-east-1', region_details=None, **kwargs)[source]

Bases: libcloud.compute.drivers.ec2.OutscaleNodeDriver

Outscale INC node driver

name = 'Outscale INC'
type = 'outscale_inc'
class libcloud.compute.drivers.ec2.EC2NodeLocation(id, name, country, driver, availability_zone)[source]

Bases: libcloud.compute.base.NodeLocation

class libcloud.compute.drivers.ec2.EC2ReservedNode(id, state, driver, size=None, image=None, extra=None)[source]

Bases: libcloud.compute.base.Node

Class which stores information about EC2 reserved instances/nodes Inherits from Node and passes in None for name and private/public IPs

Note: This class is EC2 specific.

class libcloud.compute.drivers.ec2.EC2SecurityGroup(id, name, ingress_rules, egress_rules, extra=None)[source]

Bases: object

Represents information about a Security group

Note: This class is EC2 specific.

class libcloud.compute.drivers.ec2.EC2ImportSnapshotTask(status, snapshotId)[source]

Bases: object

Represents information about a describe_import_snapshot_task.

Note: This class is EC2 specific.

class libcloud.compute.drivers.ec2.EC2PlacementGroup(name, state, strategy='cluster', extra=None)[source]

Bases: object

Represents information about a Placement Grous

Note: This class is EC2 specific.

class libcloud.compute.drivers.ec2.EC2Network(id, name, cidr_block, extra=None)[source]

Bases: object

Represents information about a VPC (Virtual Private Cloud) network

Note: This class is EC2 specific.

class libcloud.compute.drivers.ec2.EC2NetworkSubnet(id, name, state, extra=None)[source]

Bases: object

Represents information about a VPC (Virtual Private Cloud) subnet

Note: This class is EC2 specific.

class libcloud.compute.drivers.ec2.EC2NetworkInterface(id, name, state, extra=None)[source]

Bases: object

Represents information about a VPC network interface

Note: This class is EC2 specific. The state parameter denotes the current status of the interface. Valid values for state are attaching, attached, detaching and detached.

class libcloud.compute.drivers.ec2.EC2RouteTable(id, name, routes, subnet_associations, propagating_gateway_ids, extra=None)[source]

Bases: object

Class which stores information about VPC Route Tables.

Note: This class is VPC specific.

Parameters:
  • id (str) – The ID of the route table.
  • name (str) – The name of the route table.
  • routes (list of EC2Route) – A list of routes in the route table.
  • subnet_associations (list of EC2SubnetAssociation) – A list of associations between the route table and one or more subnets.
  • propagating_gateway_ids (list) – The list of IDs of any virtual private gateways propagating the routes.
class libcloud.compute.drivers.ec2.EC2Route(cidr, gateway_id, instance_id, owner_id, interface_id, state, origin, vpc_peering_connection_id)[source]

Bases: object

Class which stores information about a Route.

Note: This class is VPC specific.

Parameters:
  • cidr (str) – The CIDR block used for the destination match.
  • gateway_id (str) – The ID of a gateway attached to the VPC.
  • instance_id (str) – The ID of a NAT instance in the VPC.
  • owner_id (str) – The AWS account ID of the owner of the instance.
  • interface_id (str) – The ID of the network interface.
  • state (str) – The state of the route (active | blackhole).
  • origin (str) – Describes how the route was created.
  • vpc_peering_connection_id (str) – The ID of the VPC peering connection.
class libcloud.compute.drivers.ec2.EC2SubnetAssociation(id, route_table_id, subnet_id, main=False)[source]

Bases: object

Class which stores information about Route Table associated with a given Subnet in a VPC

Note: This class is VPC specific.

Parameters:
  • id (str) – The ID of the subnet association in the VPC.
  • route_table_id (str) – The ID of a route table in the VPC.
  • subnet_id (str) – The ID of a subnet in the VPC.
  • main (bool) – If true, means this is a main VPC route table.
class libcloud.compute.drivers.ec2.ExEC2AvailabilityZone(name, zone_state, region_name)[source]

Bases: object

Extension class which stores information about an EC2 availability zone.

Note: This class is EC2 specific.

exception libcloud.compute.drivers.ec2.IdempotentParamError(value, driver=None)[source]

Bases: libcloud.common.types.LibcloudError

Request used the same client token as a previous, but non-identical request.

libcloud.compute.drivers.ecs module

Node driver for Aliyun.

class libcloud.compute.drivers.ecs.DiskCategory[source]

Bases: object

Enum defined disk types supported by Aliyun system and data disks.

CLOUD = 'cloud'
CLOUD_EFFICIENCY = 'cloud_efficiency'
CLOUD_SSD = 'cloud_ssd'
EPHEMERAL_SSD = 'ephemeral_ssd'
class libcloud.compute.drivers.ecs.InternetChargeType[source]

Bases: object

Internet connection billing types for Aliyun Nodes.

BY_BANDWIDTH = 'PayByBandwidth'
BY_TRAFFIC = 'PayByTraffic'
class libcloud.compute.drivers.ecs.ECSDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Aliyun ECS node driver.

Used for Aliyun ECS service.

TODO: Get guest OS root password Adjust internet bandwidth settings Manage security groups and rules

Parameters:
  • key (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_MAPPING = {'Running': running, 'Starting': pending, 'Stopped': stopped, 'Stopping': pending}
SNAPSHOT_STATE_MAPPING = {'accomplished': available, 'failed': error, 'progressing': creating}
VOLUME_STATE_MAPPING = {'Attaching': attaching, 'Available': available, 'Creating': creating, 'Detaching': inuse, 'In_use': inuse, 'ReIniting': creating}
attach_volume(node, volume, device=None, ex_delete_with_instance=None)[source]

Attaches volume to node.

@inherits NodeDriver.attach_volume

Parameters:
  • device (str between /dev/xvdb to xvdz, if empty, allocated by the system) – device path allocated for this attached volume
  • ex_delete_with_instance (bool) – if to delete this volume when the instance is deleted.
connectionCls

alias of ECSConnection

copy_image(source_region, node_image, name, description=None, ex_destination_region_id=None, ex_client_token=None)[source]

Copies an image from a source region to the destination region. If not provide a destination region, default to the current region.

@inherits NodeDriver.copy_image

Parameters:
  • ex_destination_region_id (str) – id of the destination region
  • ex_client_token (str) – a token generated by client to identify each request.
create_image(node, name, description=None, ex_snapshot_id=None, ex_image_version=None, ex_client_token=None)[source]

Creates an image from a system disk snapshot.

@inherits NodeDriver.create_image

Parameters:
  • ex_snapshot_id (str) – the id of the snapshot to create the image. (required)
  • ex_image_version (str) – the version number of the image
  • ex_client_token (str) – a token generated by client to identify each request.
create_node(name, size, image, auth=None, ex_security_group_id=None, ex_description=None, ex_internet_charge_type=None, ex_internet_max_bandwidth_out=None, ex_internet_max_bandwidth_in=None, ex_hostname=None, ex_io_optimized=None, ex_system_disk=None, ex_data_disks=None, ex_vswitch_id=None, ex_private_ip_address=None, ex_client_token=None, **kwargs)[source]

@inherits: NodeDriver.create_node

Parameters:
  • name (str) – The name for this new node (required)
  • image (NodeImage) – The image to use when creating this node (required)
  • size (NodeSize) – The size of the node to create (required)
  • auth (NodeAuthSSHKey or NodeAuthPassword) – Initial authentication information for the node (optional)
  • ex_security_group_id (str) – The id of the security group the new created node is attached to. (required)
  • ex_description (str) – A description string for this node (optional)
  • ex_internet_charge_type (a str of ‘PayByTraffic’ or ‘PayByBandwidth’) – The internet charge type (optional)
  • ex_internet_max_bandwidth_out (a int in range [0, 100] a int in range [1, 100] for ‘PayByTraffic’ internet charge type) – The max output bandwidth, in Mbps (optional) Required for ‘PayByTraffic’ internet charge type
  • ex_internet_max_bandwidth_in (a int in range [1, 200] default to 200 in server side) – The max input bandwidth, in Mbps (optional)
  • ex_hostname (str) – The hostname for the node (optional)
  • ex_io_optimized (boll) – Whether the node is IO optimized (optional)
  • ex_system_disk (dict) – The system disk for the node (optional)
  • ex_data_disks (a list of dict) – The data disks for the node (optional)
  • ex_vswitch_id (str) – The id of vswitch for a VPC type node (optional)
  • ex_private_ip_address (str) – The IP address in private network (optional)
  • ex_client_token – A token generated by client to keep requests idempotency (optional)
create_public_ip(instance_id)[source]

Create public ip.

Parameters:instance_id (str) – instance id for allocating public ip.

:return public ip :rtype str

create_volume(size, name, location=None, snapshot=None, ex_zone_id=None, ex_description=None, ex_disk_category=None, ex_client_token=None)[source]

Create a new volume.

@inherites NodeDriver.create_volume

Parameters:
  • ex_zone_id (str) – the availability zone id (required)
  • ex_description (unicode) – volume description
  • ex_disk_category (str) – disk category for data disk
  • ex_client_token (str) – a token generated by client to identify each request.
create_volume_snapshot(volume, name=None, ex_description=None, ex_client_token=None)[source]

Creates a snapshot of the storage volume.

@inherits NodeDriver.create_volume_snapshot

Parameters:
  • ex_description (unicode) – description of the snapshot.
  • ex_client_token (str) – a token generated by client to identify each request.
delete_image(node_image)[source]

Deletes a node image from a provider.

Parameters:node_image (NodeImage) – Node image object.
Returns:True if delete_image was successful, False otherwise.
Return type:bool
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
destroy_volume(volume)[source]

Destroys a storage volume.

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
destroy_volume_snapshot(snapshot)[source]

Destroys a snapshot.

Parameters:snapshot (VolumeSnapshot) – The snapshot to delete
Return type:bool
detach_volume(volume, ex_instance_id=None)[source]

Detaches a volume from a node.

@inherits NodeDriver.detach_volume

Parameters:ex_instance_id (str) – the id of the instance from which the volume is detached.
disk_categories

alias of DiskCategory

ex_create_security_group(description=None, client_token=None)[source]

Create a new security group.

Parameters:
  • description (unicode) – security group description
  • client_token (str) – a token generated by client to identify each request.
ex_delete_security_group_by_id(group_id=None)[source]

Delete a new security group.

Parameters:group_id (str) – security group id
ex_join_security_group(node, group_id=None)[source]

Join a node into security group.

Parameters:
  • node (Node) – The node to join security group
  • group_id (str) – security group id.
Returns:

join operation result.

Return type:

bool

ex_leave_security_group(node, group_id=None)[source]

Leave a node from security group.

Parameters:
  • node (Node) – The node to leave security group
  • group_id (str) – security group id.
Returns:

leave operation result.

Return type:

bool

ex_list_security_group_attributes(group_id=None, nic_type='internet')[source]

List security group attributes in the current region.

Parameters:
  • group_id (str) – security group id.
  • nic_type (str) – internet|intranet.
Returns:

a list of defined security group Attributes

Return type:

list of ECSSecurityGroupAttribute

ex_list_security_groups(ex_filters=None)[source]

List security groups in the current region.

Parameters:ex_filters (dict) – security group attributes to filter results.
Returns:a list of defined security groups
Return type:list of ECSSecurityGroup
ex_list_zones(region_id=None)[source]

List availability zones in the given region or the current region.

Parameters:region_id (str) – the id of the region to query zones from
Returns:list of zones
Return type:list of ECSZone
ex_modify_security_group_by_id(group_id=None, name=None, description=None)[source]

Modify a new security group. :keyword group_id: id of the security group :type group_id: str :keyword name: new name of the security group :type name: unicode :keyword description: new description of the security group :type description: unicode

ex_start_node(node)[source]
ex_stop_node(node, ex_force_stop=False)[source]
features = {'create_node': ['password']}
get_image(image_id, ex_region_id=None)[source]

Returns a single node image from a provider.

Parameters:image_id (str) – Node to run the task on.

:rtype NodeImage: :return: NodeImage instance on success.

internet_charge_types

alias of InternetChargeType

list_images(location=None, ex_image_ids=None, ex_filters=None)[source]

List images on a provider.

@inherits NodeDriver.list_images

Parameters:
  • ex_image_ids (list of str) – a list of image ids to filter the images to be returned.
  • ex_filters (dict) – image attribute and value pairs to filter images. Only the image which matches all the pairs will be returned. If the filter attribute need a json array value, use list object, the driver will convert it.
list_locations()[source]

List data centers for a provider

Returns:list of node location objects
Return type:list of NodeLocation
list_nodes(ex_node_ids=None, ex_filters=None)[source]

List all nodes.

@inherits: NodeDriver.create_node

Parameters:
  • ex_node_ids (list of str) – a list of node’s ids used to filter nodes. Only the nodes which’s id in this list will be returned.
  • ex_filters (dict) – node attribute and value pairs to filter nodes. Only the nodes which matches all the pairs will be returned. If the filter attribute need a json array value, use list object, the driver will convert it.
list_sizes(location=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 of NodeSize
list_volume_snapshots(volume, ex_snapshot_ids=[], ex_filters=None)[source]

List snapshots for a storage volume.

@inherites NodeDriver.list_volume_snapshots

Parameters:
  • ex_snapshot_ids (list of str) – a list of snapshot ids to filter the snapshots returned.
  • ex_filters (dict) – snapshot attribute and value pairs to filter snapshots. Only the snapshot which matches all the pairs will be returned. If the filter attribute need a json array value, use list object, the driver will convert it.
list_volumes(ex_volume_ids=None, ex_filters=None)[source]

List all volumes.

@inherits: NodeDriver.list_volumes

Parameters:
  • ex_volume_ids (list of str) – a list of volume’s ids used to filter volumes. Only the volumes which’s id in this list will be returned.
  • ex_filters (dict) – volume attribute and value pairs to filter volumes. Only the volumes which matches all will be returned. If the filter attribute need a json array value, use list object, the driver will convert it.
name = 'Aliyun ECS'
namespace = None
path = '/'
reboot_node(node, ex_force_stop=False)[source]

Reboot the given node

@inherits NodeDriver.reboot_node

Parameters:ex_force_stop (bool) – if True, stop node force (maybe lose data) otherwise, stop node normally, default to False
start_node(node)[source]

Start node to running state.

Parameters:node (Node) – the Node object to start
Returns:starting operation result.
Return type:bool
stop_node(node, ex_force_stop=False)[source]

Stop a running node.

Parameters:
  • node (Node) – The node to stop
  • ex_force_stop (bool) – if True, stop node force (maybe lose data) otherwise, stop node normally, default to False
Returns:

stopping operation result.

Return type:

bool

website = 'https://www.aliyun.com/product/ecs'
class libcloud.compute.drivers.ecs.ECSSecurityGroup(id, name, description=None, driver=None, vpc_id=None, creation_time=None)[source]

Bases: object

Security group used to control nodes internet and intranet accessibility.

class libcloud.compute.drivers.ecs.ECSZone(id, name, driver=None, available_resource_types=None, available_instance_types=None, available_disk_categories=None)[source]

Bases: object

ECSZone used to represent an availability zone in a region.

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: libcloud.common.base.ConnectionKey

Connection class for the Equinix Metal driver.

Initialize user_id and key; set secure to an int based on passed value.

add_default_headers(headers)[source]

Add headers that are necessary for every request

host = 'api.equinix.com'
responseCls

alias of EquinixMetalResponse

class libcloud.compute.drivers.equinixmetal.EquinixMetalNodeDriver(key, project=None)[source]

Bases: libcloud.compute.base.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 = {'active': running, 'deleted': terminated, 'deprovisioning': terminated, 'failed': error, 'inactive': stopped, 'powering_off': rebooting, 'powering_on': rebooting, 'provisioning': pending, 'queued': pending, 'rebooting': rebooting, 'rebuilding': pending}
attach_volume(node, volume)[source]

Attaches volume to node.

Parameters:
  • node (Node) – Node to attach volume to.
  • volume (StorageVolume) – Volume to attach.
Rytpe:

bool

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=[], cloud_init=None, disk=None, disk_size=0, **kwargs)[source]

Create a node.

Returns:The newly created node.
Return type:Node
create_volume(size, location, plan='storage_1', description='', ex_project_id=None, locked=False, billing_cycle=None, customdata='', snapshot_policies=None, **kwargs)[source]

Create a new volume.

Parameters:
  • size (int) – Size of volume in gigabytes (required)
  • location (NodeLocation) – Which data center to create a volume in. If empty, undefined behavior will be selected. (optional)
Returns:

The newly created volume.

Return type:

StorageVolume

create_volume_snapshot(volume, name='')[source]

Create a new volume snapshot.

Parameters:volume (class:StorageVolume) – Volume to create a snapshot for
Returns:The newly created volume snapshot.
Return type:VolumeSnapshot
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
destroy_volume(volume)[source]

Destroys a storage volume.

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
destroy_volume_snapshot(snapshot)[source]

Delete a volume snapshot

Parameters:snapshot (class:VolumeSnapshot) – volume snapshot to delete
Return type:bool
detach_volume(volume, ex_node=None, ex_attachment_id='')[source]

Detaches a volume from a node.

Parameters:
  • volume (StorageVolume) – Volume to be detached
  • ex_attachment_id – Attachment id to be detached, if empty detach all attachments
Return type:

bool

ex_associate_address_with_node(node, address, manageable=False, customdata='')[source]
ex_clone_volume(volume, snapshot=None)[source]
ex_create_bgp_session(node, address_family='ipv4')[source]
ex_delete_bgp_session(session_uuid)[source]
ex_describe_address(ex_address_id, include=None)[source]
ex_describe_all_addresses(ex_project_id=None, only_associated=False)[source]
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 of dict
ex_describe_attachment(attachment_id)[source]
ex_describe_volume(volume_id)[source]
ex_disassociate_address(address_uuid, include=None)[source]
ex_get_bgp_config(ex_project_id=None)[source]
ex_get_bgp_config_for_project(ex_project_id)[source]
ex_get_bgp_session(session_uuid)[source]
ex_get_node_bandwidth(node, from_time, until_time)[source]
ex_list_bgp_sessions(ex_project_id=None)[source]
ex_list_bgp_sessions_for_node(node)[source]
ex_list_bgp_sessions_for_project(ex_project_id)[source]
ex_list_events_for_node(node, include=None, page=1, per_page=10)[source]
ex_list_events_for_project(project, include=None, page=1, per_page=10)[source]
ex_list_ip_assignments_for_node(node, include='')[source]
ex_list_nodes_for_project(ex_project_id, include='plan', page=1, per_page=1000)[source]
ex_list_projects()[source]
ex_list_volumes_for_project(ex_project_id, include='plan', page=1, per_page=1000)[source]
ex_modify_volume(volume, description=None, size=None, locked=None, billing_cycle=None, customdata=None)[source]
ex_reinstall_node(node)[source]
ex_request_address_reservation(ex_project_id, location_id=None, address_family='global_ipv4', quantity=1, comments='', customdata='')[source]
ex_rescue_node(node)[source]
ex_restore_volume(snapshot)[source]
ex_start_node(node)[source]
ex_stop_node(node)[source]
ex_update_node(node, **kwargs)[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 of NodeImage
list_key_pairs()[source]

List all the available SSH keys.

Returns:Available SSH keys.
Return type:list of KeyPair objects
list_locations()[source]

List data centers for a provider

Returns:list of node location objects
Return type:list of NodeLocation
list_nodes(ex_project_id=None)[source]

List all nodes.

Returns:list of node objects
Return type:list of Node
list_resources_async(resource_type)[source]
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 of NodeSize
list_volume_snapshots(volume, include='')[source]

List snapshots for a volume.

Parameters:volume (class:StorageVolume) – Volume to list snapshots for
Returns:List of volume snapshots.
Return type:list of :class: VolumeSnapshot
list_volumes(ex_project_id=None)[source]

List storage volumes.

Return type:list of StorageVolume
name = 'EquinixMetal'
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
stop_node(node)[source]

Stop a node

Parameters:node (Node) – The node to be stopped.
Returns:True if the stop was successful, otherwise False
Return type:bool
type = 'equinixmetal'
website = 'https://metal.equinix.com/'
class libcloud.compute.drivers.equinixmetal.EquinixMetalResponse(response, connection)[source]

Bases: libcloud.common.base.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 or False
valid_response_codes = [<HTTPStatus.OK: 200>, <HTTPStatus.ACCEPTED: 202>, <HTTPStatus.CREATED: 201>, <HTTPStatus.NO_CONTENT: 204>]
class libcloud.compute.drivers.equinixmetal.Project(project)[source]

Bases: object

libcloud.compute.drivers.equinixmetal.use_asyncio()[source]

libcloud.compute.drivers.exoscale module

class libcloud.compute.drivers.exoscale.ExoscaleNodeDriver(key, secret=None, secure=True, host=None, path=None, port=None, url=None, *args, **kwargs)[source]

Bases: libcloud.compute.drivers.cloudstack.CloudStackNodeDriver

Inherits:

NodeDriver.__init__

Parameters:
  • host (str) – The host where the API can be reached. (required)
  • path (str) – The path where the API can be reached. (required)
  • url (str) – Full URL to the API endpoint. Mutually exclusive with host and path argument.
host = 'api.exoscale.com'
name = 'Exoscale'
path = '/compute'
type = 'exoscale'
website = 'https://www.exoscale.com/'

libcloud.compute.drivers.gandi module

Gandi driver for compute

class libcloud.compute.drivers.gandi.GandiNodeDriver(*args, **kwargs)[source]

Bases: libcloud.common.gandi.BaseGandiDriver, libcloud.compute.base.NodeDriver

Gandi node driver

@inherits: NodeDriver.__init__

api_name = 'gandi'
attach_volume(node, volume, device=None)[source]

Attach a volume to a node.

Parameters:
  • node (Node) – The node to attach the volume to
  • volume (StorageVolume) – The volume to attach.
  • device (None) – Not used in this cloud.
Returns:

True if successful

Return type:

bool

country = 'FR'
create_node(name, size, image, location=None, login=None, password=None, inet_family=4, keypairs=None)[source]

Create a new Gandi node

Parameters:
  • name (str) – String with a name for this new 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)
  • size (NodeSize) – The size of resources allocated to this node. (required)
  • login (str) – user name to create for login on machine (required)
  • password (str) – password for user that’ll be created (required)
  • inet_family (int) – version of ip to use, default 4 (optional)
  • keypairs (list of int or KeyPair) – IDs of keypairs or Keypairs object
Return type:

Node

create_volume(size, name, location=None, snapshot=None)[source]

Create a volume (disk).

Parameters:
  • size (int) – Size of volume to create (in GB).
  • name (str) – Name of volume to create
  • location (NodeLocation or None) – Location (zone) to create the volume in
  • snapshot (Snapshot) – Snapshot to create image from
Returns:

Storage Volume object

Return type:

StorageVolume

delete_key_pair(key_pair)[source]

Delete an existing key pair.

Parameters:key_pair (:class.KeyPair` or int) – Key pair object or ID.
Returns:True of False based on success of Keypair deletion
Return type:bool
deploy_node(**kwargs)[source]

deploy_node is not implemented for gandi driver

Return type:bool
destroy_node(node)[source]

Destroy a node.

Parameters:node (Node) – Node object to destroy
Returns:True if successful
Return type:bool
destroy_volume(volume)[source]

Destroy a volume.

Parameters:volume (StorageVolume) – Volume object to destroy
Returns:True if successful
Return type:bool
detach_volume(node, volume)[source]

Detaches a volume from a node.

Parameters:
  • node (Node) – Node which should be used
  • volume (StorageVolume) – Volume to be detached
Return type:

bool

ex_get_node(node_id)[source]

Return a Node object based on a node id.

Parameters:name (int) – The ID of the node
Returns:A Node object for the node
Return type:Node
ex_get_volume(volume_id)[source]

Return a Volume object based on a volume ID.

Parameters:volume_id (int) – The ID of the volume
Returns:A StorageVolume object for the volume
Return type:StorageVolume
ex_list_disks()[source]

Specific method to list all disk

Return type:list of GandiDisk
ex_list_interfaces()[source]

Specific method to list network interfaces

Return type:list of GandiNetworkInterface
ex_node_attach_disk(node, disk)[source]

Specific method to attach a disk to a node

Parameters:
  • node (Node) – Node which should be used
  • disk (GandiDisk) – Disk which should be used
Return type:

bool

ex_node_attach_interface(node, iface)[source]

Specific method to attach an interface to a node

Parameters:
  • node (Node) – Node which should be used
  • iface (GandiNetworkInterface) – Network interface which should be used
Return type:

bool

ex_node_detach_disk(node, disk)[source]

Specific method to detach a disk from a node

Parameters:
  • node (Node) – Node which should be used
  • disk (GandiDisk) – Disk which should be used
Return type:

bool

ex_node_detach_interface(node, iface)[source]

Specific method to detach an interface from a node

Parameters:
  • node (Node) – Node which should be used
  • iface (GandiNetworkInterface) – Network interface which should be used
Return type:

bool

ex_snapshot_disk(disk, name=None)[source]

Specific method to make a snapshot of a disk

Parameters:
  • disk (GandiDisk) – Disk which should be used
  • name (str) – Name which should be used
Return type:

bool

ex_update_disk(disk, new_size=None, new_name=None)[source]

Specific method to update size or name of a disk WARNING: if a server is attached it’ll be rebooted

Parameters:
  • disk (GandiDisk) – Disk which should be used
  • new_size (int) – New size
  • new_name (str) – New name
Return type:

bool

features = {}
friendly_name = 'Gandi.net'
get_key_pair(name)[source]

Retrieve a single key pair.

Parameters:name (str) – Name of the key pair to retrieve.
Return type:KeyPair
import_key_pair_from_string(name, key_material)[source]

Create a new key pair object.

Parameters:
  • name (str) – Key pair name.
  • key_material (str) – Public key material.
Returns:

Imported key pair object.

Return type:

KeyPair

list_images(location=None)[source]

Return a list of image objects.

Parameters:location (NodeLocation) – Which data center to filter a images in.
Returns:List of GCENodeImage objects
Return type:list of GCENodeImage
list_instance_type(location=None)[source]
list_key_pairs()[source]

List registered key pairs.

Returns:A list of key par objects.
Return type:list of libcloud.compute.base.KeyPair
list_locations()[source]

Return a list of locations (datacenters).

Returns:List of NodeLocation objects
Return type:list of NodeLocation
list_nodes()[source]

Return a list of nodes in the current zone or all zones.

Returns:List of Node objects
Return type:list of Node
list_sizes(location=None)[source]

Return a list of sizes (machineTypes) in a zone.

Parameters:location (NodeLocation or None) – Which data center to filter a sizes in.
Returns:List of NodeSize objects
Return type:list of NodeSize
list_volumes()[source]

Return a list of volumes.

Returns:A list of volume objects.
Return type:list of StorageVolume
reboot_node(node)[source]

Reboot a node.

Parameters:node (Node) – Node to be rebooted
Returns:True if successful, False if not
Return type:bool
type = 'gandi'
website = 'http://www.gandi.net/'

libcloud.compute.drivers.gce module

Module for Google Compute Engine Driver.

class libcloud.compute.drivers.gce.GCEAcceleratorType(id, name, zone, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE AcceleratorType resource.

destroy()[source]
class libcloud.compute.drivers.gce.GCEAddress(id, name, address, region, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE Static address.

destroy()[source]

Destroy this address.

Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCEAutoscaler(id, name, zone, target, policy, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

Represents a autoscaling policy object used to scale Instance Groups.

destroy()[source]

Destroy this Autoscaler.

Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCEBackend(instance_group, balancing_mode='UTILIZATION', max_utilization=None, max_rate=None, max_rate_per_instance=None, capacity_scaler=1, description=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE Backend. Only used for creating Backend Services.

to_backend_dict()[source]

Returns dict formatted for inclusion in Backend Service Request.

Returns:dict formatted as a list entry for Backend Service ‘backend’.
Return type:dict
class libcloud.compute.drivers.gce.GCEBackendService(id, name, backends, healthchecks, port, port_name, protocol, timeout, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE Backend Service.

destroy()[source]

Destroy this Backend Service.

Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCEConnection(user_id, key, secure, auth_type=None, credential_file=None, project=None, **kwargs)[source]

Bases: libcloud.common.google.GoogleBaseConnection

Connection class for the GCE driver.

GCEConnection extends google.GoogleBaseConnection for 3 reasons:
  1. modify request_path for GCE URI.
  2. Implement gce_params functionality described below.
  3. Add request_aggregated_items method for making aggregated API calls.

If the parameter gce_params is set to a dict prior to calling request(), the URL parameters will be updated to include those key/values FOR A SINGLE REQUEST. If the response contains a nextPageToken, gce_params[‘pageToken’] will be set to its value. This can be used to implement paging in list:

>>> params, more_results = {'maxResults': 2}, True
>>> while more_results:
...     driver.connection.gce_params=params
...     driver.ex_list_urlmaps()
...     more_results = 'pageToken' in params
...
[<GCEUrlMap id="..." name="cli-map">, <GCEUrlMap id="..." name="lc-map">]
[<GCEUrlMap id="..." name="web-map">]
host = 'www.googleapis.com'
paginated_request(*args, **kwargs)[source]

Generic function to create a paginated request to any API call not only aggregated or zone ones as request_aggregated_items.

@inherits: GoogleBaseConnection.request

pre_connect_hook(params, headers)[source]

Update URL parameters with values from self.gce_params.

@inherits: GoogleBaseConnection.pre_connect_hook

request(*args, **kwargs)[source]

Perform request then do GCE-specific processing of URL params.

@inherits: GoogleBaseConnection.request

request_aggregated_items(api_name, zone=None)[source]

Perform request(s) to obtain all results from ‘api_name’.

This method will make requests to the aggregated ‘api_name’ until all results are received. It will then, through a helper function, combine all results and return a single ‘items’ dictionary.

Parameters:
  • api_name (str) – Name of API to call. Consult API docs for valid names.
  • zone (GCEZone) – Optional zone to use.
Returns:

dict in the format of the API response. format: { ‘items’: {‘key’: {api_name: []}} } ex: { ‘items’: {‘zones/us-central1-a’: {disks: []}} }

Return type:

dict

responseCls

alias of GCEResponse

class libcloud.compute.drivers.gce.GCEDiskType(id, name, zone, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE DiskType resource.

destroy()[source]
class libcloud.compute.drivers.gce.GCEFailedDisk(name, error, code)[source]

Bases: object

Dummy Node object for disks that are not created.

class libcloud.compute.drivers.gce.GCEFailedNode(name, error, code)[source]

Bases: object

Dummy Node object for nodes that are not created.

class libcloud.compute.drivers.gce.GCEFirewall(id, name, allowed, denied, direction, network, source_ranges, source_tags, priority, source_service_accounts, target_service_accounts, target_tags, target_ranges, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE Firewall rule class.

destroy()[source]

Destroy this firewall.

Returns:True if successful
Return type:bool
update()[source]

Commit updated firewall values.

Returns:Updated Firewall object
Return type:GCEFirewall
class libcloud.compute.drivers.gce.GCEForwardingRule(id, name, region, address, protocol, targetpool, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

destroy()[source]

Destroy this Forwarding Rule

Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCEHealthCheck(id, name, path, port, interval, timeout, unhealthy_threshold, healthy_threshold, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE Http Health Check class.

destroy()[source]

Destroy this Health Check.

Returns:True if successful
Return type:bool
update()[source]

Commit updated healthcheck values.

Returns:Updated Healthcheck object
Return type:GCEHealthcheck
class libcloud.compute.drivers.gce.GCEInstanceGroup(id, name, zone, driver, extra=None, network=None, subnetwork=None, named_ports=None)[source]

Bases: libcloud.compute.base.UuidMixin

GCEInstanceGroup represents the InstanceGroup resource.

Parameters:
  • name (str) – Required. The name of the instance group. The name must be 1-63 characters long, and comply with RFC1035.
  • zone (GCEZone) – The URL of the zone where the instance group is located.
  • network (GCENetwork) – The URL of the network to which all instances in the instance group belong.
  • subnetwork (GCESubnetwork) – The URL of the subnetwork to which all instances in the instance group belong.
  • named_ports ("<type 'list'>") – Assigns a name to a port number. For example: {name: “http”, port: 80} This allows the system to reference ports by the assigned name instead of a port number. Named ports can also contain multiple ports. For example: [{name: “http”, port: 80},{name: “http”, port: 8080}] Named ports apply to all instances in this instance group.
add_instances(node_list)[source]

Adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. Read Adding instances for more information.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • instancegroup (:class:GCEInstanceGroup) – The Instance Group where you are adding instances.
  • node_list (list of Node or list of GCENode) – List of nodes to add.
Returns:

Return True if successful.

Return type:

bool

destroy()[source]

Destroy this InstanceGroup.

Returns:Return True if successful.
Return type:bool
list_instances()[source]

Lists the instances in the specified instance group.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute * https://www.googleapis.com/auth/compute.readonly

Returns:List of GCENode objects.
Return type:list of GCENode objects.
remove_instances(node_list)[source]

Removes one or more instances from the specified instance group, but does not delete those instances.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • instancegroup (:class:GCEInstanceGroup) – The Instance Group where you are removng instances.
  • node_list (list of Node or list of GCENode) – List of nodes to add.
Returns:

Return True if successful.

Return type:

bool

set_named_ports(named_ports)[source]

Sets the named ports for the specified instance group.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:named_ports (list of {‘name’: str, ‘port`: int}) – Assigns a name to a port number. For example: {name: “http”, port: 80} This allows the system to reference ports by the assigned name instead of a port number. Named ports can also contain multiple ports. For example: [{name: “http”, port: 80},{name: “http”, port: 8080}] Named ports apply to all instances in this instance group.
Returns:Return True if successful.
Return type:bool
class libcloud.compute.drivers.gce.GCEInstanceGroupManager(id, name, zone, size, template, instance_group, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

GCE Instance Groups Manager class.

Handles ‘managed’ Instance Groups. For more information on Instance Groups, see: https://cloud.google.com/compute/docs/instance-groups

Parameters:
  • id (str) – Internal identifier of Instance Group. Display only.
  • name (str) – The name of this Instance Group.
  • zone – Zone in witch the Instance Group belongs
  • size (int) – Number of instances in this Instance Group.
  • template – An initialized :class:GCEInstanceTemplate
  • instance_group – An initialized :class:GCEInstanceGroup
  • driver (:class:GCENodeDriver) – An initialized :class:GCENodeDriver
  • extra (dict) – A dictionary of extra information.
delete_instances(node_list)[source]

Removes one or more instances from the specified instance group, and delete those instances.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:node_list (list of Node or list of GCENode) – List of nodes to delete.
Returns:Return True if successful.
Return type:bool
destroy()[source]

Destroy this Instance Group. Destroys all instances managed by the Instance Group.

Returns:True if successful
Return type:bool
list_managed_instances()[source]

Lists all of the instances in this managed instance group.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute * https://www.googleapis.com/auth/compute.readonly

Returns:list of dict containing instance URI and currentAction. See ex_instancegroupmanager_list_managed_instances for more details.
Return type:list
recreate_instances()[source]

Recreate instances in a Managed Instance Group.

Returns:list of dict containing instance URI and currentAction. See ex_instancegroupmanager_list_managed_instances for more details.
Return type:list
resize(size)[source]

Set the number of instances for this Instance Group. An increase in num_instances will result in VMs being created. A decrease will result in VMs being destroyed.

Parameters:size (int) – Number to instances to resize to.
Returns:True if successful
Return type:bool
set_autohealingpolicies(healthcheck, initialdelaysec)[source]

Sets the autohealing policies for the instance for the instance group controlled by this manager.

Parameters:
  • healthcheck (GCEHealthCheck) – Healthcheck to add
  • initialdelaysec (int) – The time to allow an instance to boot and applications to fully start before the first health check
Returns:

Return True if successful.

Return type:

bool

set_instancetemplate(instancetemplate)[source]

Set the Instance Template for this Instance Group.

Parameters:instancetemplate (GCEInstanceTemplate) – Instance Template to set.
Returns:True if successful
Return type:bool
set_named_ports(named_ports)[source]

Sets the named ports for the instance group controlled by this manager.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:named_ports (list of {‘name’: str, ‘port`: int}) – Assigns a name to a port number. For example: {name: “http”, port: 80} This allows the system to reference ports by the assigned name instead of a port number. Named ports can also contain multiple ports. For example: [{name: “http”, port: 80},{name: “http”, port: 8080}] Named ports apply to all instances in this instance group.
Returns:Return True if successful.
Return type:bool
class libcloud.compute.drivers.gce.GCEInstanceTemplate(id, name, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

Represents a machine configuration used in creating Instance Groups.

destroy()[source]

Destroy this InstanceTemplate.

Returns:Return True if successful.
Return type:bool
class libcloud.compute.drivers.gce.GCELicense(name, project, driver)[source]

Bases: libcloud.compute.base.UuidMixin, libcloud.common.base.LazyObject

A GCE License used to track software usage in GCE nodes.

destroy()[source]
class libcloud.compute.drivers.gce.GCEList(driver, list_fn, **kwargs)[source]

Bases: object

An Iterator that wraps list functions to provide additional features.

GCE enforces a limit on the number of objects returned by a list operation, so users with more than 500 objects of a particular type will need to use filter(), page() or both.

>>> l=GCEList(driver, driver.ex_list_urlmaps)
>>> for sublist in l.filter('name eq ...-map').page(1):
...   sublist
...
[<GCEUrlMap id="..." name="cli-map">]
[<GCEUrlMap id="..." name="web-map">]

One can create a GCEList manually, but it’s slightly easier to use the ex_list() method of GCENodeDriver.

Parameters:
  • driver (:class:GCENodeDriver) – An initialized :class:GCENodeDriver
  • list_fn (instancemethod) – A bound list method from GCENodeDriver.
filter(expression)[source]

Filter results of a list operation.

GCE supports server-side filtering of resources returned by a list operation. Syntax of the filter expression is fully described in the GCE API reference doc, but in brief it is:

FIELD_NAME COMPARISON_STRING LITERAL_STRING

where FIELD_NAME is the resource’s property name, COMPARISON_STRING is ‘eq’ or ‘ne’, and LITERAL_STRING is a regular expression in RE2 syntax.

>>> for sublist in l.filter('name eq ...-map'):
...   sublist
...
[<GCEUrlMap id="..." name="cli-map">,                 <GCEUrlMap id="..." name="web-map">]

API reference: https://cloud.google.com/compute/docs/reference/latest/ RE2 syntax: https://github.com/google/re2/blob/master/doc/syntax.txt

Parameters:expression (str) – Filter expression described above.
Returns:This GCEList instance
Return type:GCEList
page(max_results=500)[source]

Limit the number of results by each iteration.

This implements the paging functionality of the GCE list methods and returns this GCEList instance so that results can be chained:

>>> for sublist in GCEList(driver, driver.ex_list_urlmaps).page(2):
...   sublist
...
[<GCEUrlMap id="..." name="cli-map">,                 <GCEUrlMap id="..." name="lc-map">]
[<GCEUrlMap id="..." name="web-map">]
Parameters:max_results (int) – Maximum number of results to return per iteration. Defaults to the GCE default of 500.
Returns:This GCEList instance
Return type:GCEList
class libcloud.compute.drivers.gce.GCENetwork(id, name, cidr, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE Network object class.

destroy()[source]

Destroy this network

Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCENodeDriver(user_id, key=None, datacenter=None, project=None, auth_type=None, scopes=None, credential_file=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

GCE Node Driver class.

This is the primary driver for interacting with Google Compute Engine. It contains all of the standard libcloud methods, plus additional ex_* methods for more features.

Note that many methods allow either objects or strings (or lists of objects/strings). In most cases, passing strings instead of objects will result in additional GCE API calls.

Parameters:
  • user_id (str) – The email address (for service accounts) or Client ID (for installed apps) to be used for authentication.
  • key (str) – The RSA Key (for service accounts) or file path containing key or Client Secret (for installed apps) to be used for authentication.
  • datacenter (str) – The name of the datacenter (zone) used for operations.
  • project (str) – Your GCE project name. (required)
  • auth_type (str) – Accepted values are “SA” or “IA” or “GCE” (“Service Account” or “Installed Application” or “GCE” if libcloud is being used on a GCE instance with service account enabled). If not supplied, auth_type will be guessed based on value of user_id or if the code is being executed in a GCE instance.
  • scopes (list) – List of authorization URLs. Default is empty and grants read/write to Compute, Storage, DNS.
  • credential_file (str) – Path to file for caching authentication information used by GCEConnection.
AUTH_URL = 'https://www.googleapis.com/auth/'
BACKEND_SERVICE_PROTOCOLS = ['HTTP', 'HTTPS', 'HTTP2', 'TCP', 'SSL']
IMAGE_PROJECTS = {'centos-cloud': ['centos-6', 'centos-7', 'centos-8'], 'coreos-cloud': ['coreos-alpha', 'coreos-beta', 'coreos-stable'], 'cos-cloud': ['cos-beta', 'cos-dev', 'cos-stable'], 'debian-cloud': ['debian-8', 'debian-9', 'debian-10'], 'opensuse-cloud': ['opensuse-leap'], 'rhel-cloud': ['rhel-6', 'rhel-7', 'rhel-8'], 'suse-byos-cloud': ['sles-11-byos', 'sles-12-byos', 'sles-12-sp2-sap-byos', 'sles-12-sp3-sap-byos', 'suse-manager-proxy-byos', 'suse-manager-server-byos'], 'suse-cloud': ['sles-11', 'sles-12', 'sles-15'], 'suse-sap-cloud': ['sles-12-sp2-sap', 'sles-12-sp3-sap', 'sles-12-sp4-sap', 'sles-15-sap'], 'ubuntu-os-cloud': ['ubuntu-1404-lts', 'ubuntu-1604-lts', 'ubuntu-minimal-1604-lts', 'ubuntu-1710', 'ubuntu-1804-lts', 'ubuntu-minimal-1804-lts', 'ubuntu-1810', 'ubuntu-minimal-1810', 'ubuntu-1904', 'ubuntu-minimal-1904', 'ubuntu-1910', 'ubuntu-minimal-1910', 'ubuntu-2004-lts', 'ubuntu-minimal-2004-lts'], 'windows-cloud': ['windows-1709-core-for-containers', 'windows-1709-core', 'windows-2008-r2', 'windows-2012-r2-core', 'windows-2012-r2', 'windows-2016-core', 'windows-2016'], 'windows-sql-cloud': ['sql-ent-2012-win-2012-r2', 'sql-std-2012-win-2012-r2', 'sql-web-2012-win-2012-r2', 'sql-ent-2014-win-2012-r2', 'sql-ent-2014-win-2016', 'sql-std-2014-win-2012-r2', 'sql-web-2014-win-2012-r2', 'sql-ent-2016-win-2012-r2', 'sql-ent-2016-win-2016', 'sql-std-2016-win-2012-r2', 'sql-std-2016-win-2016', 'sql-web-2016-win-2012-r2', 'sql-web-2016-win-2016', 'sql-ent-2017-win-2016', 'sql-exp-2017-win-2012-r2', 'sql-exp-2017-win-2016', 'sql-std-2017-win-2016', 'sql-web-2017-win-2016']}
KIND_METHOD_MAP = {'compute#address': <function GCENodeDriver._to_address>, 'compute#backendService': <function GCENodeDriver._to_backendservice>, 'compute#disk': <function GCENodeDriver._to_storage_volume>, 'compute#firewall': <function GCENodeDriver._to_firewall>, 'compute#forwardingRule': <function GCENodeDriver._to_forwarding_rule>, 'compute#httpHealthCheck': <function GCENodeDriver._to_healthcheck>, 'compute#image': <function GCENodeDriver._to_node_image>, 'compute#instance': <function GCENodeDriver._to_node>, 'compute#machineType': <function GCENodeDriver._to_node_size>, 'compute#network': <function GCENodeDriver._to_network>, 'compute#project': <function GCENodeDriver._to_project>, 'compute#region': <function GCENodeDriver._to_region>, 'compute#snapshot': <function GCENodeDriver._to_snapshot>, 'compute#sslCertificate': <function GCENodeDriver._to_sslcertificate>, 'compute#targetHttpProxy': <function GCENodeDriver._to_targethttpproxy>, 'compute#targetHttpsProxy': <function GCENodeDriver._to_targethttpsproxy>, 'compute#targetInstance': <function GCENodeDriver._to_targetinstance>, 'compute#targetPool': <function GCENodeDriver._to_targetpool>, 'compute#urlMap': <function GCENodeDriver._to_urlmap>, 'compute#zone': <function GCENodeDriver._to_zone>}
NODE_STATE_MAP = {'PROVISIONING': pending, 'RUNNING': running, 'STAGING': pending, 'STOPPING': pending, 'SUSPENDED': suspended, 'TERMINATED': stopped, 'UNKNOWN': unknown}
SA_SCOPES_MAP = {'bigquery': 'bigquery', 'cloud-platform': 'cloud-platform', 'compute-ro': 'compute.readonly', 'compute-rw': 'compute', 'datastore': 'datastore', 'logging-write': 'logging.write', 'monitoring': 'monitoring', 'monitoring-write': 'monitoring.write', 'service-control': 'servicecontrol', 'service-management': 'service.management', 'sql': 'sqlservice', 'sql-admin': 'sqlservice.admin', 'storage-full': 'devstorage.full_control', 'storage-ro': 'devstorage.read_only', 'storage-rw': 'devstorage.read_write', 'taskqueue': 'taskqueue', 'useraccounts-ro': 'cloud.useraccounts.readonly', 'useraccounts-rw': 'cloud.useraccounts', 'userinfo-email': 'userinfo.email'}
api_name = 'google'
attach_volume(node, volume, device=None, ex_mode=None, ex_boot=False, ex_type=None, ex_source=None, ex_auto_delete=None, ex_initialize_params=None, ex_licenses=None, ex_interface=None)[source]

Attach a volume to a node.

If volume is None, an ex_source URL must be provided.

Parameters:
  • node (Node or None) – The node to attach the volume to
  • volume (StorageVolume or None) – The volume to attach.
  • device (str) – The device name to attach the volume as. Defaults to volume name.
  • ex_mode (str) – Either ‘READ_WRITE’ or ‘READ_ONLY’
  • ex_boot (bool) – If true, disk will be attached as a boot disk
  • ex_type (str) – Specify either ‘PERSISTENT’ (default) or ‘SCRATCH’.
  • ex_source (str or None) – URL (full or partial) of disk source. Must be present if not using an existing StorageVolume.
  • ex_auto_delete (bool or None) – If set, the disk will be auto-deleted if the parent node/instance is deleted.
  • ex_initialize_params (dict or None) – Allow user to pass in full JSON struct of initializeParams as documented in GCE’s API.
  • ex_licenses (list of str) – List of strings representing licenses associated with the volume/disk.
  • ex_interface (str or None) – User can specify either ‘SCSI’ (default) or ‘NVME’.
Returns:

True if successful

Return type:

bool

connectionCls

alias of GCEConnection

create_node(name, size, image, location=None, ex_network='default', ex_subnetwork=None, ex_tags=None, ex_metadata=None, ex_boot_disk=None, use_existing_disk=True, external_ip='ephemeral', internal_ip=None, ex_disk_type='pd-standard', ex_disk_auto_delete=True, ex_service_accounts=None, description=None, ex_can_ip_forward=None, ex_disks_gce_struct=None, ex_nic_gce_struct=None, ex_on_host_maintenance=None, ex_automatic_restart=None, ex_preemptible=None, ex_image_family=None, ex_labels=None, ex_accelerator_type=None, ex_accelerator_count=None, ex_disk_size=None)[source]

Create a new node and return a node object for the node.

Parameters:
  • name (str) – The name of the node to create.
  • size (str or GCENodeSize) – The machine type to use.
  • image (str or GCENodeImage or None) – The image to use to create the node (or, if attaching a persistent disk, the image used to create the disk)
  • location (str or NodeLocation or GCEZone or None) – The location (zone) to create the node in.
  • ex_network (str or GCENetwork) – The network to associate with the node.
  • ex_subnetwork (str or GCESubnetwork) – The subnetwork to associate with the node.
  • ex_tags (list of str or None) – A list of tags to associate with the node.
  • ex_metadata (dict or None) – Metadata dictionary for instance.
  • ex_boot_disk (StorageVolume or str or None) – The boot disk to attach to the instance.
  • use_existing_disk (bool) – If True and if an existing disk with the same name/location is found, use that disk instead of creating a new one.
  • external_ip (GCEAddress or str or None) – The external IP address to use. If ‘ephemeral’ (default), a new non-static address will be used. If ‘None’, then no external address will be used. To use an existing static IP address, a GCEAddress object should be passed in.
  • internal_ip (GCEAddress or str or None) – The private IP address to use.
  • ex_disk_type (str or GCEDiskType) – Specify a pd-standard (default) disk or pd-ssd for an SSD disk.
  • ex_disk_auto_delete (bool) – Indicate that the boot disk should be deleted when the Node is deleted. Set to True by default.
  • ex_service_accounts (list) – Specify a list of serviceAccounts when creating the instance. The format is a list of dictionaries containing email and list of scopes, e.g. [{‘email’:’default’, ‘scopes’:[‘compute’, …]}, …] Scopes can either be full URLs or short names. If not provided, use the ‘default’ service account email and a scope of ‘devstorage.read_only’. Also accepts the aliases defined in ‘gcloud compute’.
  • description (str or None) – The description of the node (instance).
  • ex_can_ip_forward (bool or None) – Set to True to allow this node to send/receive non-matching src/dst packets.
  • ex_disks_gce_struct (list or None) – Support for passing in the GCE-specific formatted disks[] structure. No attempt is made to ensure proper formatting of the disks[] structure. Using this structure obviates the need of using other disk params like ‘ex_boot_disk’, etc. See the GCE docs for specific details.
  • ex_nic_gce_struct (list or None) – Support passing in the GCE-specific formatted networkInterfaces[] structure. No attempt is made to ensure proper formatting of the networkInterfaces[] data. Using this structure obviates the need of using ‘external_ip’ and ‘ex_network’. See the GCE docs for details.
  • ex_on_host_maintenance (str or None) – Defines whether node should be terminated or migrated when host machine goes down. Acceptable values are: ‘MIGRATE’ or ‘TERMINATE’ (If not supplied, value will be reset to GCE default value for the instance type.)
  • ex_automatic_restart (bool or None) – Defines whether the instance should be automatically restarted when it is terminated by Compute Engine. (If not supplied, value will be set to the GCE default value for the instance type.)
  • ex_preemptible (bool or None) – Defines whether the instance is preemptible. (If not supplied, the instance will not be preemptible)
  • ex_image_family (str or None) – Determine image from an ‘Image Family’ instead of by name. ‘image’ should be None to use this keyword.
  • ex_labels (dict or None) – Labels dictionary for instance.
  • ex_accelerator_type (str or None) – Defines the accelerator to use with this node. Must set ‘ex_on_host_maintenance’ to ‘TERMINATE’. Must include a count of accelerators to use in ‘ex_accelerator_count’.
  • ex_accelerator_count (int or None) – The number of ‘ex_accelerator_type’ accelerators to attach to the node.
  • ex_disk_size (int or None) – Defines size of the boot disk. Integer in gigabytes.
Returns:

A Node object for the new node.

Return type:

Node

create_volume(size, name, location=None, snapshot=None, image=None, use_existing=True, ex_disk_type='pd-standard', ex_image_family=None)[source]

Create a volume (disk).

Parameters:
  • size (int or str or None) – Size of volume to create (in GB). Can be None if image or snapshot is supplied.
  • name (str) – Name of volume to create
  • location (str or GCEZone or NodeLocation or None) – Location (zone) to create the volume in
  • snapshot (GCESnapshot or str or None) – Snapshot to create image from
  • image (GCENodeImage or str or None) – Image to create disk from.
  • use_existing (bool) – If True and a disk with the given name already exists, return an object for that disk instead of attempting to create a new disk.
  • ex_disk_type (str or GCEDiskType) – Specify a pd-standard (default) disk or pd-ssd for an SSD disk.
  • ex_image_family (str or None) – Determine image from an ‘Image Family’ instead of by name. ‘image’ should be None to use this keyword.
Returns:

Storage Volume object

Return type:

StorageVolume

create_volume_snapshot(volume, name)[source]

Create a snapshot of the provided Volume.

Parameters:volume (StorageVolume) – A StorageVolume object
Returns:A GCE Snapshot object
Return type:GCESnapshot
destroy_node(node, destroy_boot_disk=False, ex_sync=True)[source]

Destroy a node.

Parameters:
  • node (Node) – Node object to destroy
  • destroy_boot_disk (bool) – If true, also destroy the node’s boot disk. (Note that this keyword is not accessible from the node’s .destroy() method.)
  • ex_sync (bool) – If true, do not return until destroyed or timeout
Returns:

True if successful

Return type:

bool

destroy_volume(volume)[source]

Destroy a volume.

Parameters:volume (StorageVolume) – Volume object to destroy
Returns:True if successful
Return type:bool
destroy_volume_snapshot(snapshot)[source]

Destroy a snapshot.

Parameters:snapshot (GCESnapshot) – Snapshot object to destroy
Returns:True if successful
Return type:bool
detach_volume(volume, ex_node=None)[source]

Detach a volume from a node.

Parameters:
  • volume (StorageVolume) – Volume object to detach
  • ex_node (Node) – Node object to detach volume from (required)
Returns:

True if successful

Return type:

bool

ex_add_access_config(node, name, nic, nat_ip=None, config_type=None)[source]

Add a network interface access configuration to a node.

Parameters:
  • node (str) – The existing target Node (instance) that will receive the new access config.
  • name – Name of the new access config.
  • nat_ip (str or None) – The external existing static IP Address to use for the access config. If not provided, an ephemeral IP address will be allocated.
  • config_type (str or None) – The type of access config to create. Currently the only supported type is ‘ONE_TO_ONE_NAT’.
Returns:

True if successful

Return type:

bool

ex_copy_image(name, url, description=None, family=None, guest_os_features=None)[source]

Copy an image to your image collection.

Parameters:
  • name (str) – The name of the image
  • url (str) – The URL to the image. The URL can start with gs://
  • description (str) – The description of the image
  • family (str) – The family of the image
  • guest_os_features (list of str or None) – The features of the guest operating system.
Returns:

NodeImage object based on provided information or None if an image with that name is not found.

Return type:

NodeImage or None

ex_create_address(name, region=None, address=None, description=None, address_type='EXTERNAL', subnetwork=None)[source]

Create a static address in a region, or a global address.

Parameters:
  • name (str) – Name of static address
  • region (str or GCERegion) – Name of region for the address (e.g. ‘us-central1’) Use ‘global’ to create a global address.
  • address (str or None) – Ephemeral IP address to promote to a static one (e.g. ‘xxx.xxx.xxx.xxx’)
  • description (str) – Optional descriptive comment.
  • address_type – Optional The type of address to reserve, either INTERNAL or EXTERNAL. If unspecified, defaults to EXTERNAL.
  • subnetwork – Optional The URL of the subnetwork in which to reserve the address. If an IP address is specified, it must be within the subnetwork’s IP range. This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes.
Returns:

Static Address object

Return type:

GCEAddress

ex_create_autoscaler(name, zone, instance_group, policy, description=None)[source]

Create an Autoscaler for an Instance Group.

Parameters:
  • name (str) – The name of the Autoscaler
  • zone (str or GCEZone) – The zone to which the Instance Group belongs
  • instance_group – An Instance Group Manager object.
  • policy – A dict containing policy configuration. See the API documentation for Autoscalers for more details.
Type:

GCEInstanceGroupManager

Type:

dict

Returns:

An Autoscaler object.

Return type:

GCEAutoscaler

ex_create_backend(instance_group, balancing_mode='UTILIZATION', max_utilization=None, max_rate=None, max_rate_per_instance=None, capacity_scaler=1, description=None)[source]

Helper Object to create a backend.

Parameters:
  • instance_group – The Instance Group for this Backend.
  • balancing_mode (str) – Specifies the balancing mode for this backend. For global HTTP(S) load balancing, the valid values are UTILIZATION (default) and RATE. For global SSL load balancing, the valid values are UTILIZATION (default) and CONNECTION.
  • max_utilization (float) – Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization target for the group. The default is 0.8. Valid range is [0.0, 1.0].
  • max_rate (int) – The max requests per second (RPS) of the group. Can be used with either RATE or UTILIZATION balancing modes, but required if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must be set.
  • max_rate_per_instance (float) – The max requests per second (RPS) that a single backend instance can handle. This is used to calculate the capacity of the group. Can be used in either balancing mode. For RATE mode, either maxRate or maxRatePerInstance must be set.
  • capacity_scaler (float) – A multiplier applied to the group’s maximum servicing capacity (based on UTILIZATION, RATE, or CONNECTION). Default value is 1, which means the group will serve up to 100% of its configured capacity (depending on balancingMode). A setting of 0 means the group is completely drained, offering 0% of its available capacity. Valid range is [0.0,1.0].
  • description (str) – An optional description of this resource. Provide this property when you create the resource.
Returns:

A GCEBackend object.

Return type:

class:GCEBackend

ex_create_backendservice(name, healthchecks, backends=[], protocol=None, description=None, timeout_sec=None, enable_cdn=False, port=None, port_name=None)[source]

Create a global Backend Service.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • name (str) – Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
  • healthchecks (list of (str or GCEHealthCheck)) – A list of HTTP Health Checks to use for this service. There must be at least one.
  • backends (list of :class GCEBackend or list of dict) – The list of backends that serve this BackendService.
  • timeout_sec (integer) – How many seconds to wait for the backend before considering it a failed request. Default is 30 seconds.
  • enable_cdn (bool) – If true, enable Cloud CDN for this BackendService. When the load balancing scheme is INTERNAL, this field is not used.
  • port (integer) – Deprecated in favor of port_name. The TCP port to connect on the backend. The default value is 80. This cannot be used for internal load balancing.
  • port_name (str) – Name of backend port. The same name should appear in the instance groups referenced by this service.
  • protocol (str) – The protocol this Backend Service uses to communicate with backends. Possible values are HTTP, HTTPS, HTTP2, TCP and SSL.
Returns:

A Backend Service object.

Return type:

GCEBackendService

ex_create_firewall(name, allowed=None, denied=None, network='default', target_ranges=None, direction='INGRESS', priority=1000, source_service_accounts=None, target_service_accounts=None, source_ranges=None, source_tags=None, target_tags=None, description=None)[source]

Create a firewall rule on a network. Rules can be for Ingress or Egress, and they may Allow or Deny traffic. They are also applied in order based on action (Deny, Allow) and Priority. Rules can be applied using various Source and Target filters.

Firewall rules should be supplied in the “allowed” or “denied” field. This is a list of dictionaries formatted like so (“ports” is optional):

[{“IPProtocol”: “<protocol string or number>”,
“ports”: “<port_numbers or ranges>”}]

For example, to allow tcp on port 8080 and udp on all ports, ‘allowed’ would be:

[{"IPProtocol": "tcp",
  "ports": ["8080"]},
 {"IPProtocol": "udp"}]

Note that valid inputs vary by direction (INGRESS vs EGRESS), action (allow/deny), and source/target filters (tag vs range etc).

See Firewall Reference for more information.

Parameters:
  • name (str) – Name of the firewall to be created
  • description (str) – Optional description of the rule.
  • direction (str) – Direction of the FW rule - “INGRESS” or “EGRESS” Defaults to ‘INGRESS’.
  • priority (int) – Priority integer of the rule - lower is applied first. Defaults to 1000
  • allowed (list of dict) – List of dictionaries with rules for type INGRESS
  • denied (list of dict) – List of dictionaries with rules for type EGRESS
  • network (str or GCENetwork) – The network that the firewall applies to.
  • source_ranges (list of str) – A list of IP ranges in CIDR format that the firewall should apply to. Defaults to [‘0.0.0.0/0’]
  • source_service_accounts (list of str) – A list of source service accounts the rules apply to.
  • source_tags (list of str) – A list of source instance tags the rules apply to.
  • target_tags (list of str) – A list of target instance tags the rules apply to.
  • target_service_accounts (list of str) – A list of target service accounts the rules apply to.
  • target_ranges (list of str) – A list of IP ranges in CIDR format that the EGRESS type rule should apply to. Defaults to [‘0.0.0.0/0’]
Returns:

Firewall object

Return type:

GCEFirewall

ex_create_forwarding_rule(name, target=None, region=None, protocol='tcp', port_range=None, address=None, description=None, global_rule=False, targetpool=None, lb_scheme=None)[source]

Create a forwarding rule.

Parameters:
  • name (str) – Name of forwarding rule to be created
  • target (str or GCETargetHttpProxy or GCETargetInstance or GCETargetPool) – The target of this forwarding rule. For global forwarding rules this must be a global TargetHttpProxy. For regional rules this may be either a TargetPool or TargetInstance. If passed a string instead of the object, it will be the name of a TargetHttpProxy for global rules or a TargetPool for regional rules. A TargetInstance must be passed by object. (required)
  • region (str or GCERegion) – Region to create the forwarding rule in. Defaults to self.region. Ignored if global_rule is True.
  • protocol (str) – Should be ‘tcp’ or ‘udp’
  • port_range (str) – Single port number or range separated by a dash. Examples: ‘80’, ‘5000-5999’. Required for global forwarding rules, optional for regional rules.
  • address (str or GCEAddress) – Optional static address for forwarding rule. Must be in same region.
  • description (str or None) – The description of the forwarding rule. Defaults to None.
  • targetpool (str or GCETargetPool) – Deprecated parameter for backwards compatibility. Use target instead.
  • lb_scheme (str or None) – Load balancing scheme, can be ‘EXTERNAL’ or ‘INTERNAL’. Defaults to ‘EXTERNAL’.
Returns:

Forwarding Rule object

Return type:

GCEForwardingRule

ex_create_healthcheck(name, host=None, path=None, port=None, interval=None, timeout=None, unhealthy_threshold=None, healthy_threshold=None, description=None)[source]

Create an Http Health Check.

Parameters:
  • name (str) – Name of health check
  • host (str) – Hostname of health check request. Defaults to empty and public IP is used instead.
  • path (str) – The request path for the check. Defaults to /.
  • port (int) – The TCP port number for the check. Defaults to 80.
  • interval (int) – How often (in seconds) to check. Defaults to 5.
  • timeout (int) – How long to wait before failing. Defaults to 5.
  • unhealthy_threshold (int) – How many failures before marking unhealthy. Defaults to 2.
  • healthy_threshold (int) – How many successes before marking as healthy. Defaults to 2.
  • description (str or None) – The description of the check. Defaults to None.
Returns:

Health Check object

Return type:

GCEHealthCheck

ex_create_image(name, volume, description=None, family=None, guest_os_features=None, use_existing=True, wait_for_completion=True, ex_licenses=None, ex_labels=None)[source]

Create an image from the provided volume.

Parameters:
  • name (str) – The name of the image to create.
  • volume (str or StorageVolume) – The volume to use to create the image, or the Google Cloud Storage URI
  • description (str) – Description of the new Image
  • family (str) – The name of the image family to which this image belongs. If you create resources by specifying an image family instead of a specific image name, the resource uses the latest non-deprecated image that is set with that family name.
  • guest_os_features (list of str or None) – Features of the guest operating system, valid for bootable images only.
  • ex_licenses (list of str) – List of strings representing licenses to be associated with the image.
  • ex_labels (dict or None) – Labels dictionary for image.
  • use_existing (bool) – If True and an image with the given name already exists, return an object for that image instead of attempting to create a new image.
  • wait_for_completion (bool) – If True, wait until the new image is created before returning a new NodeImage Otherwise, return a new NodeImage instance, and let the user track the creation progress
Returns:

A GCENodeImage object for the new image

Return type:

GCENodeImage

ex_create_instancegroup(name, zone, description=None, network=None, subnetwork=None, named_ports=None)[source]

Creates an instance group in the specified project using the parameters that are included in the request.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • name (str) – Required. The name of the instance group. The name must be 1-63 characters long, and comply with RFC1035.
  • zone (GCEZone) – The URL of the zone where the instance group is located.
  • description (str) – An optional description of this resource. Provide this property when you create the resource.
  • network (GCENetwork) – The URL of the network to which all instances in the instance group belong.
  • subnetwork (GCESubnetwork) – The URL of the subnetwork to which all instances in the instance group belong.
  • named_ports (list of {‘name’: str, ‘port`: int}) – Assigns a name to a port number. For example: {name: “http”, port: 80} This allows the system to reference ports by the assigned name instead of a port number. Named ports can also contain multiple ports. For example: [{name: “http”, port: 80},{name: “http”, port: 8080}] Named ports apply to all instances in this instance group.
Returns:

GCEInstanceGroup object.

Return type:

GCEInstanceGroup

ex_create_instancegroupmanager(name, zone, template, size, base_instance_name=None, description=None)[source]

Create a Managed Instance Group.

Parameters:
  • name (str) – Name of the Instance Group.
  • zone (str or GCEZone or None) – The zone to which the Instance Group belongs
  • template (str or GCEInstanceTemplate) – The Instance Template. Should be an instance of GCEInstanceTemplate or a string.
  • base_instance_name (str) – The prefix for each instance created. If None, Instance Group name will be used.
  • description (str) – User-supplied text about the Instance Group.
Returns:

An Instance Group Manager object.

Return type:

GCEInstanceGroupManager

ex_create_instancetemplate(name, size, source=None, image=None, disk_type='pd-standard', disk_auto_delete=True, network='default', subnetwork=None, can_ip_forward=None, external_ip='ephemeral', internal_ip=None, service_accounts=None, on_host_maintenance=None, automatic_restart=None, preemptible=None, tags=None, metadata=None, description=None, disks_gce_struct=None, nic_gce_struct=None)[source]

Creates an instance template in the specified project using the data that is included in the request. If you are creating a new template to update an existing instance group, your new instance template must use the same network or, if applicable, the same subnetwork as the original template.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • name (str) – The name of the node to create.
  • size (str or GCENodeSize) – The machine type to use.
  • image (str or GCENodeImage or None) – The image to use to create the node (or, if attaching a persistent disk, the image used to create the disk)
  • network (str or GCENetwork) – The network to associate with the template.
  • subnetwork (str or GCESubnetwork) – The subnetwork to associate with the node.
  • tags (list of str or None) – A list of tags to associate with the node.
  • metadata (dict or None) – Metadata dictionary for instance.
  • external_ip (GCEAddress or str or None) – The external IP address to use. If ‘ephemeral’ (default), a new non-static address will be used. If ‘None’, then no external address will be used. To use an existing static IP address, a GCEAddress object should be passed in.
  • internal_ip (GCEAddress or str or None) – The private IP address to use.
  • disk_type (str or GCEDiskType) – Specify a pd-standard (default) disk or pd-ssd for an SSD disk.
  • disk_auto_delete (bool) – Indicate that the boot disk should be deleted when the Node is deleted. Set to True by default.
  • service_accounts (list) – Specify a list of serviceAccounts when creating the instance. The format is a list of dictionaries containing email and list of scopes, e.g. [{‘email’:’default’, ‘scopes’:[‘compute’, …]}, …] Scopes can either be full URLs or short names. If not provided, use the ‘default’ service account email and a scope of ‘devstorage.read_only’. Also accepts the aliases defined in ‘gcloud compute’.
  • description (str or None) – The description of the node (instance).
  • can_ip_forward (bool or None) – Set to True to allow this node to send/receive non-matching src/dst packets.
  • disks_gce_struct (list or None) – Support for passing in the GCE-specific formatted disks[] structure. No attempt is made to ensure proper formatting of the disks[] structure. Using this structure obviates the need of using other disk params like ‘ex_boot_disk’, etc. See the GCE docs for specific details.
  • nic_gce_struct (list or None) – Support passing in the GCE-specific formatted networkInterfaces[] structure. No attempt is made to ensure proper formatting of the networkInterfaces[] data. Using this structure obviates the need of using ‘external_ip’ and ‘ex_network’. See the GCE docs for details.
  • on_host_maintenance – Defines whether node should be terminated or migrated when host machine goes down. Acceptable values are: ‘MIGRATE’ or ‘TERMINATE’ (If not supplied, value will be reset to GCE default value for the instance type.)
  • automatic_restart (bool or None) – Defines whether the instance should be automatically restarted when it is terminated by Compute Engine. (If not supplied, value will be set to the GCE default value for the instance type.)
  • preemptible (bool or None) – Defines whether the instance is preemptible. (If not supplied, the instance will not be preemptible)
Returns:

An Instance Template object.

Return type:

GCEInstanceTemplate

ex_create_multiple_nodes(base_name, size, image, number, location=None, ex_network='default', ex_subnetwork=None, ex_tags=None, ex_metadata=None, ignore_errors=True, use_existing_disk=True, poll_interval=2, external_ip='ephemeral', internal_ip=None, ex_disk_type='pd-standard', ex_disk_auto_delete=True, ex_service_accounts=None, timeout=180, description=None, ex_can_ip_forward=None, ex_disks_gce_struct=None, ex_nic_gce_struct=None, ex_on_host_maintenance=None, ex_automatic_restart=None, ex_image_family=None, ex_preemptible=None, ex_labels=None, ex_disk_size=None)[source]

Create multiple nodes and return a list of Node objects.

Nodes will be named with the base name and a number. For example, if the base name is ‘libcloud’ and you create 3 nodes, they will be named:

libcloud-000
libcloud-001
libcloud-002
Parameters:
  • base_name (str) – The base name of the nodes to create.
  • size (str or GCENodeSize) – The machine type to use.
  • image (str or GCENodeImage) – The image to use to create the nodes.
  • number (int) – The number of nodes to create.
  • location (str or NodeLocation or GCEZone or None) – The location (zone) to create the nodes in.
  • ex_network (str or GCENetwork) – The network to associate with the nodes.
  • ex_tags (list of str or None) – A list of tags to associate with the nodes.
  • ex_metadata (dict or None) – Metadata dictionary for instances.
  • ignore_errors (bool) – If True, don’t raise Exceptions if one or more nodes fails.
  • use_existing_disk (bool) – If True and if an existing disk with the same name/location is found, use that disk instead of creating a new one.
  • poll_interval (int) – Number of seconds between status checks.
  • external_ip (str or None) – The external IP address to use. If ‘ephemeral’ (default), a new non-static address will be used. If ‘None’, then no external address will be used. (Static addresses are not supported for multiple node creation.)
  • internal_ip (GCEAddress or str or None) – The private IP address to use.
  • ex_disk_type (str or GCEDiskType) – Specify a pd-standard (default) disk or pd-ssd for an SSD disk.
  • ex_disk_auto_delete (bool) – Indicate that the boot disk should be deleted when the Node is deleted. Set to True by default.
  • ex_service_accounts (list) – Specify a list of serviceAccounts when creating the instance. The format is a list of dictionaries containing email and list of scopes, e.g. [{‘email’:’default’, ‘scopes’:[‘compute’, …]}, …] Scopes can either be full URLs or short names. If not provided, use the ‘default’ service account email and a scope of ‘devstorage.read_only’. Also accepts the aliases defined in ‘gcloud compute’.
  • timeout (int) – The number of seconds to wait for all nodes to be created before timing out.
  • description (str or None) – The description of the node (instance).
  • ex_can_ip_forward (bool or None) – Set to True to allow this node to send/receive non-matching src/dst packets.
  • ex_preemptible (bool or None) – Defines whether the instance is preemptible. (If not supplied, the instance will not be preemptible)
  • ex_disks_gce_struct (list or None) – Support for passing in the GCE-specific formatted disks[] structure. No attempt is made to ensure proper formatting of the disks[] structure. Using this structure obviates the need of using other disk params like ‘ex_boot_disk’, etc. See the GCE docs for specific details.
  • ex_nic_gce_struct (list or None) – Support passing in the GCE-specific formatted networkInterfaces[] structure. No attempt is made to ensure proper formatting of the networkInterfaces[] data. Using this structure obviates the need of using ‘external_ip’ and ‘ex_network’. See the GCE docs for details.
  • ex_on_host_maintenance (str or None) – Defines whether node should be terminated or migrated when host machine goes down. Acceptable values are: ‘MIGRATE’ or ‘TERMINATE’ (If not supplied, value will be reset to GCE default value for the instance type.)
  • ex_automatic_restart (bool or None) – Defines whether the instance should be automatically restarted when it is terminated by Compute Engine. (If not supplied, value will be set to the GCE default value for the instance type.)
  • ex_image_family (str or None) – Determine image from an ‘Image Family’ instead of by name. ‘image’ should be None to use this keyword.
  • ex_labels (dict) – Label dict for node.
  • ex_disk_size (int or None) – Defines size of the boot disk. Integer in gigabytes.
Returns:

A list of Node objects for the new nodes.

Return type:

list of Node

ex_create_network(name, cidr, description=None, mode='legacy', routing_mode=None)[source]

Create a network. In November 2015, Google introduced Subnetworks and suggests using networks with ‘auto’ generated subnetworks. See, the subnet docs for more details. Note that libcloud follows the usability pattern from the Cloud SDK (e.g. ‘gcloud compute’ command-line utility) and uses ‘mode’ to specify ‘auto’, ‘custom’, or ‘legacy’.

Parameters:
  • name (str) – Name of network to be created
  • cidr (str or None) – Address range of network in CIDR format.
  • description (str or None) – Custom description for the network.
  • mode (str) – Create a ‘auto’, ‘custom’, or ‘legacy’ network.
  • routing_mode (str or None) – Create network with ‘Global’ or ‘Regional’ routing mode for BGP advertisements. Defaults to ‘Regional’
Returns:

Network object

Return type:

GCENetwork

ex_create_route(name, dest_range, priority=500, network='default', tags=None, next_hop=None, description=None)[source]

Create a route.

Parameters:
  • name (str) – Name of route to be created
  • dest_range (str) – Address range of route in CIDR format.
  • priority (int) – Priority value, lower values take precedence
  • network (str or GCENetwork) – The network the route belongs to. Can be either the full URL of the network, the name of the network or a libcloud object.
  • tags (list of str or None) – List of instance-tags for routing, empty for all nodes
  • next_hop (str, Node, or None) – Next traffic hop. Use None for the default Internet gateway, or specify an instance or IP address.
  • description (str or None) – Custom description for the route.
Returns:

Route object

Return type:

GCERoute

ex_create_sslcertificate(name, certificate=None, private_key=None, description=None)[source]

Creates a SslCertificate resource in the specified project using the data included in the request.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • name (str) – Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
  • certificate (str) – A string containing local certificate file in PEM format. The certificate chain must be no greater than 5 certs long. The chain must include at least one intermediate cert.
  • private_key (str) – A string containing a write-only private key in PEM format. Only insert RPCs will include this field.
  • description (str) – An optional description of this resource. Provide this property when you create the resource.
Returns:

GCESslCertificate object.

Return type:

GCESslCertificate

ex_create_subnetwork(name, cidr=None, network=None, region=None, description=None, privateipgoogleaccess=None, secondaryipranges=None)[source]

Create a subnetwork.

Parameters:
  • name (str) – Name of subnetwork to be created
  • cidr (str) – Address range of network in CIDR format.
  • network (str or GCENetwork) – The network name or object this subnet belongs to.
  • region (str or GCERegion) – The region the subnetwork belongs to.
  • description (str or None) – Custom description for the network.
  • privateipgoogleaccess (bool` or ``None) – Allow access to Google services without assigned external IP addresses.
  • secondaryipranges (list of dict or None) – List of dicts of secondary or “alias” IP ranges for this subnetwork in [{“rangeName”: “second1”, “ipCidrRange”: “192.168.168.0/24”}, {k:v, k:v}] format.
Returns:

Subnetwork object

Return type:

GCESubnetwork

ex_create_targethttpproxy(name, urlmap)[source]

Create a target HTTP proxy.

Parameters:
  • name (str) – Name of target HTTP proxy
  • urlmap – URL map defining the mapping from URl to the backendservice.
Returns:

Target Pool object

Return type:

GCETargetPool

ex_create_targethttpsproxy(name, urlmap, sslcertificates, description=None)[source]

Creates a TargetHttpsProxy resource in the specified project using the data included in the request.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • name (str) – Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
  • sslcertificates (list of GCESslcertificates) – URLs to SslCertificate resources that are used to authenticate connections between users and the load balancer. Currently, exactly one SSL certificate must be specified.
  • urlmap (GCEUrlMap) – A fully-qualified or valid partial URL to the UrlMap resource that defines the mapping from URL to the BackendService.
  • description (str) – An optional description of this resource. Provide this property when you create the resource.
Returns:

GCETargetHttpsProxy object.

Return type:

GCETargetHttpsProxy

ex_create_targetinstance(name, zone=None, node=None, description=None, nat_policy='NO_NAT')[source]

Create a target instance.

Parameters:
  • name (str) – Name of target instance
  • region (str or GCEZone or None) – Zone to create the target pool in. Defaults to self.zone
  • node (str or Node) – The actual instance to be used as the traffic target.
  • description (str or None) – A text description for the target instance
  • nat_policy (str) – The NAT option for how IPs are NAT’d to the node.
Returns:

Target Instance object

Return type:

GCETargetInstance

ex_create_targetpool(name, region=None, healthchecks=None, nodes=None, session_affinity=None, backup_pool=None, failover_ratio=None)[source]

Create a target pool.

Parameters:
  • name (str) – Name of target pool
  • region (str or GCERegion or None) – Region to create the target pool in. Defaults to self.region
  • healthchecks (list of str or GCEHealthCheck) – Optional list of health checks to attach
  • nodes (list of str or Node) – Optional list of nodes to attach to the pool
  • session_affinity (str) – Optional algorithm to use for session affinity.
  • backup_pool (GCETargetPool or None) – Optional backup targetpool to take over traffic if the failover_ratio is exceeded.
  • failover_ratio (GCETargetPool or None) – The percentage of healthy VMs must fall at or below this value before traffic will be sent to the backup_pool.
Returns:

Target Pool object

Return type:

GCETargetPool

ex_create_urlmap(name, default_service)[source]

Create a URL Map.

Parameters:
  • name (str) – Name of the URL Map.
  • default_service (str or GCEBackendService) – Default backend service for the map.
Returns:

URL Map object

Return type:

GCEUrlMap

ex_delete_access_config(node, name, nic)[source]

Delete a network interface access configuration from a node.

Parameters:
  • node (Node) – The existing target Node (instance) for the request.
  • name (str) – Name of the access config.
  • nic (str) – Name of the network interface.
Returns:

True if successful

Return type:

bool

ex_delete_image(image)[source]

Delete a specific image resource.

Parameters:image (str or GCENodeImage) – Image object to delete
Returns:True if successful
Return type:bool
ex_deprecate_image(image, replacement, state=None, deprecated=None, obsolete=None, deleted=None)[source]

Deprecate a specific image resource.

Parameters:
  • image (str or :class: GCENodeImage) – Image object to deprecate
  • replacement (str or :class: GCENodeImage) – Image object to use as a replacement
  • state (str) – State of the image
  • deprecated (str or None) – RFC3339 timestamp to mark DEPRECATED
  • obsolete (str or None) – RFC3339 timestamp to mark OBSOLETE
  • deleted (str or None) – RFC3339 timestamp to mark DELETED
Returns:

True if successful

Return type:

bool

ex_destroy_address(address)[source]

Destroy a static address.

Parameters:address (str or GCEAddress) – Address object to destroy
Returns:True if successful
Return type:bool
ex_destroy_autoscaler(autoscaler)[source]

Destroy an Autoscaler.

Parameters:autoscaler (GCEAutoscaler) – Autoscaler object to destroy.
Returns:True if successful
Return type:bool
ex_destroy_backendservice(backendservice)[source]

Destroy a Backend Service.

Parameters:backendservice (GCEBackendService) – BackendService object to destroy
Returns:True if successful
Return type:bool
ex_destroy_firewall(firewall)[source]

Destroy a firewall.

Parameters:firewall (GCEFirewall) – Firewall object to destroy
Returns:True if successful
Return type:bool
ex_destroy_forwarding_rule(forwarding_rule)[source]

Destroy a forwarding rule.

Parameters:forwarding_rule (GCEForwardingRule) – Forwarding Rule object to destroy
Returns:True if successful
Return type:bool
ex_destroy_healthcheck(healthcheck)[source]

Destroy a healthcheck.

Parameters:healthcheck (GCEHealthCheck) – Health check object to destroy
Returns:True if successful
Return type:bool
ex_destroy_instancegroup(instancegroup)[source]

Deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:instancegroup (GCEInstanceGroup) – The name of the instance group to delete.
Returns:Return True if successful.
Return type:bool
ex_destroy_instancegroupmanager(manager)[source]

Destroy a managed instance group. This will destroy all instances that belong to the instance group.

Parameters:manager (GCEInstanceGroup) – InstanceGroup object to destroy.
Returns:True if successful
Return type:bool
ex_destroy_instancetemplate(instancetemplate)[source]

Deletes the specified instance template. If you delete an instance template that is being referenced from another instance group, the instance group will not be able to create or recreate virtual machine instances. Deleting an instance template is permanent and cannot be undone.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:instancetemplate (str) – The name of the instance template to delete.
Return instanceTemplate:
 Return True if successful.
Rtype instanceTemplate:
 ``bool``
ex_destroy_multiple_nodes(node_list, ignore_errors=True, destroy_boot_disk=False, poll_interval=2, timeout=180)[source]

Destroy multiple nodes at once.

Parameters:
  • node_list (list of Node) – List of nodes to destroy
  • ignore_errors (bool) – If true, don’t raise an exception if one or more nodes fails to be destroyed.
  • destroy_boot_disk (bool) – If true, also destroy the nodes’ boot disks.
  • poll_interval (int) – Number of seconds between status checks.
  • timeout (int) – Number of seconds to wait for all nodes to be destroyed.
Returns:

A list of boolean values. One for each node. True means that the node was successfully destroyed.

Return type:

list of bool

ex_destroy_network(network)[source]

Destroy a network.

Parameters:network (GCENetwork) – Network object to destroy
Returns:True if successful
Return type:bool
ex_destroy_route(route)[source]

Destroy a route.

Parameters:route (GCERoute) – Route object to destroy
Returns:True if successful
Return type:bool
ex_destroy_sslcertificate(sslcertificate)[source]

Deletes the specified SslCertificate resource.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:sslcertificate (str) – Name of the SslCertificate resource to delete.
Return sslCertificate:
 Return True if successful.
Rtype sslCertificate:
 ``bool``
ex_destroy_subnetwork(name, region=None)[source]

Delete a Subnetwork object based on name and region.

Parameters:
  • name (str or GCESubnetwork) – The name, URL or object of the subnetwork
  • region (str or GCERegion or None) – The region object, name, or URL of the subnetwork
Returns:

True if successful

Return type:

bool

ex_destroy_targethttpproxy(targethttpproxy)[source]

Destroy a target HTTP proxy.

Parameters:targethttpproxy (GCETargetHttpProxy) – TargetHttpProxy object to destroy
Returns:True if successful
Return type:bool
ex_destroy_targethttpsproxy(targethttpsproxy)[source]

Deletes the specified TargetHttpsProxy resource.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:targethttpsproxy (str) – Name of the TargetHttpsProxy resource to delete.
Return targetHttpsProxy:
 Return True if successful.
Rtype targetHttpsProxy:
 ``bool``
ex_destroy_targetinstance(targetinstance)[source]

Destroy a target instance.

Parameters:targetinstance (GCETargetInstance) – TargetInstance object to destroy
Returns:True if successful
Return type:bool
ex_destroy_targetpool(targetpool)[source]

Destroy a target pool.

Parameters:targetpool (GCETargetPool) – TargetPool object to destroy
Returns:True if successful
Return type:bool
ex_destroy_urlmap(urlmap)[source]

Destroy a URL map.

Parameters:urlmap (GCEUrlMap) – UrlMap object to destroy
Returns:True if successful
Return type:bool
ex_get_accelerator_type(name, zone=None)[source]

Return an AcceleratorType object based on a name and zone.

Parameters:
  • name (str) – The name of the AcceleratorType
  • zone (GCEZone) – The zone to search for the AcceleratorType in.
Returns:

An AcceleratorType object for the name

Return type:

GCEAcceleratorType

ex_get_address(name, region=None)[source]

Return an Address object based on an address name and optional region.

Parameters:
  • name (str) – The name of the address
  • region (str GCERegion or None) – The region to search for the address in (set to ‘all’ to search all regions)
Returns:

An Address object for the address

Return type:

GCEAddress

ex_get_autoscaler(name, zone=None)[source]

Return an Autoscaler object based on a name and optional zone.

Parameters:
  • name (str) – The name of the Autoscaler.
  • zone (str or GCEZone or None) – The zone to search for the Autoscaler. Set to ‘all’ to search all zones.
Returns:

An Autoscaler object.

Return type:

GCEAutoscaler

ex_get_backendservice(name)[source]

Return a Backend Service object based on name

Parameters:name (str) – The name of the backend service
Returns:A BackendService object for the backend service
Return type:GCEBackendService
ex_get_disktype(name, zone=None)[source]

Return a DiskType object based on a name and optional zone.

Parameters:
  • name (str) – The name of the DiskType
  • zone (str GCEZone or None) – The zone to search for the DiskType in (set to ‘all’ to search all zones)
Returns:

A DiskType object for the name

Return type:

GCEDiskType

ex_get_firewall(name)[source]

Return a Firewall object based on the firewall name.

Parameters:name (str) – The name of the firewall
Returns:A GCEFirewall object
Return type:GCEFirewall
ex_get_forwarding_rule(name, region=None, global_rule=False)[source]

Return a Forwarding Rule object based on the forwarding rule name.

Parameters:
  • name (str) – The name of the forwarding rule
  • region (str or None) – The region to search for the rule in (set to ‘all’ to search all regions).
  • global_rule (bool) – Set to True to get a global forwarding rule. Region will be ignored if True.
Returns:

A GCEForwardingRule object

Return type:

GCEForwardingRule

ex_get_healthcheck(name)[source]

Return a HealthCheck object based on the healthcheck name.

Parameters:name (str) – The name of the healthcheck
Returns:A GCEHealthCheck object
Return type:GCEHealthCheck
ex_get_image(partial_name, ex_project_list=None, ex_standard_projects=True)[source]

Return an GCENodeImage object based on the name or link provided.

Parameters:
  • partial_name (str) – The name, partial name, or full path of a GCE image.
  • ex_project_list (str or list of str or None) – The name of the project to list for images. Examples include: ‘debian-cloud’.
  • ex_standard_projects (bool) – If true, check in standard projects if the image is not found.
Returns:

GCENodeImage object based on provided information or None if an image with that name is not found.

Return type:

GCENodeImage or raise ResourceNotFoundError

ex_get_image_from_family(image_family, ex_project_list=None, ex_standard_projects=True)[source]

Return an GCENodeImage object based on an image family name.

Parameters:
  • image_family (str) – The name of the ‘Image Family’ to return the latest image from.
  • ex_project_list (list of str, or None) – The name of the project to list for images. Examples include: ‘debian-cloud’.
  • ex_standard_projects (bool) – If true, check in standard projects if the image is not found.
Returns:

GCENodeImage object based on provided information or ResourceNotFoundError if the image family is not found.

Return type:

GCENodeImage or raise ResourceNotFoundError

ex_get_instancegroup(name, zone=None)[source]

Returns the specified Instance Group. Get a list of available instance groups by making a list() request.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute * https://www.googleapis.com/auth/compute.readonly

Parameters:
  • name (str) – The name of the instance group.
  • zone (str) – The name of the zone where the instance group is located.
Returns:

GCEInstanceGroup object.

Return type:

GCEInstanceGroup

ex_get_instancegroupmanager(name, zone=None)[source]

Return a InstanceGroupManager object based on a name and optional zone.

Parameters:
  • name (str) – The name of the Instance Group Manager.
  • zone (str or GCEZone or None) – The zone to search for the Instance Group Manager. Set to ‘all’ to search all zones.
Returns:

An Instance Group Manager object.

Return type:

GCEInstanceGroupManager

ex_get_instancetemplate(name)[source]

Return an InstanceTemplate object based on a name and optional zone.

Parameters:name (str) – The name of the Instance Template.
Returns:An Instance Template object.
Return type:GCEInstanceTemplate
ex_get_license(project, name)[source]

Return a License object for specified project and name.

Parameters:
  • project (str) – The project to reference when looking up the license.
  • name (str) – The name of the License
Returns:

A License object for the name

Return type:

GCELicense

ex_get_network(name)[source]

Return a Network object based on a network name.

Parameters:name (str) – The name or URL of the network
Returns:A Network object for the network
Return type:GCENetwork
ex_get_node(name, zone=None)[source]

Return a Node object based on a node name and optional zone.

Parameters:
  • name (str) – The name of the node
  • zone (str or GCEZone or NodeLocation or None) – The zone to search for the node in. If set to ‘all’, search all zones for the instance.
Returns:

A Node object for the node

Return type:

Node

ex_get_project()[source]

Return a Project object with project-wide information.

Returns:A GCEProject object
Return type:GCEProject
ex_get_region(name)[source]

Return a Region object based on the region name.

Parameters:name (str) – The name of the region.
Returns:A GCERegion object for the region
Return type:GCERegion
ex_get_route(name)[source]

Return a Route object based on a route name.

Parameters:name (str) – The name of the route
Returns:A Route object for the named route
Return type:GCERoute
ex_get_serial_output(node)[source]

Fetch the console/serial port output from the node.

Parameters:node (Node) – The existing target Node (instance) for the request.
Returns:A string containing serial port output of the node.
Return type:str
ex_get_size(name, zone=None)[source]

Return a size object based on a machine type name and zone.

Parameters:
  • name (str) – The name of the node
  • zone (str or GCEZone or NodeLocation or None) – The zone to search for the machine type in
Returns:

A GCENodeSize object for the machine type

Return type:

GCENodeSize

ex_get_snapshot(name)[source]

Return a Snapshot object based on snapshot name.

Parameters:name (str) – The name of the snapshot
Returns:A GCESnapshot object for the snapshot
Return type:GCESnapshot
ex_get_sslcertificate(name)[source]

Returns the specified SslCertificate resource. Get a list of available SSL certificates by making a list() request.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute * https://www.googleapis.com/auth/compute.readonly

Parameters:name (str) – Name of the SslCertificate resource to return.
Returns:GCESslCertificate object.
Return type:GCESslCertificate
ex_get_subnetwork(name, region=None)[source]

Return a Subnetwork object based on name and region.

Parameters:
  • name (str) – The name or URL of the subnetwork
  • region (str or GCERegion or None) – The region of the subnetwork
Returns:

A Subnetwork object

Return type:

GCESubnetwork

ex_get_targethttpproxy(name)[source]

Return a Target HTTP Proxy object based on its name.

Parameters:name (str) – The name of the target HTTP proxy.
Returns:A Target HTTP Proxy object for the pool
Return type:GCETargetHttpProxy
ex_get_targethttpsproxy(name)[source]

Returns the specified TargetHttpsProxy resource. Get a list of available target HTTPS proxies by making a list() request.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute * https://www.googleapis.com/auth/compute.readonly

Parameters:name (str) – Name of the TargetHttpsProxy resource to return.
Returns:GCETargetHttpsProxy object.
Return type:GCETargetHttpsProxy
ex_get_targetinstance(name, zone=None)[source]

Return a TargetInstance object based on a name and optional zone.

Parameters:
  • name (str) – The name of the target instance
  • zone (str or GCEZone or None) – The zone to search for the target instance in (set to ‘all’ to search all zones).
Returns:

A TargetInstance object for the instance

Return type:

GCETargetInstance

ex_get_targetpool(name, region=None)[source]

Return a TargetPool object based on a name and optional region.

Parameters:
  • name (str) – The name of the target pool
  • region (str or GCERegion or None) – The region to search for the target pool in (set to ‘all’ to search all regions).
Returns:

A TargetPool object for the pool

Return type:

GCETargetPool

ex_get_urlmap(name)[source]

Return a URL Map object based on name

Parameters:name (str) – The name of the url map
Returns:A URL Map object for the backend service
Return type:GCEUrlMap
ex_get_volume(name, zone=None, use_cache=False)[source]

Return a Volume object based on a volume name and optional zone.

To improve performance, we request all disks and allow the user to consult the cache dictionary rather than making an API call.

Parameters:
  • name (str) – The name of the volume
  • zone (str or GCEZone or NodeLocation or None) – The zone to search for the volume in (set to ‘all’ to search all zones)
  • use_cache (bool) – Search for the volume in the existing cache of volumes. If True, we omit the API call and search self.volumes_dict. If False, a call to disks/aggregatedList is made prior to searching self._ex_volume_dict.
Returns:

A StorageVolume object for the volume

Return type:

StorageVolume

ex_get_zone(name)[source]

Return a Zone object based on the zone name.

Parameters:name (str) – The name of the zone.
Returns:A GCEZone object for the zone or None if not found
Return type:GCEZone or None
ex_instancegroup_add_instances(instancegroup, node_list)[source]

Adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. Read Adding instances for more information.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • instancegroup (:class:GCEInstanceGroup) – The Instance Group where you are adding instances.
  • node_list (list of Node or list of GCENode) – List of nodes to add.
Returns:

Return True if successful.

Return type:

bool

ex_instancegroup_list_instances(instancegroup)[source]

Lists the instances in the specified instance group.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute * https://www.googleapis.com/auth/compute.readonly

Parameters:instancegroup (GCEInstanceGroup) – The Instance Group where from which you want to generate a list of included instances.
Returns:List of GCENode objects.
Return type:list of GCENode objects.
ex_instancegroup_remove_instances(instancegroup, node_list)[source]

Removes one or more instances from the specified instance group, but does not delete those instances.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • instancegroup (:class:GCEInstanceGroup) – The Instance Group where the specified instances will be removed.
  • node_list (list of Node or list of GCENode) – List of nodes to add.
Returns:

True if successful.

Return type:

bool

ex_instancegroup_set_named_ports(instancegroup, named_ports=[])[source]

Sets the named ports for the specified instance group.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • instancegroup (GCEInstanceGroup) – The Instance Group where where the named ports are updated.
  • named_ports (list of {‘name’: str, ‘port`: int}) – Assigns a name to a port number. For example: {name: “http”, port: 80} This allows the system to reference ports by the assigned name instead of a port number. Named ports can also contain multiple ports. For example: [{name: “http”, port: 80},{name: “http”, port: 8080}] Named ports apply to all instances in this instance group.
Returns:

Return True if successful.

Return type:

bool

ex_instancegroupmanager_delete_instances(manager, node_list)[source]

Remove instances from GCEInstanceGroupManager and destroy the instance

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • manager (str or :class: GCEInstanceGroupManager) – Required. The name of the managed instance group. The name must be 1-63 characters long, and comply with RFC1035.
  • node_list (list of Node) – list of Node objects to delete.
Returns:

True if successful

Return type:

bool

ex_instancegroupmanager_list_managed_instances(manager)[source]

Lists all of the instances in the Managed Instance Group.

Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is ‘CREATING’. Note that ‘instanceStatus’ might not be available, for example, if currentAction is ‘CREATING’ or ‘RECREATING’. If a previous action failed, the list displays the errors for that failed action.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute * https://www.googleapis.com/auth/compute.readonly

‘currentAction’ values are one of:
‘ABANDONING’, ‘CREATING’, ‘DELETING’, ‘NONE’, ‘RECREATING’, ‘REFRESHING’, ‘RESTARTING’
Parameters:manager (GCEInstanceGroupManager) – Instance Group Manager to operate on.
Returns:list of dict containing ‘name’, ‘zone’, ‘lastAttempt’, ‘currentAction’, ‘instance’ and ‘instanceStatus’.
Return type:list
ex_instancegroupmanager_recreate_instances(manager, instances=None)[source]

Schedules a group action to recreate the specified instances in the managed instance group. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the action is scheduled even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method or querying the managed instance group directly.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • manager (str or :class: GCEInstanceGroupManager) – Required. The name of the managed instance group. The name must be 1-63 characters long, and comply with RFC1035.
  • instances (list of :class: Node, list of instance names (only), list of instance URIs, or None.) – list of Node objects to be recreated. If equal to None, all instances in the managed instance group are recreated.
Returns:

Dictionary containing instance URI and currentAction. See ex_instancegroupmanager_list_managed_instances for more details.

Return type:

dict

ex_instancegroupmanager_resize(manager, size)[source]

Set the Instance Template for this Instance Group.

Parameters:
  • manager (GCEInstanceGroupManager) – Instance Group Manager to operate on.
  • size (int) – New size of Managed Instance Group.
Returns:

True if successful

Return type:

bool

ex_instancegroupmanager_set_autohealingpolicies(manager, healthcheck, initialdelaysec)[source]

Set the Autohealing Policies for this Instance Group.

Parameters:
  • healthcheck (GCEHealthCheck) – Healthcheck to add
  • initialdelaysec (int) – The time to allow an instance to boot and applications to fully start before the first health check
Returns:

True if successful

Return type:

bool

ex_instancegroupmanager_set_instancetemplate(manager, instancetemplate)[source]

Set the Instance Template for this Instance Group. Existing VMs are not recreated by setting a new InstanceTemplate.

Parameters:
Returns:

True if successful

Return type:

bool

ex_list(list_fn, **kwargs)[source]

Wrap a list method in a GCEList iterator.

>>> for sublist in driver.ex_list(driver.ex_list_urlmaps).page(1):
...   sublist
...
[<GCEUrlMap id="..." name="cli-map">]
[<GCEUrlMap id="..." name="lc-map">]
[<GCEUrlMap id="..." name="web-map">]
Parameters:list_fn (instancemethod) – A bound list method from GCENodeDriver.
Returns:An iterator that returns sublists from list_fn.
Return type:GCEList
ex_list_addresses(region=None)[source]

Return a list of static addresses for a region, ‘global’, or all.

Parameters:region (str or None) – The region to return addresses from. For example: ‘us-central1’. If None, will return addresses from region of self.zone. If ‘all’, will return all addresses. If ‘global’, it will return addresses in the global namespace.
Returns:A list of static address objects.
Return type:list of GCEAddress
ex_list_autoscalers(zone=None)[source]

Return the list of AutoScalers.

Parameters:zone (str or None) – The zone to return InstanceGroupManagers from. For example: ‘us-central1-a’. If None, will return InstanceGroupManagers from self.zone. If ‘all’, will return all InstanceGroupManagers.
Returns:A list of AutoScaler Objects
Return type:list of GCEAutoScaler
ex_list_backendservices()[source]

Return a list of backend services.

Returns:A list of backend service objects.
Return type:list of GCEBackendService
ex_list_disktypes(zone=None)[source]

Return a list of DiskTypes for a zone or all.

Parameters:zone (str or None) – The zone to return DiskTypes from. For example: ‘us-central1-a’. If None, will return DiskTypes from self.zone. If ‘all’, will return all DiskTypes.
Returns:A list of static DiskType objects.
Return type:list of GCEDiskType
ex_list_firewalls()[source]

Return the list of firewalls.

Returns:A list of firewall objects.
Return type:list of GCEFirewall
ex_list_forwarding_rules(region=None, global_rules=False)[source]

Return the list of forwarding rules for a region or all.

Parameters:
  • region (str or GCERegion or None) – The region to return forwarding rules from. For example: ‘us-central1’. If None, will return forwarding rules from the region of self.region (which is based on self.zone). If ‘all’, will return forwarding rules for all regions, which does not include the global forwarding rules.
  • global_rules (bool) – List global forwarding rules instead of per-region rules. Setting True will cause ‘region’ parameter to be ignored.
Returns:

A list of forwarding rule objects.

Return type:

list of GCEForwardingRule

ex_list_healthchecks()[source]

Return the list of health checks.

Returns:A list of health check objects.
Return type:list of GCEHealthCheck
ex_list_instancegroupmanagers(zone=None)[source]

Return a list of Instance Group Managers.

Parameters:zone (str or None) – The zone to return InstanceGroupManagers from. For example: ‘us-central1-a’. If None, will return InstanceGroupManagers from self.zone. If ‘all’, will return all InstanceGroupManagers.
Returns:A list of instance group mgr objects.
Return type:list of GCEInstanceGroupManagers
ex_list_instancegroups(zone)[source]

Retrieves the list of instance groups that are located in the specified project and zone.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute * https://www.googleapis.com/auth/compute.readonly

Parameters:zone (str) – The name of the zone where the instance group is located.
Returns:A list of instance group mgr objects.
Return type:list of GCEInstanceGroupManagers
ex_list_instancetemplates()[source]

Return the list of Instance Templates.

Returns:A list of Instance Template Objects
Return type:list of GCEInstanceTemplate
ex_list_networks()[source]

Return the list of networks.

Returns:A list of network objects.
Return type:list of GCENetwork
ex_list_project_images(ex_project=None, ex_include_deprecated=False)[source]

Return a list of image objects for a project. If no project is specified, only a list of ‘global’ images is returned.

Parameters:
  • ex_project (str, list of str, or None) – Optional alternate project name.
  • ex_include_deprecated (bool) – If True, even DEPRECATED images will be returned.
Returns:

List of GCENodeImage objects

Return type:

list of GCENodeImage

ex_list_regions()[source]

Return the list of regions.

Returns:A list of region objects.
Return type:list of GCERegion
ex_list_routes()[source]

Return the list of routes.

Returns:A list of route objects.
Return type:list of GCERoute
ex_list_snapshots()[source]

Return the list of disk snapshots in the project.

Returns:A list of snapshot objects
Return type:list of GCESnapshot
ex_list_sslcertificates()[source]

Retrieves the list of SslCertificate resources available to the specified project.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute * https://www.googleapis.com/auth/compute.readonly

Returns:A list of SSLCertificate objects.
Return type:list of GCESslCertificate
ex_list_subnetworks(region=None)[source]

Return the list of subnetworks.

Parameters:region (str or GCERegion) – Region for the subnetwork. Specify ‘all’ to return the aggregated list of subnetworks.
Returns:A list of subnetwork objects.
Return type:list of GCESubnetwork
ex_list_targethttpproxies()[source]

Return the list of target HTTP proxies.

Returns:A list of target http proxy objects
Return type:list of GCETargetHttpProxy
ex_list_targethttpsproxies()[source]

Return the list of target HTTPs proxies.

Returns:A list of target https proxy objects
Return type:list of GCETargetHttpsProxy
ex_list_targetinstances(zone=None)[source]

Return the list of target instances.

Returns:A list of target instance objects
Return type:list of GCETargetInstance
ex_list_targetpools(region=None)[source]

Return the list of target pools.

Returns:A list of target pool objects
Return type:list of GCETargetPool
ex_list_urlmaps()[source]

Return the list of URL Maps in the project.

Returns:A list of url map objects
Return type:list of GCEUrlMap
ex_list_zones()[source]

Return the list of zones.

Returns:A list of zone objects.
Return type:list of GCEZone
ex_resize_volume(volume, size)[source]

Resize a volume to the specified size.

Parameters:
  • volume (StorageVolume) – Volume object to resize
  • size (int) – The size in GB of the volume to resize to.
Returns:

True if successful

Return type:

bool

ex_set_common_instance_metadata(metadata=None, force=False)[source]

Set common instance metadata for the project. Common uses are for setting ‘sshKeys’, or setting a project-wide ‘startup-script’ for all nodes (instances). Passing in None for the ‘metadata’ parameter will clear out all common instance metadata except for ‘sshKeys’. If you also want to update ‘sshKeys’, set the ‘force’ parameter to True.

Parameters:
  • metadata (dict or None) – Dictionary of metadata. Can be either a standard python dictionary, or the format expected by GCE (e.g. {‘items’: [{‘key’: k1, ‘value’: v1}, …}]
  • force (bool) – Force update of ‘sshKeys’. If force is False (the default), existing sshKeys will be retained. Setting force to True will either replace sshKeys if a new a new value is supplied, or deleted if no new value is supplied.
Returns:

True if successful

Return type:

bool

ex_set_image_labels(image, labels)[source]

Set labels for the specified image.

Parameters:
  • image (NodeImage) – The existing target Image for the request.
  • labels (dict or None) – Set (or clear with None) labels for this image.
Returns:

True if successful

Return type:

bool

ex_set_machine_type(node, machine_type='n1-standard-1')[source]

Set the machine type of the stopped instance. Can be the short-name, a full, or partial URL.

Parameters:
  • node (Node) – Target node object to change
  • machine_type (str) – Desired machine type
Returns:

True if successful

Return type:

bool

ex_set_node_labels(node, labels)[source]

Set labels for the specified node.

Parameters:
  • node (Node) – The existing target Node (instance) for the request.
  • labels (dict or None) – Set (or clear with None) labels for this node.
Returns:

True if successful

Return type:

bool

ex_set_node_metadata(node, metadata)[source]

Set metadata for the specified node.

Parameters:
  • node (Node) – The existing target Node (instance) for the request.
  • metadata (dict or None) – Set (or clear with None) metadata for this particular node.
Returns:

True if successful

Return type:

bool

ex_set_node_scheduling(node, on_host_maintenance=None, automatic_restart=None)[source]

Set the maintenance behavior for the node.

See Scheduling documentation for more info.

Parameters:
  • node (Node) – Node object
  • on_host_maintenance (str) – Defines whether node should be terminated or migrated when host machine goes down. Acceptable values are: ‘MIGRATE’ or ‘TERMINATE’ (If not supplied, value will be reset to GCE default value for the instance type.)
  • automatic_restart (bool) – Defines whether the instance should be automatically restarted when it is terminated by Compute Engine. (If not supplied, value will be set to the GCE default value for the instance type.)
Returns:

True if successful.

Return type:

bool

ex_set_node_tags(node, tags)[source]

Set the tags on a Node instance.

Note that this updates the node object directly.

Parameters:
  • node (Node) – Node object
  • tags (list of str) – List of tags to apply to the object
Returns:

True if successful

Return type:

bool

ex_set_usage_export_bucket(bucket, prefix=None)[source]

Used to retain Compute Engine resource usage, storing the CSV data in a Google Cloud Storage bucket. See the docs for more information. Please ensure you have followed the necessary setup steps prior to enabling this feature (e.g. bucket exists, ACLs are in place, etc.)

Parameters:
  • bucket (str) – Name of the Google Cloud Storage bucket. Specify the name in either ‘gs://<bucket_name>’ or the full URL ‘https://storage.googleapis.com/<bucket_name>’.
  • prefix (str or None) – Optional prefix string for all reports.
Returns:

True if successful

Return type:

bool

ex_set_volume_auto_delete(volume, node, auto_delete=True)[source]

Sets the auto-delete flag for a volume attached to a node.

Parameters:
  • volume (StorageVolume) – Volume object to auto-delete
  • ex_node (Node) – Node object to auto-delete volume from
  • auto_delete (bool (default True)) – Flag to set for the auto-delete value
Returns:

True if successful

Return type:

bool

ex_set_volume_labels(volume, labels)[source]

Set labels for the specified volume (disk).

Parameters:
  • volume (StorageVolume) – The existing target StorageVolume for the request.
  • labels (dict or None) – Set (or clear with None) labels for this image.
Returns:

True if successful

Return type:

bool

ex_start_node(node, sync=True)[source]
ex_stop_node(node, sync=True)[source]
ex_targethttpsproxy_set_sslcertificates(targethttpsproxy, sslcertificates)[source]

Replaces SslCertificates for TargetHttpsProxy.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • targethttpsproxy (str) – Name of the TargetHttpsProxy resource to set an SslCertificates resource for.
  • sslcertificates (list of GCESslCertificates) – sslcertificates to set.
Returns:

True

Return type:

bool

ex_targethttpsproxy_set_urlmap(targethttpsproxy, urlmap)[source]

Changes the URL map for TargetHttpsProxy.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • targethttpsproxy (str) – Name of the TargetHttpsProxy resource whose URL map is to be set.
  • urlmap (GCEUrlMap) – urlmap to set.
Returns:

True

Return type:

bool

ex_targetpool_add_healthcheck(targetpool, healthcheck)[source]

Add a health check to a target pool.

Parameters:
  • targetpool (str or GCETargetPool) – The targetpool to add health check to
  • healthcheck (str or GCEHealthCheck) – The healthcheck to add
Returns:

True if successful

Return type:

bool

ex_targetpool_add_node(targetpool, node)[source]

Add a node to a target pool.

Parameters:
  • targetpool (str or GCETargetPool) – The targetpool to add node to
  • node (str or Node) – The node to add
Returns:

True if successful

Return type:

bool

ex_targetpool_get_health(targetpool, node=None)[source]

Return a hash of target pool instances and their health.

Parameters:
  • targetpool (GCETargetPool) – Targetpool containing healthchecked instances.
  • node (str, Node, or None) – Optional node to specify if only a specific node’s health status should be returned
Returns:

List of hashes of instances and their respective health, e.g. [{‘node’: Node, ‘health’: ‘UNHEALTHY’}, …]

Return type:

list of dict

ex_targetpool_remove_healthcheck(targetpool, healthcheck)[source]

Remove a health check from a target pool.

Parameters:
  • targetpool (str or GCETargetPool) – The targetpool to remove health check from
  • healthcheck (str or GCEHealthCheck) – The healthcheck to remove
Returns:

True if successful

Return type:

bool

ex_targetpool_remove_node(targetpool, node)[source]

Remove a node from a target pool.

Parameters:
  • targetpool (str or GCETargetPool) – The targetpool to remove node from
  • node (str or Node) – The node to remove
Returns:

True if successful

Return type:

bool

ex_targetpool_set_backup_targetpool(targetpool, backup_targetpool, failover_ratio=0.1)[source]

Set a backup targetpool.

Parameters:
  • targetpool (GCETargetPool) – The existing primary targetpool
  • backup_targetpool (GCETargetPool) – The existing targetpool to use for failover traffic.
  • failover_ratio (float) – The percentage of healthy VMs must fall at or below this value before traffic will be sent to the backup targetpool (default 0.10)
Returns:

True if successful

Return type:

bool

ex_update_autoscaler(autoscaler)[source]

Update an autoscaler with new values.

To update, change the attributes of the autoscaler object and pass the updated object to the method.

Parameters:autoscaler (GCEAutoscaler) – An Autoscaler object with updated values.
Returns:An Autoscaler object representing the new state.
Return type:GCEAutoscaler`
ex_update_firewall(firewall)[source]

Update a firewall with new values.

To update, change the attributes of the firewall object and pass the updated object to the method.

Parameters:firewall (GCEFirewall) – A firewall object with updated values.
Returns:An object representing the new state of the firewall.
Return type:GCEFirewall
ex_update_healthcheck(healthcheck)[source]

Update a health check with new values.

To update, change the attributes of the health check object and pass the updated object to the method.

Parameters:healthcheck (GCEHealthCheck) – A healthcheck object with updated values.
Returns:An object representing the new state of the health check.
Return type:GCEHealthCheck
features = {'create_node': ['ssh_key']}
list_images(ex_project=None, ex_include_deprecated=False)[source]

Return a list of image objects. If no project is specified, a list of all non-deprecated global and vendor images images is returned. By default, only non-deprecated images are returned.

Parameters:
  • ex_project (str, list of str, or None) – Optional alternate project name.
  • ex_include_deprecated (bool) – If True, even DEPRECATED images will be returned.
Returns:

List of GCENodeImage objects

Return type:

list of GCENodeImage

list_locations()[source]

Return a list of locations (zones).

The ex_list_zones method returns more comprehensive results, but this is here for compatibility.

Returns:List of NodeLocation objects
Return type:list of NodeLocation
list_nodes(ex_zone=None, ex_use_disk_cache=True)[source]

Return a list of nodes in the current zone or all zones.

Parameters:
  • ex_zone (str or GCEZone or NodeLocation or None) – Optional zone name or ‘all’
  • ex_use_disk_cache (bool) – Disk information for each node will retrieved from a dictionary rather than making a distinct API call for it.
Returns:

List of Node objects

Return type:

list of Node

list_sizes(location=None)[source]

Return a list of sizes (machineTypes) in a zone.

Parameters:location (str or GCEZone or NodeLocation or None) – Location or Zone for sizes
Returns:List of GCENodeSize objects
Return type:list of GCENodeSize
list_volume_snapshots(volume)[source]

List snapshots created from the provided volume.

For GCE, snapshots are global, but while the volume they were created from still exists, the source disk for the snapshot is tracked.

Parameters:volume (StorageVolume) – A StorageVolume object
Returns:A list of Snapshot objects
Return type:list of GCESnapshot
list_volumes(ex_zone=None)[source]

Return a list of volumes for a zone or all.

Will return list from provided zone, or from the default zone unless given the value of ‘all’.

Parameters:ex_zone (str or GCEZone or NodeLocation or None) – The zone to return volumes from.
Returns:A list of volume objects.
Return type:list of StorageVolume
name = 'Google Compute Engine'
reboot_node(node)[source]

Reboot a node.

Parameters:node (Node) – Node to be rebooted
Returns:True if successful, False if not
Return type:bool
region_dict
region_list
start_node(node, ex_sync=True)[source]

Start a node that is stopped and in TERMINATED state.

Parameters:
  • node (Node) – Node object to start
  • sync (bool) – If true, do not return until destroyed or timeout
Returns:

True if successful

Return type:

bool

stop_node(node, ex_sync=True)[source]

Stop a running node.

Parameters:
  • node (Node) – Node object to stop
  • sync (bool) – If true, do not return until destroyed or timeout
Returns:

True if successful

Return type:

bool

type = 'gce'
website = 'https://cloud.google.com/'
zone_dict
zone_list
class libcloud.compute.drivers.gce.GCENodeImage(id, name, driver, extra=None)[source]

Bases: libcloud.compute.base.NodeImage

A GCE Node Image class.

delete()[source]

Delete this image

Returns:True if successful
Return type:bool
deprecate(replacement, state, deprecated=None, obsolete=None, deleted=None)[source]

Deprecate this image

Parameters:
  • replacement (str or :class: GCENodeImage) – Image to use as a replacement
  • state (str) – Deprecation state of this image. Possible values include ‘ACTIVE’, ‘DELETED’, ‘DEPRECATED’ or ‘OBSOLETE’.
  • deprecated (str or None) – RFC3339 timestamp to mark DEPRECATED
  • obsolete (str or None) – RFC3339 timestamp to mark OBSOLETE
  • deleted (str or None) – RFC3339 timestamp to mark DELETED
Returns:

True if successful

Return type:

bool

class libcloud.compute.drivers.gce.GCENodeSize(id, name, ram, disk, bandwidth, price, driver, extra=None)[source]

Bases: libcloud.compute.base.NodeSize

A GCE Node Size (MachineType) class.

class libcloud.compute.drivers.gce.GCEProject(id, name, metadata, quotas, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

GCE Project information.

set_common_instance_metadata(metadata=None, force=False)[source]

Set common instance metadata for the project. Common uses are for setting ‘sshKeys’, or setting a project-wide ‘startup-script’ for all nodes (instances). Passing in None for the ‘metadata’ parameter will clear out all common instance metadata except for ‘sshKeys’. If you also want to update ‘sshKeys’, set the ‘force’ parameter to True.

Parameters:
  • metadata (dict or None) – Dictionary of metadata. Can be either a standard python dictionary, or the format expected by GCE (e.g. {‘items’: [{‘key’: k1, ‘value’: v1}, …}]
  • force (bool) – Force update of ‘sshKeys’. If force is False (the default), existing sshKeys will be retained. Setting force to True will either replace sshKeys if a new a new value is supplied, or deleted if no new value is supplied.
Returns:

True if successful

Return type:

bool

set_usage_export_bucket(bucket, prefix=None)[source]

Used to retain Compute Engine resource usage, storing the CSV data in a Google Cloud Storage bucket. See the docs for more information. Please ensure you have followed the necessary setup steps prior to enabling this feature (e.g. bucket exists, ACLs are in place, etc.)

Parameters:
  • bucket (str) – Name of the Google Cloud Storage bucket. Specify the name in either ‘gs://<bucket_name>’ or the full URL ‘https://storage.googleapis.com/<bucket_name>’.
  • prefix (str or None) – Optional prefix string for all reports.
Returns:

True if successful

Return type:

bool

class libcloud.compute.drivers.gce.GCERegion(id, name, status, zones, quotas, deprecated, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

class libcloud.compute.drivers.gce.GCEResponse(response, connection)[source]

Bases: libcloud.common.google.GoogleResponse

Parameters:
  • response (httplib.HTTPResponse) – HTTP response object. (optional)
  • connection (Connection) – Parent connection object.
class libcloud.compute.drivers.gce.GCERoute(id, name, dest_range, priority, network='default', tags=None, driver=None, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE Route object class.

destroy()[source]

Destroy this route

Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCESnapshot(id, name, size, status, driver, extra=None, created=None)[source]

Bases: libcloud.compute.base.VolumeSnapshot

class libcloud.compute.drivers.gce.GCESslCertificate(id, name, certificate, driver, extra, private_key=None, description=None)[source]

Bases: libcloud.compute.base.UuidMixin

GCESslCertificate represents the SslCertificate resource.

Parameters:
  • name (str) – Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
  • certificate (str) – A local certificate file. The certificate must be in PEM format. The certificate chain must be no greater than 5 certs long. The chain must include at least one intermediate cert.
  • private_key (str) – A write-only private key in PEM format. Only insert RPCs will include this field.
  • description (str) – An optional description of this resource. Provide this property when you create the resource.
  • driver (:class: `GCENodeDriver`) – An initialized :class: GCENodeDriver
  • extra (:class: ``dict``) – A dictionary of extra information.
destroy()[source]

Destroy this SslCertificate.

Returns:Return True if successful.
Return type:bool
class libcloud.compute.drivers.gce.GCESubnetwork(id, name, cidr, network, region, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE Subnetwork object class.

destroy()[source]

Destroy this subnetwork

Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCETargetHttpProxy(id, name, urlmap, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

destroy()[source]

Destroy this Target HTTP Proxy.

Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCETargetHttpsProxy(id, name, description=None, sslcertificates=None, urlmap=None, driver=None, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

GCETargetHttpsProxy represents the TargetHttpsProxy resource.

Parameters:
  • name (str) – Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
  • description (str) – An optional description of this resource. Provide this property when you create the resource.
  • sslcertificates (list of GCESslcertificates) – URLs to SslCertificate resources that are used to authenticate connections between users and the load balancer. Currently, exactly one SSL certificate must be specified.
  • urlmap (GCEUrlMap) – A fully-qualified or valid partial URL to the UrlMap resource that defines the mapping from URL to the BackendService. For example, the following are all valid URLs for specifying a URL map: - ht tps://www.googleapis.compute/v1/projects/project/gl obal/urlMaps/url-map - projects/project/global/urlMaps/url-map - global/urlMaps/url-map
  • driver (:class: `GCENodeDriver`) – An initialized :class: GCENodeDriver
  • extra (:class: ``dict``) – A dictionary of extra information.
destroy()[source]

Destroy this TargetHttpsProxy.

Returns:Return True if successful.
Return type:bool
set_sslcertificates(sslcertificates)[source]

Set the SSL Certificates for this TargetHTTPSProxy

Parameters:sslcertificates (list of GCESslCertificate) – SSL Certificates to set.
Returns:True if successful
Return type:bool
set_urlmap(urlmap)[source]

Changes the URL map for TargetHttpsProxy.

Scopes needed - one of the following: * https://www.googleapis.com/auth/cloud-platform * https://www.googleapis.com/auth/compute

Parameters:
  • targethttpsproxy (str) – Name of the TargetHttpsProxy resource whose URL map is to be set.
  • urlmap (GCEUrlMap) – UrlMap to set.
Returns:

True

Return type:

bool

class libcloud.compute.drivers.gce.GCETargetInstance(id, name, zone, node, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

destroy()[source]

Destroy this Target Instance

Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCETargetPool(id, name, region, healthchecks, nodes, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

add_healthcheck(healthcheck)[source]

Add a healthcheck to this target pool.

Parameters:healthcheck (str or GCEHealthCheck) – Healthcheck to add
Returns:True if successful
Return type:bool
add_node(node)[source]

Add a node to this target pool.

Parameters:node (str or Node) – Node to add
Returns:True if successful
Return type:bool
destroy()[source]

Destroy this Target Pool

Returns:True if successful
Return type:bool
get_health(node=None)[source]

Return a hash of target pool instances and their health.

Parameters:node (str, Node, or None) – Optional node to specify if only a specific node’s health status should be returned
Returns:List of hashes of nodes and their respective health
Return type:list of dict
remove_healthcheck(healthcheck)[source]

Remove a healthcheck from this target pool.

Parameters:healthcheck (str or GCEHealthCheck) – Healthcheck to remove
Returns:True if successful
Return type:bool
remove_node(node)[source]

Remove a node from this target pool.

Parameters:node (str or Node) – Node to remove
Returns:True if successful
Return type:bool
set_backup_targetpool(backup_targetpool, failover_ratio=0.1)[source]

Set a backup targetpool.

Parameters:
  • backup_targetpool (GCETargetPool) – The existing targetpool to use for failover traffic.
  • failover_ratio (float) – The percentage of healthy VMs must fall at or below this value before traffic will be sent to the backup targetpool (default 0.10)
Returns:

True if successful

Return type:

bool

class libcloud.compute.drivers.gce.GCEUrlMap(id, name, default_service, host_rules, path_matchers, tests, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

A GCE URL Map.

destroy()[source]

Destroy this URL Map

Returns:True if successful
Return type:bool
class libcloud.compute.drivers.gce.GCEZone(id, name, status, maintenance_windows, deprecated, driver, extra=None)[source]

Bases: libcloud.compute.base.NodeLocation

Subclass of NodeLocation to provide additional information.

next_mw_duration

Returns the duration of the next Maintenance Window as a datetime.timedelta object.

time_until_mw

Returns the time until the next Maintenance Window as a datetime.timedelta object.

libcloud.compute.drivers.gce.timestamp_to_datetime(timestamp)[source]

Return a datetime object that corresponds to the time in an RFC3339 timestamp.

Parameters:timestamp (str) – RFC3339 timestamp string
Returns:Datetime object corresponding to timestamp
Return type:datetime.datetime

libcloud.compute.drivers.gig_g8 module

GiG G8 Driver

class libcloud.compute.drivers.gig_g8.G8Network(id, name, cidr, publicipaddress, driver, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

G8 Network object class.

This class maps to a cloudspace

cidr

Cidr is not part of the list result we will lazily fetch it with a get request

create_portforward(node, publicport, privateport, protocol='tcp')[source]
destroy()[source]
list_nodes()[source]
list_portforwards()[source]
class libcloud.compute.drivers.gig_g8.G8NodeDriver(user_id, key, api_url)[source]

Bases: libcloud.compute.base.NodeDriver

GiG G8 node driver

Parameters:
  • key (str) – Token to use for api (jwt)
  • user_id (int) – Id of the account to connect to (accountId)
  • api_url (str) – G8 api url
Return type:

None

NODE_STATE_MAP = {'ADDING_DISK': reconfiguring, 'ATTACHING_DISK': reconfiguring, 'ATTACHING_NIC': reconfiguring, 'CHANGING_DISK_LIMITS': reconfiguring, 'CLONING': pending, 'CREATING_TEMPLATE': pending, 'DELETED': terminated, 'DELETING': terminated, 'DELETING_DISK': reconfiguring, 'DEPLOYING': pending, 'DESTROYED': terminated, 'DESTROYING': terminated, 'DETACHING_DISK': reconfiguring, 'DETTACHING_NIC': reconfiguring, 'ERROR': error, 'HALTED': stopped, 'MOVING': migrating, 'PAUSED': paused, 'PAUSING': pending, 'RESETTING': rebooting, 'RESIZING': reconfiguring, 'RESTORING': pending, 'RESUMING': pending, 'RUNNING': running, 'STARTING': starting, 'STOPPING': stopping, 'VIRTUAL': pending}
attach_volume(node, volume)[source]

Attaches volume to node.

Parameters:
  • node (Node) – Node to attach volume to.
  • volume (StorageVolume) – Volume to attach.
  • device (str) – Where the device is exposed, e.g. ‘/dev/sdb’
Rytpe:

bool

connectionCls

alias of libcloud.common.gig_g8.G8Connection

create_node(name, image, ex_network, ex_description, size=None, auth=None, ex_create_attr=None, ex_expose_ssh=False)[source]

Create a node.

The ex_create_attr parameter can include the following dictionary key and value pairs:

  • memory: int Memory in MiB
    (only used if size is None and vcpus is passed
  • vcpus: int Amount of vcpus
    (only used if size is None and memory is passed)
  • disk_size: int Size of bootdisk
    defaults to minimumsize of the image
  • user_data: str for cloud-config data
  • private_ip: str Private Ip inside network
  • data_disks: list(int) Extra data disks to assign
    to vm list of disk sizes in GiB
Parameters:
  • name (str) – the name to assign the vm
  • size (: str) – the plan size to create mutual exclusive with memory vcpus
  • image (NodeImage) – which distribution to deploy on the vm
  • network – G8 Network to place vm in
  • ex_description – Description of vm
  • auth (NodeAuthSSHKey) – an SSH key
  • ex_create_attr (dict) – A dictionary of optional attributes for vm creation
  • ex_expose_ssh (int) – Create portforward for ssh port
Returns:

The newly created node.

Return type:

Node

create_volume(size, name, ex_description, ex_disk_type='D')[source]

Create volume

Parameters:
  • size (int) – Size of the volume to create in GiB
  • name (str) – Name of the volume
  • description (str) – Description of the volume
  • disk_type (str) – Type of the disk depending on the G8 D for datadisk is always available
Return type:

class:StorageVolume

destroy_node(node)[source]

Destroy node

destroy_volume(volume)[source]

Destroys a storage volume.

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
detach_volume(node, volume)[source]

Detaches a volume from a node.

Parameters:volume (StorageVolume) – Volume to be detached
Return type:bool
ex_create_network(name, private_network='192.168.103.0/24', type='vgw')[source]

Create network also known as cloudspace

Parameters:
  • name (str) – the name to assign to the network
  • private_network (str) – subnet used as private network
  • type (str) – type of the gateway vgw or routeros
ex_create_portforward(network, node, publicport, privateport, protocol='tcp')[source]
ex_delete_portforward(portforward)[source]
ex_destroy_network(network)[source]
ex_expose_ssh_node(node)[source]

Create portforward for ssh purposed

Parameters:node (Node) – Node to expose ssh for
Return type:int
ex_list_networks()[source]

Return the list of networks.

Returns:A list of network objects.
Return type:list of G8Network
ex_list_portforwards(network)[source]
list_images()[source]

Returns a list of images as a cloud provider might have

@inherits: NodeDriver.list_images

list_nodes(ex_network=None)[source]

List the nodes known to a particular driver; There are two default nodes created at the beginning

list_sizes()[source]

Returns a list of node sizes as a cloud provider might have

list_volumes()[source]

List storage volumes.

Return type:list of StorageVolume
name = 'GiG G8 Node Provider'
reboot_node(node)[source]

Reboot node returns True as if the reboot had been successful.

start_node(node)[source]

Start virtual machine

stop_node(node)[source]

Stop virtual machine

type = 'gig_g8'
website = 'https://gig.tech'
class libcloud.compute.drivers.gig_g8.G8PortForward(network, node_id, publicport, privateport, protocol, driver)[source]

Bases: libcloud.compute.base.UuidMixin

destroy()[source]
exception libcloud.compute.drivers.gig_g8.G8ProvisionError[source]

Bases: Exception

libcloud.compute.drivers.gridscale module

class libcloud.compute.drivers.gridscale.GridscaleIp(id, family, prefix, create_time, address, extra=None)[source]

Bases: object

Ip Object

Parameters:
  • id (str) – uuid
  • family (str) – family of ip (v4 or v6)
  • prefix (str) – prefix of ip
  • ip_address (str) – Ip address
  • create_time (str) – Time ip was created
class libcloud.compute.drivers.gridscale.GridscaleNetwork(id, name, status, create_time, relations)[source]

Bases: object

Network Object

Parameters:
  • id (str) – uuid
  • name (str) – Name of Network
  • status (str) – Network status
  • relations (object) – object related to network
  • create_time (str) – Time Network was created
class libcloud.compute.drivers.gridscale.GridscaleNodeDriver(user_id, key, **kwargs)[source]

Bases: libcloud.common.gridscale.GridscaleBaseDriver, libcloud.compute.base.NodeDriver

create and entry in libcloud/compute/providers for gridscale

api_name = 'gridscale'
attach_volume(node, volume)[source]
Attaches volume to node.
Parameters:
  • node (Node) – Node to attach volume to.
  • volume (StorageVolume) – Volume to attach.
Rytpe:

bool

connectionCls

alias of libcloud.common.gridscale.GridscaleConnection

create_image(node, name)[source]

Creates an image from a node object.

Parameters:
  • node (Node) – Node to run the task on.
  • name (str) – Name for new image.
Returns:

NodeImage.

Return type:

NodeImage

create_node(name, size, image, location, ex_ssh_key_ids=None, **kwargs)[source]

Create a simple node with a name, cores, memory at the designated location.

Parameters:
  • name (str) – Name of the server.
  • size (NodeSize) – Nodesize object.
  • image (GridscaleTemplate) – OS image to attach to the storage.
  • location (NodeLocation) – The data center to create a node in.
  • ex_ssh_key_ids (list of str) – List of SSH key IDs to add to the server.
Returns:

The newly created Node.

Return type:

Node

create_volume(size, name, location=None, snapshot=None)[source]

Create a new volume.

Parameters:
  • size (int) – Integer in GB.
  • name (str) – Name of the volume.
  • location (NodeLocation) – The server location.
  • snapshot (VolumeSnapshot) – Snapshot from which to create the new volume. (optional)
Returns:

Newly created StorageVolume.

Return type:

StorageVolume

create_volume_snapshot(volume, name)[source]

Creates a snapshot of the current state of your volume, you can rollback to.

Parameters:
  • volume (StorageVolume) – Volume you want to create a snapshot of.
  • name (str) – Name of the snapshot.
Returns:

VolumeSnapshot.

Return type:

VolumeSnapshot

delete_image(node_image)[source]

Destroy an image.

Parameters:node_image (NodeImage) – Node image object.
Returns:True if the destroy was successful, otherwise False
Return type:bool
destroy_node(node, ex_destroy_associated_resources=False)[source]

Destroy node.

Parameters:
  • node (Node) – Node object.
  • ex_destroy_associated_resources – True to destroy associated

resources such as storage volumes and IPs. :type ex_destroy_associated_resources: bool

Returns:True if the destroy was successful, otherwise False.
Return type:bool
destroy_volume(volume)[source]

Delete volume.

Parameters:volume (StorageVolume) – Volume to be destroyed.
Returns:True if the destroy was successful, otherwise False.
Return type:bool
destroy_volume_snapshot(snapshot)[source]

Destroy a snapshot.

Parameters:snapshot (:class:'.VolumeSnapshot`) – The snapshot to delete.
Returns:True if the destroy was successful, otherwise False.
Return type:bool
detach_volume(volume)[source]

Detaches a volume from a node.

Parameters:volume (StorageVolume) – Volume to be detached
Return type:bool
ex_create_ip(family, location, name)[source]

Create either an ip_v4 ip or a ip_v6.

Parameters:
  • family (int) – Defines if the ip is v4 or v6 with int 4 or int 6.
  • location (NodeLocation) – Defines which datacenter the created ip responds with.
  • name (str) – Name of your Ip.
Returns:

Ip

Return type:

GridscaleIp

ex_create_networks(name, location)[source]

Create a network at the data center location.

Parameters:
  • name (str) – Name of the network.
  • location (NodeLocation) – Location.
Returns:

Network.

Return type:

GridscaleNetwork

ex_destroy_ip(ip)[source]

Delete an ip.

Parameters:ip (GridscaleIp) – IP object.
Returns:True if delete_image was successful, False otherwise.
Return type:bool
ex_destroy_network(network)[source]

Delete network.

Parameters:network (GridscaleNetwork) – Network object.
Returns:True if destroyed successfully, otherwise False
Return type:bool

links a existing ip with a node

Parameters:
  • node (object) – node object
  • ip (object) – ip object
Returns:

Request ID

Return type:

str

link and isoimage to a node

Parameters:
  • node (object) – Node you want to link the iso image to
  • isoimage (object) – isomiage you want to link
Returns:

None -> success

Return type:

None

Link a network to a node.

Parameters:
  • node (Node) – Node object to link networks to.
  • network (GridscaleNetwork) – Network you want to link.
Returns:

True if linked successfully, otherwise False

Return type:

bool

ex_list_ips()[source]

Lists all IPs available.

Returns:List of IP objects.
Return type:list of GridscaleIp
ex_list_ips_for_node(node)[source]

Return a list of associated IPs for the provided node.

Rype:list of GridscaleIp
ex_list_networks()[source]

List all networks.

Returns:List of objects.
Return type:list of GridscaleNetwork
ex_list_volumes_for_node(node)[source]

Return a list of associated volumes for the provided node.

Return type:list of StorageVolume
ex_rename_network(network, name)[source]

Modify networks name.

Parameters:
Returns:

True or False

Return type:

bool

ex_rename_node(node, name)[source]

Modify node name.

Parameters:
  • name (str) – New node name.
  • node (Node) – Node
Returns:

True or False

Return type:

bool

ex_rename_volume(volume, name)[source]

Modify storage volume name

Parameters:
  • volume (:class:.`StorageVolume`) – Storage.
  • name (str) – New storage name.
Returns:

True or False

Return type:

bool

ex_start_node(node)[source]
ex_storage_rollback(volume, snapshot, rollback)[source]

initiate a rollback on your storage

Parameters:
  • volume (string) – storage uuid
  • snapshot (string) – snapshot uuid
  • rollback (bool) – variable
Returns:

RequestID

Return type:

str

unlink ips from server

Parameters:
  • node (object) – node you want to unlink the ip from
  • ip (object) – the ip you want to unlink
Returns:

None -> success

Return type:

None

unlink isoimages from server

Parameters:
  • node (object) – node you want to unlink the image from
  • isoimage (object) – isoimage you want to unlink
Returns:

None -> success

Return type:

None

Unlink network from node.

Parameters:
  • node (Node) – Node you want to unlink from network.
  • network (:class:`.GridscaleNetwork) – Network you want to unlink.
Returns:

True if unlink was successful, otherwise False

Return type:

bool

features = {'create_node': ['ssh_key']}
get_image(image_id)[source]

Get an image based on an image_id.

Parameters:image_id (str) – Image identifier.
Returns:A NodeImage object.
Return type:NodeImage
import_key_pair_from_string(name, key_material)[source]

Import a new public key from string.

Parameters:
  • name (str) – Key pair name.
  • key_material (str) – Public key material.
Return type:

KeyPair object

list_images()[source]

List images.

Returns:List of node image objects
Return type:list of NodeImage
list_key_pairs()[source]

List all the available key pair objects.

Return type:``list``of KeyPair objects
list_locations()[source]

List all available data centers.

Returns:List of node location objects
Return type:list of NodeLocation
list_nodes()[source]

List all nodes.

Returns:List of node objects
Return type:list of Node
list_volume_snapshots(volume)[source]

Lists all snapshots for storage volume.

Parameters:volume (StorageVolume) – storage the snapshot is attached to
Returns:Snapshots
Return type:list of VolumeSnapshot
list_volumes()[source]

List all volumes.

Returns:List of StorageVolume object
Return type:list of StorageVolume
name = 'Gridscale'
reboot_node(node, ex_sleep_interval=3)[source]

Reboot a node.

Parameters:
  • node (Node) – Node object.
  • ex_sleep_interval (int) – time to let the shutdown process finish
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
type = 'gridscale'
website = 'https://gridscale.io'

libcloud.compute.drivers.ikoula module

class libcloud.compute.drivers.ikoula.IkoulaNodeDriver(key, secret=None, secure=True, host=None, path=None, port=None, url=None, *args, **kwargs)[source]

Bases: libcloud.compute.drivers.cloudstack.CloudStackNodeDriver

Inherits:

NodeDriver.__init__

Parameters:
  • host (str) – The host where the API can be reached. (required)
  • path (str) – The path where the API can be reached. (required)
  • url (str) – Full URL to the API endpoint. Mutually exclusive with host and path argument.
host = 'cloudstack.ikoula.com'
name = 'Ikoula'
path = '/client/api'
type = 'ikoula'
website = 'http://express.ikoula.co.uk/cloudstack'

libcloud.compute.drivers.internetsolutions module

Internet Solutions Driver

class libcloud.compute.drivers.internetsolutions.InternetSolutionsNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region='is-af', **kwargs)[source]

Bases: libcloud.compute.drivers.dimensiondata.DimensionDataNodeDriver

InternetSolutions node driver, based on Dimension Data driver

api_version = 1.0
connectionCls

alias of libcloud.common.dimensiondata.DimensionDataConnection

features = {'create_node': ['password']}
name = 'InternetSolutions'
selected_region = None
type = 'internetsolutions'
website = 'http://www.is.co.za/'

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: libcloud.common.base.ConnectionUserAndKey

Connection class for KamateraDriver

add_default_headers(headers)[source]

Adds headers that are needed for all requests

host = '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: libcloud.compute.base.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=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 = {'create_node': ['password', 'generates_password', 'ssh_key']}
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 = '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 = 'kamatera'
website = 'https://www.kamatera.com/'
class libcloud.compute.drivers.kamatera.KamateraResponse(response, connection)[source]

Bases: libcloud.common.base.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

libcloud.compute.drivers.ktucloud module

class libcloud.compute.drivers.ktucloud.KTUCloudNodeDriver(key, secret=None, secure=True, host=None, path=None, port=None, url=None, *args, **kwargs)[source]

Bases: libcloud.compute.drivers.cloudstack.CloudStackNodeDriver

Driver for KTUCloud Compute platform.

Inherits:

NodeDriver.__init__

Parameters:
  • host (str) – The host where the API can be reached. (required)
  • path (str) – The path where the API can be reached. (required)
  • url (str) – Full URL to the API endpoint. Mutually exclusive with host and path argument.
EMPTY_DISKOFFERINGID = '0'
create_node(name, size, image, location=None, ex_usageplantype='hourly')[source]

Create a new node

@inherits: NodeDriver.create_node

Parameters:
  • networks (list of CloudStackNetwork) – Optional list of networks to launch the server into.
  • project (CloudStackProject) – Optional project to create the new node under.
  • diskoffering (CloudStackDiskOffering) – Optional disk offering to add to the new node.
  • ex_keyname (str) – Name of existing keypair
  • ex_userdata (str) – String containing user data
  • ex_security_groups (list of str) – List of security groups to assign to the node
  • ex_displayname (str) – String containing instance display name
  • ex_ip_address (str) – String with ipaddress for the default nic
  • ex_start_vm (bool) – Boolean to specify to start VM after creation Default Cloudstack behaviour is to start a VM, if not specified.
  • ex_rootdisksize (str) – String with rootdisksize for the template
  • ex_affinity_groups (list of CloudStackAffinityGroup) – List of affinity groups to assign to the node
Return type:

CloudStackNode

list_images(location=None)[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 of NodeImage
list_sizes(location=None)[source]

:rtype list of NodeSize

name = 'KTUCloud'
type = 'ktucloud'
website = 'https://ucloudbiz.olleh.com/'

libcloud.compute.drivers.kubevirt module

kubevirt driver with support for nodes (vms)

class libcloud.compute.drivers.kubevirt.KubeVirtNodeDriver(key=None, secret=None, secure=False, host='localhost', port=4243, key_file=None, cert_file=None, ca_cert=None, ex_token_bearer_auth=False)[source]

Bases: libcloud.common.kubernetes.KubernetesDriverMixin, libcloud.compute.base.NodeDriver

Parameters:
  • key (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.
  • key_file (str) – Path to the key file used to authenticate (when using key file auth).
  • cert_file (str) – Path to the cert file used to authenticate (when using key file auth).
  • ex_token_bearer_auth (bool) – True to use token bearer auth.
Returns:

None

NODE_STATE_MAP = {'pending': pending, 'running': running, 'stopped': stopped}
attach_volume(node, volume, device='disk', ex_bus='virtio', ex_name=None)[source]

params: bus, name , device (disk or lun)

connectionCls

alias of libcloud.common.kubernetes.KubernetesBasicAuthConnection

create_node(name, image, location=None, ex_memory=128, ex_cpu=1, ex_disks=None, ex_network=None, ex_termination_grace_period=0, ports=None)[source]

Creating a VM with a containerDisk. :param name: A name to give the VM. The VM will be identified by

this name and atm it cannot be changed after it is set.
Parameters:
  • image (str) – Either a libcloud NodeImage or a string. In both cases it must point to a Docker image with an embedded disk. May be a URI like kubevirt/cirros-registry-disk-demo, kubevirt will automatically pull it from https://hub.docker.com/u/URI. For more info visit: https://kubevirt.io/user-guide/docs/latest/creating-virtual-machines/disks-and-volumes.html#containerdisk
  • location (str) – The namespace where the VM will live. (default is ‘default’)
  • ex_memory (int) – The RAM in MB to be allocated to the VM
  • ex_cpu (int) – The amount of cpu to be allocated in miliCPUs ie: 400 will mean 0.4 of a core, 1000 will mean 1 core and 3000 will mean 3 cores.
  • ex_disks (list of dict. For each dict the types for its keys are: -bus: str -device: str -disk_type: str -name: str -claim_name: str (for creating a claim:) -size: int -storage_class_name: str -volume_mode: str -access_mode: str) –
    A list containing disk dictionaries.
    Each dictionaries should have the following optional keys: -bus: can be “virtio”, “sata”, or “scsi” -device: can be “lun” or “disk” The following are required keys: -disk_type: atm only “persistentVolumeClaim”
    is supported

    -name: The name of the disk configuration -claim_name: the name of the

    Persistent Volume Claim

    If you wish a new Persistent Volume Claim can be created by providing the following: required: -size: the desired size (implied in GB) -storage_class_name: the name of the storage class to # NOQA

    be used for the creation of the Persistent Volume Claim. Make sure it allows for dymamic provisioning.

    optional:

    -access_mode: default is ReadWriteOnce -volume_mode: default is Filesystem,

    it can also be Block
  • ex_network (iterable (tuple or list) [network_type, interface, name] network_type: str | only “pod” is accepted atm interface: str | “masquerade” or “bridge” name: str) – Only the pod type is supported, and in the configuration masquerade or bridge are the accepted values. The parameter must be a tuple or list with (network_type, interface, name)
  • ports (dict with keys ‘ports_tcp`: list of int ‘ports_udp`: list of int) – A dictionary with keys: ‘ports_tcp’ and ‘ports_udp’ ‘ports_tcp’ value is a list of ints that indicate the ports to be exposed with TCP protocol, and ‘ports_udp’ is a list of ints that indicate the ports to be exposed with UDP protocol.
create_volume(size, name, location=None, ex_storage_class_name='', ex_volume_mode='Filesystem', ex_access_mode='ReadWriteOnce', ex_dynamic=True, ex_reclaim_policy='Recycle', ex_volume_type=None, ex_volume_params=None)[source]
Parameters:
  • size (int) – The size in Gigabytes
  • volume_type (str) –

    This is the type of volume to be created that is dependent on the underlying cloud where Kubernetes is deployed. K8s is supporting the following types: -gcePersistentDisk -awsElasticBlockStore -azureFile -azureDisk -csi -fc (Fibre Channel) -flexVolume -flocker -nfs -iSCSI -rbd (Ceph Block Device) -cephFS -cinder (OpenStack block storage) -glusterfs -vsphereVolume -quobyte Volumes -hostPath (Single node testing only – local storage is not supported in any way and WILL NOT WORK in a multi-node cluster) # NOQA -portworx Volumes -scaleIO Volumes -storageOS This parameter is a dict in the form {type: {key1:value1, key2:value2,…}}, where type is one of the above and key1, key2… are type specific keys and their corresponding values. eg: {nsf: {server: “172.0.0.0”, path: “/tmp”}}

    {awsElasticBlockStore: {fsType: ‘ext4’, volumeID: “1234”}}
  • volume_params – A dict with the key:value that the volume_type needs. This parameter is a dict in the form {key1:value1, key2:value2,…}, where type is one of the above and key1, key2… are type specific keys and their corresponding values. eg: for nsf volume_type {server: “172.0.0.0”, path: “/tmp”} for awsElasticBlockStore volume_type {fsType: ‘ext4’, volumeID: “1234”}
destroy_node(node)[source]

Terminating a VMI and deleting the VM resource backing it

destroy_volume(volume)[source]

Destroys a storage volume.

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
detach_volume(volume, ex_node)[source]

Detaches a volume from a node but the node must be given since a PVC can have more than one VMI’s pointing to it

ex_create_service(node, ports, service_type='NodePort', cluster_ip=None, load_balancer_ip=None, override_existing_ports=False)[source]

Each node has a single service of one type on which the exposed ports are described. If a service exists then the port declared will be exposed alongside the existing ones, set override_existing_ports=True to delete existing exposed ports and expose just the ones in the port variable.

param node: the libcloud node for which the ports will be exposed type node: libcloud Node class

param ports: a list of dictionaries with keys –> values:

‘port’ –> port to be exposed on the service ‘target_port’ –> port on the pod/node, optional

if empty then it gets the same value as ‘port’ value

‘protocol’ —> either ‘UDP’ or ‘TCP’, defaults to TCP ‘name’ –> A name for the service If ports is an empty list and a service exists of this type then the service will be deleted.

type ports: list of dict where each dict has keys –> values:
‘port’ –> int ‘target_port’ –> int ‘protocol’ –> str ‘name’ –> str

param service_type: Valid types are ClusterIP, NodePort, LoadBalancer type service_type: str

param cluster_ip: This can be set with an IP string value if you want
manually set the service’s internal IP. If the value is not correct the method will fail, this value can’t be updated.

type cluster_ip: str

param override_existing_ports: Set to True if you want to delete the
existing ports exposed by the service and keep just the ones declared in the present ports argument. By default it is false and if the service already exists the ports will be added to the existing ones.

type override_existing_ports: boolean

ex_delete_service(namespace, service_name)[source]
ex_list_persistent_volume_claims(namespace='default')[source]
ex_list_services(namespace='default', node_name=None, service_name=None)[source]

If node_name is given then the services returned will be those that concern the node

ex_list_storage_classes()[source]
get_node(id=None, name=None)[source]

get a vm by name or id

list_images(location=None)[source]

If location (namespace) is provided only the images in that location will be provided. Otherwise all of them.

list_locations()[source]

By locations here it is meant namespaces.

list_nodes(location=None)[source]

List all nodes.

Returns:list of node objects
Return type:list of Node
list_sizes(location=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 of NodeSize
list_volumes()[source]

Location is a namespace of the cluster.

name = 'kubevirt'
reboot_node(node)[source]

Rebooting a node.

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
stop_node(node)[source]

Stop a node

Parameters:node (Node) – The node to be stopped.
Returns:True if the stop was successful, otherwise False
Return type:bool
type = 'kubevirt'
website = 'https://www.kubevirt.io'

libcloud.compute.drivers.libvirt_driver module

class libcloud.compute.drivers.libvirt_driver.LibvirtNodeDriver(uri, key=None, secret=None)[source]

Bases: libcloud.compute.base.NodeDriver

Libvirt (http://libvirt.org/) node driver.

To enable debug mode, set LIBVIR_DEBUG environment variable.

Parameters:
  • uri (str) – Hypervisor URI (e.g. vbox:///session, qemu:///system, etc.).
  • key (str) – the username for a remote libvirtd server
  • secret – the password for a remote libvirtd server
NODE_STATE_MAP = {0: terminated, 1: running, 2: pending, 3: terminated, 4: terminated, 5: terminated, 6: unknown, 7: unknown}
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_get_hypervisor_hostname()[source]

Return a system hostname on which the hypervisor is running.

ex_get_hypervisor_sysinfo()[source]

Retrieve hypervisor system information.

Return type:dict
ex_get_node_by_name(name)[source]

Retrieve Node object for a domain with a provided name.

Parameters:name (str) – Name of the domain.
ex_get_node_by_uuid(uuid)[source]

Retrieve Node object for a domain with a provided uuid.

Parameters:uuid (str) – Uuid of the domain.
ex_resume_node(node)[source]

Resume a suspended node.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_shutdown_node(node)[source]

Shutdown a running node.

Note: Usually this will result in sending an ACPI event to the node.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_start_node(node)[source]

Start a stopped node.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_suspend_node(node)[source]

Suspend a running node.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_take_node_screenshot(node, directory, screen=0)[source]

Take a screenshot of a monitoring of a running instance.

Parameters:
  • node (libcloud.compute.base.Node) – Node to take the screenshot of.
  • directory (str) – Path where the screenshot will be saved.
  • screen (int) – ID of the monitor to take the screenshot of.
Returns:

Full path where the screenshot has been saved.

Return type:

str

list_nodes()[source]

List all nodes.

Returns:list of node objects
Return type:list of Node
name = 'Libvirt'
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
stop_node(node)[source]

Stop a node

Parameters:node (Node) – The node to be stopped.
Returns:True if the stop was successful, otherwise False
Return type:bool
type = 'libvirt'
website = 'http://libvirt.org/'

libcloud.compute.drivers.linode module

libcloud driver for the Linode(R) API

This driver implements all libcloud functionality for the Linode API. Since the API is a bit more fine-grained, create_node abstracts a significant amount of work (and may take a while to run).

Linode home page http://www.linode.com/ Linode API documentation http://www.linode.com/api/ Alternate bindings for reference http://github.com/tjfontaine/linode-python

Linode(R) is a registered trademark of Linode, LLC.

class libcloud.compute.drivers.linode.LinodeNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Parameters:
  • key (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

name = 'Linode'
type = 'linode'
website = 'http://www.linode.com/'
class libcloud.compute.drivers.linode.LinodeNodeDriverV3(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.linode.LinodeNodeDriver

libcloud driver for the Linode API

Rough mapping of which is which:

  • list_nodes linode.list
  • reboot_node linode.reboot
  • destroy_node linode.delete
  • create_node linode.create, linode.update,
    linode.disk.createfromdistribution, linode.disk.create, linode.config.create, linode.ip.addprivate, linode.boot
  • list_sizes avail.linodeplans
  • list_images avail.distributions
  • list_locations avail.datacenters
  • list_volumes linode.disk.list
  • destroy_volume linode.disk.delete

For more information on the Linode API, be sure to read the reference:

Instantiate the driver with the given API key

Parameters:key (str) – the API key to use (required)
Return type:None
LINODE_STATES = {-2: unknown, -1: pending, 0: pending, 1: running, 2: stopped, 3: rebooting, 4: unknown}
connectionCls

alias of libcloud.common.linode.LinodeConnection

create_node(name, image, size, auth, location=None, ex_swap=None, ex_rsize=None, ex_kernel=None, ex_payment=None, ex_comment=None, ex_private=False, lconfig=None, lroot=None, lswap=None)[source]

Create a new Linode, deploy a Linux distribution, and boot

This call abstracts much of the functionality of provisioning a Linode and getting it booted. A global grant to add Linodes to the account is required, as this call will result in a billing charge.

Note that there is a safety valve of 5 Linodes per hour, in order to prevent a runaway script from ruining your day.

Parameters:
  • name (str) – the name to assign the Linode (mandatory)
  • image (NodeImage) – which distribution to deploy on the Linode (mandatory)
  • size (NodeSize) – the plan size to create (mandatory)
  • auth (NodeAuthSSHKey or NodeAuthPassword) – an SSH key or root password (mandatory)
  • location (NodeLocation) – which datacenter to create the Linode in
  • ex_swap (int) – size of the swap partition in MB (128)
  • ex_rsize (int) – size of the root partition in MB (plan size - swap).
  • ex_kernel (str) – a kernel ID from avail.kernels (Latest 2.6 Stable).
  • ex_payment (int) – one of 1, 12, or 24; subscription length (1)
  • ex_comment (str) – a small comment for the configuration (libcloud)
  • ex_private (bool) – whether or not to request a private IP (False)
  • lconfig (str) – what to call the configuration (generated)
  • lroot (str) – what to call the root image (generated)
  • lswap (str) – what to call the swap space (generated)
Returns:

Node representing the newly-created Linode

Return type:

Node

destroy_node(node)[source]

Destroy the given Linode

Will remove the Linode from the account and issue a prorated credit. A grant for removing Linodes from the account is required, otherwise this method will fail.

In most cases, all disk images must be removed from a Linode before the Linode can be removed; however, this call explicitly skips those safeguards. There is no going back from this method.

Parameters:node (Node) – the Linode to destroy
Return type:bool
destroy_volume(volume)[source]

Destroys disk volume for the Linode. Linode id is to be provided as extra[“LinodeId”] within StorageVolume. It can be retrieved by libcloud.compute.drivers.linode.LinodeNodeDriver                 .ex_list_volumes().

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
ex_create_volume(size, name, node, fs_type)[source]

Create disk for the Linode.

Parameters:
  • size (int) – Size of volume in megabytes (required)
  • name (str) – Name of the volume to be created
  • node (Node) – Node to attach volume to.
  • fs_type (str) – The formatted type of this disk. Valid types are: ext3, ext4, swap, raw
Returns:

StorageVolume representing the newly-created volume

Return type:

StorageVolume

ex_list_volumes(node, disk_id=None)[source]

List existing disk volumes for for given Linode.

Parameters:
  • node (Node) – Node to list disk volumes for. (required)
  • disk_id (int) – Id for specific disk volume. (optional)
Return type:

list of StorageVolume

ex_rename_node(node, name)[source]

Renames a node

ex_resize_node(node, size)[source]

Resizes a Linode from one plan to another

Immediately shuts the Linode down, charges/credits the account, and issue a migration to another host server. Requires a size (numeric), which is the desired PlanID available from avail.LinodePlans() After resize is complete the node needs to be booted

ex_start_node(node)[source]
ex_stop_node(node)[source]
features = {'create_node': ['ssh_key', 'password']}
linode_set_datacenter(dc)[source]

Set the default datacenter for Linode creation

Since Linodes must be created in a facility, this function sets the default that create_node will use. If a location keyword is not passed to create_node, this method must have already been used.

Parameters:dc (NodeLocation) – the datacenter to create Linodes in unless specified
Return type:bool
list_images()[source]

List available Linux distributions

Retrieve all Linux distributions that can be deployed to a Linode.

Return type:list of NodeImage
list_locations()[source]

List available facilities for deployment

Retrieve all facilities that a Linode can be deployed in.

Return type:list of NodeLocation
list_nodes()[source]

List all Linodes that the API key can access

This call will return all Linodes that the API key in use has access
to.

If a node is in this list, rebooting will work; however, creation and destruction are a separate grant.

Returns:List of node objects that the API key can access
Return type:list of Node
list_sizes(location=None)[source]

List available Linode plans

Gets the sizes that can be used for creating a Linode. Since available Linode plans vary per-location, this method can also be passed a location to filter the availability.

Parameters:location (NodeLocation) – the facility to retrieve plans in
Return type:list of NodeSize
reboot_node(node)[source]

Reboot the given Linode

Will issue a shutdown job followed by a boot job, using the last booted configuration. In most cases, this will be the only configuration.

Parameters:node (Node) – the Linode to reboot
Return type:bool
start_node(node)[source]

Boot the given Linode

stop_node(node)[source]

Shutdown the given Linode

class libcloud.compute.drivers.linode.LinodeNodeDriverV4(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.linode.LinodeNodeDriver

Parameters:
  • key (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

LINODE_DISK_STATES = {'deleting': deleting, 'not ready': creating, 'ready': available}
LINODE_STATES = {'booting': starting, 'cloning': migrating, 'deleting': pending, 'migrating': migrating, 'offline': stopped, 'provisioning': starting, 'rebooting': rebooting, 'rebuilding': updating, 'resizing': reconfiguring, 'restoring': pending, 'running': running, 'shutting_down': stopping, 'stopped': stopped}
LINODE_VOLUME_STATES = {'active': available, 'contact_support': unknown, 'creating': creating, 'resizing': updating}
attach_volume(node, volume, persist_across_boots=True)[source]

Attaches a volume to a node. Volume and node must be located in the same region

Parameters:
  • node (Node) – Node to attach the volume to(required)
  • volume (StorageVolume) – Volume to be attached (required)
  • persist_across_boots (bool) – Whether volume should be attached to node across boots
Return type:

class:StorageVolume

connectionCls

alias of libcloud.common.linode.LinodeConnectionV4

create_image(disk, name=None, description=None)[source]
Creates a private image from a LinodeDisk.
Images are limited to three per account.
Parameters:
  • disk (LinodeDisk) – LinodeDisk to create the image from (required)
  • name (str) – A name for the image. Defaults to the name of the disk it is being created from if not provided
  • description (str) – A description of the image
Returns:

The newly created NodeImage

Return type:

NodeImage

create_node(location, size, image=None, name=None, root_pass=None, ex_authorized_keys=None, ex_authorized_users=None, ex_tags=None, ex_backups_enabled=False, ex_private_ip=False)[source]

Creates a Linode Instance. In order for this request to complete successfully, the user must have the add_linodes grant as this call will incur a charge.

Parameters:
  • location (NodeLocation) – which region to create the node in
  • size (NodeSize) – the plan size to create
  • image (NodeImage) – which distribution to deploy on the node
  • name (str) – the name to assign to node. Must start with an alpha character. May only consist of alphanumeric characters, dashes (-), underscores (_) or periods (.). Cannot have two dashes (–), underscores (__) or periods (..) in a row.
  • root_pass (str) – the root password (required if image is provided)
  • ex_authorized_keys (list of str) – a list of public SSH keys
  • ex_authorized_users (list of str) – a list of usernames. If the usernames have associated SSH keys, the keys will be appended to the root users authorized_keys
  • ex_tags (list of str) – list of tags for the node
  • ex_backups_enabled (bool) – whether to be enrolled in the Linode Backup service (False)
  • ex_private_ip (bool) – whether or not to request a private IP
Returns:

Node representing the newly-created node

Return type:

Node

create_volume(name, size, location=None, node=None, tags=None)[source]

Creates a volume and optionally attaches it to a node.

Parameters:
  • name (str) – The name to be given to volume (required). Must start with an alpha character. May only consist of alphanumeric characters, dashes (-), underscores (_) Cannot have two dashes (–), underscores (__) in a row.
  • size (int) – Size in gigabytes (required)
  • location (NodeLocation) – Location to create the node. Required if node is not given.
  • volume (Node) – Node to attach the volume to
  • tags (list of str) – tags to apply to volume
Return type:

class:StorageVolume

delete_image(image)[source]

Deletes a private image

Parameters:image (NodeImage) – NodeImage to delete (required)
Return type:bool
destroy_node(node)[source]

Deletes a node the API Key has permission to read_write

Parameters:node (Node) – the Linode to destroy
Return type:bool
destroy_volume(volume)[source]

Destroys the volume given.

Parameters:volume (StorageVolume) – Volume to be deleted (required)
Return type:bool
detach_volume(volume)[source]

Detaches a volume from a node.

Parameters:volume (StorageVolume) – Volume to be detached (required)
Return type:bool
ex_allocate_private_address(node, address_type='ipv4')[source]

Allocates a private IPv4 address to node.Only ipv4 is currently supported

Parameters:
  • node (Node) – Node to attach the IP address
  • address_type (str) – Type of IP address
Returns:

The newly created LinodeIPAddress

Return type:

LinodeIPAddress

ex_clone_volume(volume, name)[source]

Clones the volume given

Parameters:
  • volume (StorageVolume) – Volume to be cloned
  • name (str) – new cloned volume name
Return type:

StorageVolume

ex_create_disk(size, name, node, fs_type, image=None, ex_root_pass=None, ex_authorized_keys=None, ex_authorized_users=None, ex_read_only=False)[source]

Adds a new disk to node

Parameters:
  • size (int) – Size of disk in megabytes (required)
  • name (str) – Name of the disk to be created (required)
  • node (Node) – Node to attach disk to (required)
  • fs_type (str) – The formatted type of this disk. Valid types are: ext3, ext4, swap, raw, initrd
  • image (NodeImage) – Image to deploy the volume from
  • ex_root_pass (str) – root password,required if an image is provided
  • ex_authorized_keys (list of str) – a list of SSH keys
  • ex_authorized_users (list of str) – a list of usernames that will have their SSH keys, if any, automatically appended to the root user’s ~/.ssh/authorized_keys file.
  • ex_read_only (bool) – if true, this disk is read-only
Returns:

LinodeDisk representing the newly-created disk

Return type:

LinodeDisk

ex_destroy_disk(node, disk)[source]

Destroys disk for the given node.

Parameters:
  • node (Node) – The Node the disk is attached to. (required)
  • disk (LinodeDisk) – LinodeDisk to be destroyed (required)
Return type:

bool

ex_get_node(node_id)[source]

Return a Node object based on a node ID.

Parameters:node_id (str) – Node’s ID
Returns:Created node

:rtype : Node

ex_get_volume(volume_id)[source]

Return a Volume object based on a volume ID.

Parameters:volume_id (str) – Volume’s id
Returns:A StorageVolume object for the volume
Return type:StorageVolume
ex_list_addresses()[source]

List IP addresses

Returns:LinodeIPAddress list
Return type:list of LinodeIPAddress
ex_list_disks(node)[source]

List disks associated with the node.

Parameters:node (Node) – Node to list disks. (required)
Return type:list of LinodeDisk
ex_list_node_addresses(node)[source]

List all IPv4 addresses attached to node

Parameters:node (Node) – Node to list IP addresses
Returns:LinodeIPAddress list
Return type:list of LinodeIPAddress
ex_rename_node(node, name)[source]

Renames a node

Parameters:
  • node (Node) – the Linode to resize
  • name (str) – the node’s new name
Returns:

Changed Node

Return type:

Node

ex_resize_node(node, size, allow_auto_disk_resize=False)[source]

Resizes a node the API Key has read_write permission to a different Type. The following requirements must be met: - The node must not have a pending migration - The account cannot have an outstanding balance - The node must not have more disk allocation than the new size allows

Parameters:
  • node (Node) – the Linode to resize
  • size (NodeSize) – the size of the new node
  • allow_auto_disk_resize (bool) – Automatically resize disks when resizing a node.
Return type:

bool

ex_resize_volume(volume, size)[source]

Resizes the volume given.

Parameters:
  • volume (StorageVolume) – Volume to be resized
  • size (int) – new volume size in gigabytes, must be greater than current size
Return type:

bool

ex_share_address(node, addresses)[source]
Shares an IP with another node.This can be used to allow one Linode
to begin serving requests should another become unresponsive.
Parameters:
  • node (Node) – Node to share the IP addresses with
  • addresses – List of IP addresses to share
Return type:

bool

ex_start_node(node)[source]
ex_stop_node(node)[source]
list_images()[source]

Returns a list of images

Return type:list of NodeImage
list_locations()[source]

Lists the Regions available for Linode services

Return type:list of NodeLocation
list_nodes()[source]

Returns a list of Linodes the API key in use has access to view.

Returns:List of node objects
Return type:list of Node
list_sizes()[source]

Returns a list of Linode Types

: rtype: list of :class: NodeSize

list_volumes()[source]

Get all volumes of the account :rtype: list of :class: StorageVolume

reboot_node(node)[source]

Reboots a node the API Key has permission to modify.

Parameters:node (Node) – the Linode to destroy
Return type:bool
start_node(node)[source]

Boots a node the API Key has permission to modify

Parameters:node (Node) – the node to start
Return type:bool
stop_node(node)[source]

Shuts down a a node the API Key has permission to modify.

Parameters:node (Node) – the Linode to destroy
Return type:bool

libcloud.compute.drivers.maxihost module

class libcloud.compute.drivers.maxihost.MaxihostNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Base Maxihost node driver.

Parameters:
  • key (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

connectionCls

alias of libcloud.common.maxihost.MaxihostConnection

create_key_pair(name, public_key)[source]

Create a new SSH key.

Parameters:
  • name (str) – Key name (required)
  • public_key (str) – base64 encoded public key string (required)
create_node(name, size, image, location, ex_ssh_key_ids=None)[source]

Create a node.

Returns:The newly created node.
Return type:Node
destroy_node(node)[source]

Destroy a node.

ex_start_node(node)[source]
ex_stop_node(node)[source]
list_images()[source]

List images

list_key_pairs()[source]

List all the available SSH keys.

Returns:Available SSH keys.
Return type:list of KeyPair
list_locations(ex_available=True)[source]

List locations

If ex_available is True, show only locations which are available

list_nodes()[source]

List nodes

Return type:list of MaxihostNode
list_sizes()[source]

List sizes

name = 'Maxihost'
reboot_node(node)[source]

Reboot a node.

start_node(node)[source]

Start a node.

stop_node(node)[source]

Stop a node.

type = 'maxihost'
website = 'https://www.maxihost.com/'

libcloud.compute.drivers.ntta module

NTT America Driver

class libcloud.compute.drivers.ntta.NTTAmericaNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region='ntta-na', **kwargs)[source]

Bases: libcloud.compute.drivers.dimensiondata.DimensionDataNodeDriver

NTT America node driver, based on Dimension Data driver

api_version = 1.0
connectionCls

alias of libcloud.common.dimensiondata.DimensionDataConnection

features = {'create_node': ['password']}
name = 'NTTAmerica'
selected_region = None
type = 'ntta'
website = 'http://www.nttamerica.com/'

libcloud.compute.drivers.nttcis module

NTT CIS Driver

class libcloud.compute.drivers.nttcis.NttCisNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region='na', **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

NttCis node driver. Default api_version is used unless specified.

api_version = 1.0
connectionCls

alias of libcloud.common.nttcis.NttCisConnection

create_node(name, image, auth, ex_network_domain=None, ex_primary_nic_private_ipv4=None, ex_primary_nic_vlan=None, ex_primary_nic_network_adapter=None, ex_additional_nics=None, ex_description=None, ex_disks=None, ex_cpu_specification=None, ex_memory_gb=None, ex_is_started=True, ex_primary_dns=None, ex_secondary_dns=None, ex_ipv4_gateway=None, ex_microsoft_time_zone=None, **kwargs)[source]

Create a new NTTCIS node in MCP2. However, it is still backward compatible for MCP1 for a limited time. Please consider using MCP2 datacenter as MCP1 will phase out soon.

Legacy Create Node for MCP1 datacenter

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.base import NodeAuthPassword
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = False
>>> NTTCIS = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Password
>>> root_pw = NodeAuthPassword('password123')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU1')
>>>
>>> # Get network by location
>>> my_network = driver.list_networks(location=location)[0]
>>> pprint(my_network)
>>>
>>> # Get Image
>>> images = driver.list_images(location=location)
>>> image = images[0]
>>>
>>> node = driver.create_node(name='test_blah_2', image=image,
>>>                           auth=root_pw,
>>>                           ex_description='test3 node',
>>>                           ex_network=my_network,
>>>                           ex_is_started=False)
>>> pprint(node)

Create Node in MCP2 Data CenterF

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.base import NodeAuthPassword
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Password
>>> root_pw = NodeAuthPassword('password123')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> vlan = driver.ex_list_vlans(location=location,
>>>                             network_domain=my_network_domain)[0]
>>> pprint(vlan)
>>>
>>> # Get Image
>>> images = driver.list_images(location=location)
>>> image = images[0]
>>>
>>> # Create node using vlan instead of private IPv4
>>> node = driver.create_node(name='test_server_01', image=image,
>>>                           auth=root_pw,
>>>                           ex_description='test2 node',
>>>                           ex_network_domain=my_network_domain,
>>>                           ex_primary_nic_vlan=vlan,
>>>                           ex_is_started=False)
>>>
>>> # Option: Create node using private IPv4 instead of vlan
>>> # node = driver.create_node(name='test_server_02', image=image,
>>> #                           auth=root_pw,
>>> #                           ex_description='test2 node',
>>> #                           ex_network_domain=my_network_domain,
>>> #                           ex_primary_nic_private_ipv4='10.1.1.7',
>>> #                           ex_is_started=False)
>>>
>>> # Option: Create node using by specifying Network Adapter
>>> # node = driver.create_node(name='test_server_03', image=image,
>>> #                           auth=root_pw,
>>> #                           ex_description='test2 node',
>>> #                           ex_network_domain=my_network_domain,
>>> #                           ex_primary_nic_vlan=vlan,
>>> #                           ex_primary_nic_network_adapter='E1000',
>>> #                           ex_is_started=False)
>>>
Parameters:
  • name (str) – (required) String with a name for this new node
  • image (NodeImage or str) – (required) OS Image to boot on node.
  • auth (NodeAuthPassword or str or None) – Initial authentication information for the node. (If this is a customer LINUX image auth will be ignored)
  • ex_description (str) – (optional) description for this node
  • ex_network_domain (DimensionDataNetworkDomain or str) – (required) Network Domain or Network Domain ID to create the node
  • ex_primary_nic_private_ipv4 (:str) – Provide private IPv4. Ignore if ex_primary_nic_vlan is provided. Use one or the other. Not both.
  • ex_primary_nic_vlan – Provide VLAN for the node if ex_primary_nic_private_ipv4 NOT provided. One or the other. Not both.
  • ex_primary_nic_network_adapter (:str) – (Optional) Default value for the Operating System will be used if leave empty. Example: “E1000”.
  • ex_additional_nics (list of :class:’NttCisNic’ or str) – (optional) List :class:’NttCisNic’ or None
  • ex_memory_gb (int) – (optional) The amount of memory in GB for the server Can be used to override the memory value inherited from the source Server Image.
  • ex_cpu_specification (DimensionDataServerCpuSpecification) – (optional) The spec of CPU to deploy
  • ex_is_started (bool) – (required) Start server after creation. Default is set to true.
  • ex_primary_dns (str) – (Optional) The node’s primary DNS
  • ex_secondary_dns (str) – (Optional) The node’s secondary DNS
  • ex_ipv4_gateway (str) – (Optional) IPv4 address in dot-decimal notation, which will be used as the Primary NIC gateway instead of the default gateway assigned by the system. If ipv4Gateway is provided it does not have to be on the VLAN of the Primary NIC but MUST be reachable or the Guest OS will not be configured correctly.
  • ex_disks (List or tuple of :class:'DimensionDataServerDisk`) – (optional) NTTCIS disks. Optional disk elements can be used to define the disk speed that each disk on the Server; inherited from the source Server Image will be deployed to. It is not necessary to include a diskelement for every disk; only those that you wish to set a disk speed value for. Note that scsiId 7 cannot be used.Up to 13 disks can be present in addition to the required OS disk on SCSI ID 0. Refer to https://docs.mcp-services.net/x/UwIu for disk
  • ex_microsoft_time_zone (str`) – (optional) For use with Microsoft Windows source Server Images only. For the exact value to use please refer to the table of time zone indexes in the following Microsoft Technet documentation. If none is supplied, the default time zone for the data center geographic region will be used.
Returns:

The newly created Node.

Return type:

Node

destroy_node(node)[source]

Deletes a node, node must be stopped before deletion

Parameters:node (Node) – The node to delete
Return type:bool
ex_add_public_ip_block_to_network_domain(network_domain)[source]
ex_add_scsi_controller_to_node(server_id, adapter_type, bus_number=None)[source]

Added 8/27/18: Adds a SCSI Controller by node id :param server_id: server id :param adapter_type: the type of SCSI Adapter, i.e., LSI_LOGIC_PARALLEL :param bus_number: optional number of server’s bus :return: whether addition is in progress or ‘OK’ otherwise false

ex_add_storage_to_node(amount, node=None, speed='STANDARD', controller_id=None, scsi_id=None)[source]

Updated 8/23/18 Add storage to the node One of node or controller_id must be selected

Parameters:
  • node (Node) – The server to add storage to (required if controller_id is not used
  • amount (int) – The amount of storage to add, in GB
  • speed (str) – The disk speed type
  • conrollter_id – The disk may be added using the cotnroller id (required if node object is not used)
  • scsi_id (int) – The target SCSI ID (optional)
Return type:

bool

ex_apply_tag_to_asset(asset, tag_key, value=None)[source]

Apply a tag to a NTTC-CIS Asset

Parameters:
  • asset (Node or NodeImage or NttCisNewtorkDomain or NttCisVlan or NttCisPublicIpBlock) – The asset to apply a tag to. (required)
  • tag_key (NttCisTagKey or str) – The tag_key to apply to the asset. (required)
  • value (str) – The value to be assigned to the tag key This is only required if the NttCisTagKey requires it
Return type:

bool

ex_attach_node_to_vlan(node, vlan=None, private_ipv4=None)[source]

Attach a node to a VLAN by adding an additional NIC to the node on the target VLAN. The IP will be automatically assigned based on the VLAN IP network space. Alternatively, provide a private IPv4 address instead of VLAN information, and this will be assigned to the node on corresponding NIC.

Parameters:
  • node (Node) – Node which should be used
  • vlan (NttCisVlan) – VLAN to attach the node to (required unless private_ipv4)
  • private_ipv4 (str) – Private nic IPv4 Address (required unless vlan)
Return type:

bool

ex_audit_log_report(start_date, end_date)[source]

Get audit log report

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
Return type:

list of list

ex_backup_usage_report(start_date, end_date, location)[source]

Get audit log report

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
  • location (NodeLocation or str) – Filters the node list to nodes that are located in this location
Return type:

list of list

ex_change_nic_network_adapter(nic_id, network_adapter_name)[source]

Change network adapter of a NIC on a cloud server

Parameters:
  • nic_id (:str) – Nic ID
  • network_adapter_name (:str) – Network adapter name
Return type:

bool

ex_change_storage_size(disk_id, size)[source]

Change the size of a disk

Parameters:
  • node (Node) – The server to change the disk of
  • disk_id (str) – The ID of the disk to resize
  • size (int) – The disk size in GB
Return type:

bool

ex_change_storage_speed(disk_id, speed, iops=None)[source]

Change the speed (disk tier) of a disk

Parameters:
  • node (Node) – The server to change the disk speed of
  • disk_id (str) – The ID of the disk to change
  • speed (str) – The disk speed type e.g. STANDARD
Return type:

bool

ex_clean_failed_deployment(node)[source]

Removes a node that has failed to deploy

Parameters:node (Node or str) – The failed node to clean
ex_clone_node_to_image(node, image_name, image_description=None, cluster_id=None, is_guest_Os_Customization=None, tag_key_id=None, tag_value=None)[source]

Clone a server into a customer image.

Parameters:
  • node (Node) – The server to clone
  • image_name (str) – The name of the clone image
  • description (str) – The description of the image
Return type:

bool

ex_create_anti_affinity_rule(node_list)[source]

Edited to work with api 2.x. No longer supports 1.0 Create an anti affinity rule given a list of nodes Anti affinity rules ensure that servers will not reside on the same VMware ESX host

Parameters:node_list (list of Node or list of str) – The list of nodes to create a rule for
Return type:bool
ex_create_consistency_group(name, journal_size_gb, source_server_id, target_server_id, description=None)[source]

Create a consistency group

Parameters:
  • name (str) – Name of consistency group
  • journal_size_gb (str) – Journal size in GB
  • source_server_id (str) – Id of the server to copy
  • target_server_id – Id of the server to receive the copy
  • description – (Optional) Description of consistency group
Type:

target_server_id: str

Type:

description: str

Return type:

NttCisConsistencyGroup

ex_create_firewall_rule(network_domain, name, action, ip_version, protocol, source_addr, dest_addr, position, enabled=1, position_relative_to_rule=None)[source]

Creates a firewall rule

Parameters:
  • network_domain (NttCisNetworkDomain or str) – The network domain in which to create the firewall rule
  • name (str) – The rule’s name
  • action (str) – ‘ACCEPT_DECISIVELY’ or ‘DROP’
  • ip_version (str) – ‘IPV4’ or ‘IPV6’
  • protocol (str) – One of ‘IP’, ‘ICMP’, ‘TCP’, or ‘UDP’
  • source_addr (NttCisFirewallAddress) – The source address, which must be an NttCisFirewallAddress instance
  • dest_addr (NttCisFirewallAddress`) – The destination address, which must be an NttCisFirewallAddress instance
  • position (str) – The position in which to create the rule There are two types of positions with position_relative_to_rule arg and without it With: ‘BEFORE’ or ‘AFTER’ Without: ‘FIRST’ or ‘LAST’
  • enabled (int) – Firewall rule is enabled upon creation. Set to 1 for true or 0 for false.
  • position_relative_to_rule (:NttCisFirewallRule or str) – The rule or rule name in which to decide positioning by
Return type:

bool

ex_create_ip_address_list(ex_network_domain, name, description, ip_version, ip_address_collection, child_ip_address_list=None)[source]

Create IP Address List. IP Address list.

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> from libcloud.common.nttcis import NttCisIpAddress
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> # IP Address collection
>>> ipAddress_1 = NttCisIpAddress(begin='190.2.2.100')
>>> ipAddress_2 = NttCisIpAddress(begin='190.2.2.106',
                                         end='190.2.2.108')
>>> ipAddress_3 = NttCisIpAddress(begin='190.2.2.0',
                                         prefix_size='24')
>>> ip_address_collection = [ipAddress_1, ipAddress_2, ipAddress_3]
>>>
>>> # Create IPAddressList
>>> result = driver.ex_create_ip_address_list(
>>>     ex_network_domain=my_network_domain,
>>>     name='My_IP_AddressList_2',
>>>     ip_version='IPV4',
>>>     description='Test only',
>>>     ip_address_collection=ip_address_collection,
>>>     child_ip_address_list='08468e26-eeb3-4c3d-8ff2-5351fa6d8a04'
>>> )
>>>
>>> pprint(result)
Parameters:
  • ex_network_domain (NttCisNetworkDomain or ‘str’) – The network domain or network domain ID
  • name (:str) – IP Address List Name (required)
  • description (:str) – IP Address List Description (optional)
  • ip_version (:str) – IP Version of ip address (required)
  • ip_address_collection (:str) – List of IP Address. At least one ipAddress element or one childIpAddressListId element must be provided.
  • child_ip_address_list (:class:’NttCisChildIpAddressList` or str`) – Child IP Address List or id to be included in this IP Address List. At least one ipAddress or one childIpAddressListId must be provided.
Returns:

a list of NttCisIpAddressList objects

Return type:

list of NttCisIpAddressList

ex_create_nat_rule(network_domain, internal_ip, external_ip)[source]

Create a NAT rule

Parameters:
  • network_domain (NttCisNetworkDomain) – The network domain the rule belongs to
  • internal_ip (str) – The IPv4 address internally
  • external_ip (str) – The IPv4 address externally
Return type:

NttCisNatRule

ex_create_network(location, name, description=None)[source]

Create a new network in an MCP 1.0 location

Parameters:
  • location (NodeLocation or str) – The target location (MCP1)
  • name (str) – The name of the network
  • description (str) – Additional description of the network
Returns:

A new instance of NttCisNetwork

Return type:

Instance of NttCisNetwork

ex_create_network_domain(location, name, service_plan, description=None)[source]

Deploy a new network domain to a data center

Parameters:
  • location (NodeLocation or str) – The data center to list
  • name (str) – The name of the network domain to create
  • service_plan (str) – The service plan, either “ESSENTIALS” or “ADVANCED”
  • description (str) – An additional description of the network domain
Returns:

an instance of NttCisNetworkDomain

Return type:

NttCisNetworkDomain

ex_create_node_uncustomized(name, image, ex_network_domain, ex_is_started=True, ex_description=None, ex_cluster_id=None, ex_cpu_specification=None, ex_memory_gb=None, ex_primary_nic_private_ipv4=None, ex_primary_nic_vlan=None, ex_primary_nic_network_adapter=None, ex_additional_nics=None, ex_disks=None, ex_tagid_value_pairs=None, ex_tagname_value_pairs=None)[source]

This MCP 2.0 only function deploys a new Cloud Server from a CloudControl compatible Server Image, which does not utilize VMware Guest OS Customization process.

Create Node in MCP2 Data Center

Parameters:
  • name (str) – (required) String with a name for this new node
  • image (NodeImage or str) – (UUID of the Server Image being used as the target for the new Server deployment. The source Server Image (OS Image or Customer Image) must have osCustomization set to true. See Get/List OS Image(s) and Get/List Customer Image(s).
  • ex_network_domain (NttCisNetworkDomain or str) – (required) Network Domain or Network Domain ID to create the node
  • ex_description (str) – (optional) description for this node
  • ex_cluster_id – (optional) For multiple cluster

environments, it is possible to set a destination cluster for the new Customer Image. Note that performance of this function is optimal when either the Server cluster and destination are the same or when shared data storage is in place for the multiple clusters. :type ex_cluster_id: str

Parameters:
  • ex_primary_nic_private_ipv4 (:str) – Provide private IPv4. Ignore if ex_primary_nic_vlan is provided. Use one or the other. Not both.
  • ex_primary_nic_vlan – Provide VLAN for the node if ex_primary_nic_private_ipv4 NOT provided. One or the other. Not both.
  • ex_primary_nic_network_adapter (:str) – (Optional) Default value for the Operating System will be used if leave empty. Example: “E1000”.
  • ex_additional_nics (list of :class:’NttCisNic’ or str) – (optional) List :class:’NttCisNic’ or None
  • ex_memory_gb (int) – (optional) The amount of memory in GB for the server Can be used to override the memory value inherited from the source Server Image.
  • ex_cpu_specification (NttCisServerCpuSpecification) – (optional) The spec of CPU to deploy
  • ex_is_started (bool) – (required) Start server after creation. Default is set to true.
  • ex_disks (List or tuple of :class:'NttCisServerDisk`) – (optional) NttCis disks. Optional disk elements can be used to define the disk speed that each disk on the Server; inherited from the source Server Image will be deployed to. It is not necessary to include a diskelement for every disk; only those that you wish to set a disk speed value for. Note that scsiId 7 cannot be used.Up to 13 disks can be present in addition to the required OS disk on SCSI ID 0. Refer to https://docs.mcp-services.net/x/UwIu for disk
  • ex_tagid_value_pairs – (Optional) up to 10 tag elements may be provided. A combination of tagById and tag name cannot be supplied in the same request. Note: ex_tagid_value_pairs and ex_tagname_value_pairs is mutually exclusive. Use one or other.
  • ex_tagname_value_pairs (dict`.) – (Optional) up to 10 tag elements may be provided. A combination of tagById and tag name cannot be supplied in the same request. Note: ex_tagid_value_pairs and ex_tagname_value_pairs is mutually exclusive. Use one or other.
Returns:

The newly created Node.

Return type:

Node

ex_create_portlist(ex_network_domain, name, description, port_collection, child_portlist_list=None)[source]

Create Port List.

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> from libcloud.common.nttcis import NttCisPort
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> # Port Collection
>>> port_1 = DimensionDataPort(begin='1000')
>>> port_2 = DimensionDataPort(begin='1001', end='1003')
>>> port_collection = [port_1, port_2]
>>>
>>> # Create Port List
>>> new_portlist = driver.ex_create_portlist(
>>>     ex_network_domain=my_network_domain,
>>>     name='MyPortListX',
>>>     description="Test only",
>>>     port_collection=port_collection,
>>>     child_portlist_list={'a9cd4984-6ff5-4f93-89ff-8618ab642bb9'}
>>>     )
>>> pprint(new_portlist)
Parameters:
  • ex_network_domain (:str) – (required) The network domain in which to create PortList. Provide networkdomain object or its id.
  • name (:str) – Port List Name
  • description (:str) – IP Address List Description
  • port_collection (:str) – List of Port Address
  • child_portlist_list (:str or ‘’list of :class:’NttCisChildPortList’) – List of Child Portlist to be included in this Port List
Returns:

result of operation

Return type:

bool

ex_create_snapshot_preview_server(snapshot_id, server_name, server_started, nics_connected, server_description=None, target_cluster_id=None, preserve_mac_addresses=None, tag_key_name=None, tag_key_id=None, tag_value=None)[source]

Create a snapshot preview of a server to clone to a new server

Parameters:
  • snapshot_id (str) – ID of the specific snahpshot to use in creating preview server.
  • server_name – Name of the server created from the snapshot

:type str

Parameters:nics_connected – ‘true’ or ‘false’. Should the nics be automatically connected

:type str

Parameters:server_description – (Optional) A brief description of the server.

:type str

Parameters:target_cluster_id – (Optional) The ID of a specific cluster as opposed to the default.

:type str

Parameters:preserve_mac_address – (Optional) If set to ‘true’ will preserve mac address from the original server.

:type str

Parameters:tag_key_name – (Optional) If tagging is desired and by name is desired, set this to the tag name.

:type str

Parameters:tag_key_id – (Optional) If tagging is desired and by id is desired, set this to the tag id.

:type str

Parameters:tag_value – (Optional) If using a tag_key_id or tag_key_name, set the value fo tag_value.
Return type:str
ex_create_tag_key(name, description=None, value_required=True, display_on_report=True)[source]

Creates a tag key in the NTTC-CIS Cloud

Parameters:
  • name (str) – The name of the tag key (required)
  • description (str) – The description of the tag key
  • value_required (bool) – If a value is required for the tag Tags themselves can be just a tag, or be a key/value pair
  • display_on_report (bool) – Should this key show up on the usage reports
Return type:

bool

ex_create_vlan(network_domain, name, private_ipv4_base_address, description=None, private_ipv4_prefix_size=24)[source]

Deploy a new VLAN to a network domain

Parameters:
  • network_domain (NttCisNetworkDomain) – The network domain to add the VLAN to
  • name (str) – The name of the VLAN to create
  • private_ipv4_base_address (str) – The base IPv4 address e.g. 192.168.1.0
  • description (str) – An additional description of the VLAN
  • private_ipv4_prefix_size (int) – The size of the IPv4 address space, e.g 24
Returns:

an instance of NttCisVlan

Return type:

NttCisVlan

ex_delete_anti_affinity_rule(anti_affinity_rule)[source]

Remove anti affinity rule

Parameters:anti_affinity_rule (NttCisAntiAffinityRule or str) – The anti affinity rule to delete
Return type:bool
ex_delete_consistency_group(consistency_group_id)[source]

Delete’s a Consistency Group

Parameters:consistency_group_id – Id of Consistency Group to delete

:type str :return: True if response_code contains either IN_PROGRESS’ or ‘OK’ otherwise False :rtype: bool

ex_delete_firewall_rule(rule)[source]

Delete a firewall rule

Parameters:rule (NttCisFirewallRule) – The rule to delete
Return type:bool
ex_delete_ip_address_list(ex_ip_address_list)[source]

Delete IP Address List by ID

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> ip_address_list_id = '5e7c323f-c885-4e4b-9a27-94c44217dbd3'
>>> result = driver.ex_delete_ip_address_list(ip_address_list_id)
>>> pprint(result)
Parameters:ex_ip_address_list (:class:’NttCisIpAddressList’ or str) – IP Address List object or IP Address List ID (required)
Return type:bool
ex_delete_nat_rule(rule)[source]

Delete an existing NAT rule

Parameters:rule (NttCisNatRule) – The rule to delete
Return type:bool
ex_delete_network(network)[source]

Delete a network from an MCP 1 data center

Parameters:network (NttCisNetwork) – The network to delete
Return type:bool
ex_delete_network_domain(network_domain)[source]

Delete a network domain

Parameters:network_domain (NttCisNetworkDomain) – The network domain to delete
Return type:bool
ex_delete_portlist(ex_portlist)[source]

Delete Port List

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Delete Port List
>>> portlist_id = '157531ce-77d4-493c-866b-d3d3fc4a912a'
>>> response = driver.ex_delete_portlist(portlist_id)
>>> pprint(response)
Parameters:ex_portlist (:str or :class:’NttCisPortList’) – Port List to be deleted
Return type:bool
ex_delete_public_ip_block(block)[source]
ex_delete_vlan(vlan)[source]

Deletes an existing VLAN

Parameters:vlan (DNttCisNetworkDomain) – The VLAN to delete
Return type:bool
ex_destroy_nic(nic_id)[source]

Remove a NIC on a node, removing the node from a VLAN

Parameters:nic_id (str) – The identifier of the NIC to remove
Return type:bool
ex_detailed_usage_report(start_date, end_date)[source]

Get detailed usage information

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
Return type:

list of list

ex_disable_monitoring(node)[source]

Disables cloud monitoring for a node

Parameters:node (Node) – The node to stop monitoring
Return type:bool
ex_disable_snapshots(node)[source]

Disable snapshots on a server. This also deletes current snapshots.

Parameters:node (str) – Node ID of the node on which to enable snapshots.

:return True or False :rtype: bool

ex_edit_firewall_rule(rule, position=None, relative_rule_for_position=None)[source]

Edit a firewall rule

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>>
>>> # List firewall rules
>>> firewall_rules = driver.ex_list_firewall_rules(my_network_domain)
>>>
>>> # Get Firewall Rule by name
>>> pprint("List specific firewall rule by name")
>>> fire_rule_under_test = (list(filter(lambda x: x.name ==
                           'My_New_Firewall_Rule', firewall_rules))[0])
>>> pprint(fire_rule_under_test.source)
>>> pprint(fire_rule_under_test.destination)
>>>
>>> # Edit Firewall
>>> fire_rule_under_test.destination.address_list_id =
        '5e7c323f-c885-4e4b-9a27-94c44217dbd3'
>>> fire_rule_under_test.destination.port_list_id =
        'b6557c5a-45fa-4138-89bd-8fe68392691b'
>>> result = driver.ex_edit_firewall_rule(fire_rule_under_test, 'LAST')
>>> pprint(result)
Parameters:
  • rule (DNttCisFirewallRule) – (required) The rule in which to create
  • position (str) – (required) There are two types of positions with position_relative_to_rule arg and without it With: ‘BEFORE’ or ‘AFTER’ Without: ‘FIRST’ or ‘LAST’
  • relative_rule_for_position (NttCisFirewallRule or str) – (optional) The rule or rule name in which to decide the relative rule for positioning.
Return type:

bool

ex_edit_ip_address_list(ex_ip_address_list, description=None, ip_address_collection=None, child_ip_address_lists=None)[source]

Edit IP Address List. IP Address list. Bear in mind you cannot add ip addresses to >>> from pprint import pprint >>> from libcloud.compute.types import Provider >>> from libcloud.compute.providers import get_driver >>> from libcloud.common.NTTCIS import NttCisIpAddress >>> import libcloud.security >>> >>> # Get NTTC-CIS driver >>> libcloud.security.VERIFY_SSL_CERT = True >>> cls = get_driver(Provider.NTTCIS) >>> driver = cls(‘myusername’,’mypassword’, region=’dd-au’) >>> >>> # IP Address collection >>> ipAddress_1 = NttCisIpAddress(begin=’190.2.2.100’) >>> ipAddress_2 = NttCisIpAddress(begin=’190.2.2.106’, >>> end=’190.2.2.108’) >>> ipAddress_3 = NttCisIpAddress( >>> begin=’190.2.2.0’, prefix_size=’24’) >>> ip_address_collection = [ipAddress_1, ipAddress_2, ipAddress_3] >>> >>> # Edit IP Address List >>> ip_address_list_id = ‘5e7c323f-c885-4e4b-9a27-94c44217dbd3’ >>> result = driver.ex_edit_ip_address_list( >>> ex_ip_address_list=ip_address_list_id, >>> description=”Edit Test”, >>> ip_address_collection=ip_address_collection, >>> child_ip_address_lists=None >>> ) >>> pprint(result)

Parameters:
  • ex_ip_address_list (:class:’NttCisIpAddressList’ or str) – (required) IpAddressList object or IpAddressList ID
  • description (:str) – IP Address List Description
  • ip_address_collection (''list'' of :class:'NttCisIpAddressList') – List of IP Address
  • child_ip_address_lists (list of :class:’NttCisChildIpAddressList’ or str) – Child IP Address List or id to be included in this IP Address List
Returns:

a list of NttCisIpAddressList objects

Return type:

list of NttCisIpAddressList

ex_edit_metadata(node, name=None, description=None, drs_eligible=None)[source]
ex_edit_portlist(ex_portlist, description=None, port_collection=None, child_portlist_list=None)[source]

Edit Port List.

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> from libcloud.common.NTTCIS import DimensionDataPort
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Port Collection
>>> port_1 = DimensionDataPort(begin='4200')
>>> port_2 = DimensionDataPort(begin='4201', end='4210')
>>> port_collection = [port_1, port_2]
>>>
>>> # Edit Port List
>>> editPortlist = driver.ex_get_portlist(
    '27dd8c66-80ff-496b-9f54-2a3da2fe679e')
>>>
>>> result = driver.ex_edit_portlist(
>>>     ex_portlist=editPortlist.id,
>>>     description="Make Changes in portlist",
>>>     port_collection=port_collection,
>>>     child_portlist_list={'a9cd4984-6ff5-4f93-89ff-8618ab642bb9'}
>>> )
>>> pprint(result)
Parameters:
  • ex_portlist (:str or :class:’DNttCisPortList’) – Port List to be edited (required)
  • description (:str) – Port List Description
  • port_collection (:str) – List of Ports
  • child_portlist_list (:list of :class’NttCisChildPortList’ or ‘’str’’) – Child PortList to be included in this IP Address List
Returns:

a list of NttCisPortList objects

Return type:

list of NttCisPortList

ex_enable_monitoring(node, service_plan='ESSENTIALS')[source]

Enables cloud monitoring on a node

Parameters:
  • node (Node) – The node to monitor
  • service_plan (str) – The service plan, one of ESSENTIALS or ADVANCED
Return type:

bool

ex_enable_snapshots(node, window, plan='ADVANCED', initiate='true')[source]

Enable snapshot service on a server

Parameters:
  • node (str) – Node ID of the node on which to enable snapshots.
  • window – The window id of the window in which the snapshot is enabled.
  • plan (str) – Pland type ‘ESSENTIALS’ or ‘ADVANCED
  • initiate – Run a snapshot upon configuration of the snapshot.

:type str

Return type:bool
ex_exchange_nic_vlans(nic_id_1, nic_id_2)[source]

Exchange NIC Vlans

Parameters:
  • nic_id_1 (:str) – Nic ID 1
  • nic_id_2 (:str) – Nic ID 2
Return type:

bool

ex_expand_journal(consistency_group_id, size_gb)[source]

Expand the consistency group’s journhal size in 100Gb increments.

Parameters:
  • consistency_group_id (str) – The consistency group’s UUID
  • size_gb (str) – Gb in 100 Gb increments
Returns:

True if response_code contains either ‘IN_PROGRESS’ or ‘OK’ otherwise False

Return type:

bool

ex_expand_vlan(vlan)[source]

Expands the VLAN to the prefix size in private_ipv4_range_size The expansion will not be permitted if the proposed IP space overlaps with an already deployed VLANs IP space.

Parameters:vlan (NttCisNetworkDomain) – The VLAN to update
Returns:an instance of NttCisVlan
Return type:NttCisVlan
ex_get_base_image_by_id(id)[source]

Gets a Base image in the NTTC-CIS Cloud given the id

Parameters:id (str) – The id of the image
Return type:NodeImage
ex_get_consistency_group(consistency_group_id)[source]

Retrieves a Consistency by it’s id and is more efficient than listing all consistency groups and filtering that result.

Parameters:consistency_group_id (str) – An id of a consistency group
Return type:NttCisConsistencygroup
ex_get_customer_image_by_id(id)[source]

Gets a Customer image in the NTTC-CIS Cloud given the id

Parameters:id (str) – The id of the image
Return type:NodeImage
ex_get_firewall_rule(network_domain, rule_id)[source]
ex_get_image_by_id(id)[source]

Gets a Base/Customer image in the NTTC-CIS Cloud given the id

Note: This first checks the base image
If it is not a base image we check if it is a customer image If it is not in either of these a NttCisAPIException is thrown
Parameters:id (str) – The id of the image
Return type:NodeImage
ex_get_ip_address_list(ex_network_domain, ex_ip_address_list_name)[source]

Get IP Address List by name in network domain specified

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> # Get IP Address List by Name
>>> ipaddresslist_list_by_name = driver.ex_get_ip_address_list(
>>>     ex_network_domain=my_network_domain,
>>>     ex_ip_address_list_name='My_IP_AddressList_1')
>>> pprint(ipaddresslist_list_by_name)
Parameters:
  • ex_network_domain (NttCisNetworkDomain or ‘str’) – (required) The network domain or network domain ID in which ipaddresslist resides.
  • ex_ip_address_list_name (:str) – (required) Get ‘IP Address List’ by name
Returns:

a list of NttCisIpAddressList objects

Return type:

list of NttCisIpAddressList

ex_get_location_by_id(id)[source]

Get location by ID.

Parameters:id (str) – ID of the node location which should be used
Return type:NodeLocation
ex_get_nat_rule(network_domain, rule_id)[source]

Get a NAT rule by ID

Parameters:
  • network_domain (NttCisNetworkDomain) – The network domain the rule belongs to
  • rule_id (str) – The ID of the NAT rule to fetch
Return type:

NttCisNatRule

ex_get_network_domain(network_domain_id)[source]

Get an individual Network Domain, by identifier

Parameters:network_domain_id (str) – The identifier of the network domain
Return type:NttCisNetworkDomain
ex_get_node_by_id(id)[source]
ex_get_portlist(ex_portlist_id)[source]

Get Port List

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get specific portlist by ID
>>> portlist_id = '27dd8c66-80ff-496b-9f54-2a3da2fe679e'
>>> portlist = driver.ex_get_portlist(portlist_id)
>>> pprint(portlist)
Parameters:ex_portlist_id (NttCisNetworkDomain or ‘str’) – The ex_port_list or ex_port_list ID
Returns:NttCisPortList object
Return type:NttCisPort
ex_get_public_ip_block(block_id)[source]
ex_get_tag_key_by_id(id)[source]

Get a specific tag key by ID

Parameters:id (str) – ID of the tag key you want (required)
Return type:NttCisTagKey
ex_get_tag_key_by_name(name)[source]
NOTICE: Tag key is one of those instances where Libloud
handles the search of a list for the client code. This behavior exists inconsistently across libcloud. Get a specific tag key by Name
Parameters:name (str) – Name of the tag key you want (required)
Return type:NttCisTagKey
ex_get_vlan(vlan_id)[source]

Get a single VLAN, by it’s identifier

Parameters:vlan_id (str) – The identifier of the VLAN
Returns:an instance of NttCisVlan
Return type:NttCisVlan
ex_initiate_drs_failover(consistency_group_id)[source]

This method is irreversible. It will failover the Consistency Group while removing it as well.

Parameters:consistency_group_id (str) – Consistency Group’s Id to failover
Returns:True if response_code contains either

IN_PROGRESS’ or ‘OK’ otherwise False :rtype: bool

ex_initiate_manual_snapshot(name=None, server_id=None)[source]

Initiate a manual snapshot of server on the fly

Parameters:
  • name (str) – optional name of server
  • server_id – optional parameter to use instead of name

:type server_id`str`

Returns:True of False
Return type:bool
ex_list_anti_affinity_rules(network=None, network_domain=None, node=None, filter_id=None, filter_state=None)[source]

List anti affinity rules for a network, network domain, or node

Parameters:
  • network (NttCisNetwork or str) – The network to list anti affinity rules for One of network, network_domain, or node is required
  • network_domain (NttCisNetworkDomain or str) – The network domain to list anti affinity rules One of network, network_domain, or node is required
  • node (Node or str) – The node to list anti affinity rules for One of network, netwok_domain, or node is required
  • filter_id (str) – This will allow you to filter the rules by this node id
Return type:

list of :class:NttCisAntiAffinityRule`

ex_list_consistency_group_snapshots(consistency_group_id, create_time_min=None, create_time_max=None)[source]

Optional parameters identify the date of creation of Consistency Group snapshots in *XML Schema (XSD) date time format. Best used as a combination of createTime.MIN and createTime.MAX. If neither is provided then all snapshots up to the possible maximum of 1014 will be returned. If MIN is provided by itself, all snapshots between the time specified by MIN and the point in time of execution will be returned. If MAX is provided by itself, then all snapshots up to that point in time (up to the maximum number of 1014) will be returned. MIN and MAX are inclusive for this API function

Parameters:
  • consistency_group_id (str) – The id of consistency group
  • create_time_min (str) – (Optional) in form YYYY-MM-DDT00:00.00.00Z or substitute time offset for Z, i.e, -05:00
  • create_time_max (str) – (Optional) in form YYYY-MM-DDT00:00:00.000Z or substitute time offset for Z, i.e, -05:00
Return type:

list of NttCisSnapshots

ex_list_consistency_groups(params={})[source]

Functions takes a named parameter that must be one of the following :param params: A dictionary composed of one of the following keys and a value * target_data_center_id= * source_network_domain_id= * target_network_domain_id= * source_server_id= * target_server_id= * name= * state= * operation_status= * drs_infrastructure_status= :rtype: list of :class: NttCisConsistencyGroup

ex_list_customer_images(location=None)[source]

Return a list of customer imported images

Parameters:location (NodeLocation or str) – The target location
Return type:list of NodeImage
ex_list_firewall_rules(network_domain, page_size=50, page_number=1)[source]
ex_list_ip_address_list(ex_network_domain)[source]

List IP Address List by network domain ID specified

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
                      networkDomainName][0]
>>>
>>> # List IP Address List of network domain
>>> ipaddresslist_list = driver.ex_list_ip_address_list(
>>>     ex_network_domain=my_network_domain)
>>> pprint(ipaddresslist_list)
Parameters:ex_network_domain (NttCisNetworkDomain or ‘str’) – The network domain or network domain ID
Returns:a list of NttCisIpAddressList objects
Return type:list of NttCisIpAddressList
ex_list_nat_rules(network_domain)[source]

Get NAT rules for the network domain

Parameters:network_domain (NttCisNetworkDomain) – The network domain the rules belongs to
Return type:list of NttCisNatRule
ex_list_network_domains(location=None, name=None, service_plan=None, state=None)[source]

List networks domains deployed across all data center locations domain.

for your organization. The response includes the location of each network :param location: Only network domains in the location (optional) :type location: NodeLocation or str

Parameters:
  • name (str) – Only network domains of this name (optional)
  • service_plan (str) – Only network domains of this type (optional)
  • state (str) – Only network domains in this state (optional)
Returns:

a list of NttCisNetwork objects

Return type:

list of NttCisNetwork

ex_list_networks(location=None)[source]

List networks deployed across all data center locations for your organization. The response includes the location of each network.

Parameters:location (NodeLocation or str) – The target location
Returns:a list of NttCisNetwork objects
Return type:list of NttCisNetwork
ex_list_nodes_paginated(name=None, location=None, ipv6=None, ipv4=None, vlan=None, image=None, deployed=None, started=None, state=None, network=None, network_domain=None)[source]

Return a generator which yields node lists in pages

Parameters:
  • location (NodeLocation or str) – Filters the node list to nodes that are located in this location
  • name – Filters the node list to nodes that have this name

:type name str

Parameters:
  • ipv6 (str) – Filters the node list to nodes that have this ipv6 address
  • ipv4 (str) – Filters the node list to nodes that have this ipv4 address
  • vlan (NttCisVlan or str) – Filters the node list to nodes that are in this VLAN
  • image (NodeImage or str) – Filters the node list to nodes that have this image
  • deployed (bool) – Filters the node list to nodes that are deployed or not
  • started (bool) – Filters the node list to nodes that are started or not
  • state (str) – Filters the node list to nodes that are in this state
  • network (NttCisNetwork or str) – Filters the node list to nodes in this network
  • network_domain (NttCisNetworkDomain or str) – Filters the node list to nodes in this network domain
Returns:

a list of Node objects

Return type:

generator of list of Node

ex_list_portlist(ex_network_domain)[source]

List Portlist by network domain ID specified

>>> from pprint import pprint
>>> from libcloud.compute.types import Provider
>>> from libcloud.compute.providers import get_driver
>>> import libcloud.security
>>>
>>> # Get NTTC-CIS driver
>>> libcloud.security.VERIFY_SSL_CERT = True
>>> cls = get_driver(Provider.NTTCIS)
>>> driver = cls('myusername','mypassword', region='dd-au')
>>>
>>> # Get location
>>> location = driver.ex_get_location_by_id(id='AU9')
>>>
>>> # Get network domain by location
>>> networkDomainName = "Baas QA"
>>> network_domains = driver.ex_list_network_domains(location=location)
>>> my_network_domain = [d for d in network_domains if d.name ==
>>>                                               networkDomainName][0]
>>>
>>> # List portlist
>>> portLists = driver.ex_list_portlist(
>>>     ex_network_domain=my_network_domain)
>>> pprint(portLists)
>>>
Parameters:ex_network_domain (NttCisNetworkDomain or ‘str’) – The network domain or network domain ID
Returns:a list of NttCisPortList objects
Return type:list of NttCisPortList
ex_list_public_ip_blocks(network_domain)[source]
ex_list_reserved_ipv4(vlan=None, datacenter_id=None)[source]
ex_list_reserved_ipv6(vlan=None, datacenter_id=None)[source]
ex_list_tag_keys(id=None, name=None, value_required=None, display_on_report=None)[source]

List tag keys in the NTTC-CIS Cloud

Parameters:
  • id (str) – Filter the list to the id of the tag key
  • name (str) – Filter the list to the name of the tag key
  • value_required (bool) – Filter the list to if a value is required for a tag key
  • display_on_report (bool) – Filter the list to if the tag key should show up on usage reports
Return type:

list of NttCisTagKey

ex_list_tags(asset_id=None, asset_type=None, location=None, tag_key_name=None, tag_key_id=None, value=None, value_required=None, display_on_report=None)[source]

List tags in the NTTC-CIS Cloud

Parameters:
  • asset_id (str) – Filter the list by asset id
  • asset_type (str) – Filter the list by asset type
  • location (:class:NodeLocation or str) – Filter the list by the assets location
  • tag_key_name (str) – Filter the list by a tag key name
  • tag_key_id (str) – Filter the list by a tag key id
  • value (str) – Filter the list by a tag value
  • value_required (bool) – Filter the list to if a value is required for a tag
  • display_on_report (bool) – Filter the list to if the tag should show up on usage reports
Return type:

list of NttCisTag

ex_list_vlans(location=None, network_domain=None, name=None, ipv4_address=None, ipv6_address=None, state=None)[source]

List VLANs available, can filter by location and/or network domain

Parameters:
  • location (NodeLocation or str) – Only VLANs in this location (optional)
  • network_domain (NttCisNetworkDomain) – Only VLANs in this domain (optional)
  • name (str) – Only VLANs with this name (optional)
  • ipv4_address (str) – Only VLANs with this ipv4 address (optional)
  • ipv6_address (str) – Only VLANs with this ipv6 address (optional)
  • state (str) – Only VLANs with this state (optional)
Returns:

a list of NttCisVlan objects

Return type:

list of NttCisVlan

ex_migrate_preview_server(preview_id)[source]
ex_modify_tag_key(tag_key, name=None, description=None, value_required=None, display_on_report=None)[source]

Modify a specific tag key

Parameters:
  • tag_key (NttCisTagKey or str) – The tag key you want to modify (required)
  • name (str) – Set to modify the name of the tag key
  • description (str) – Set to modify the description of the tag key
  • value_required (bool) – Set to modify if a value is required for the tag key
  • display_on_report (bool) – Set to modify if this tag key should display on the usage reports
Return type:

bool

ex_power_off(node)[source]

This function will abruptly power-off a server. Unlike ex_shutdown_graceful, success ensures the node will stop but some OS and application configurations may be adversely affected by the equivalent of pulling the power plug out of the machine.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_reconfigure_node(node, memory_gb=None, cpu_count=None, cores_per_socket=None, cpu_performance=None)[source]

Reconfigure the virtual hardware specification of a node

Parameters:
  • node (Node) – The server to change
  • memory_gb (int) – The amount of memory in GB (optional)
  • cpu_count (int) – The number of CPU (optional)
  • cores_per_socket (int) – Number of CPU cores per socket (optional)
  • cpu_performance (str) – CPU Performance type (optional)
Return type:

bool

ex_remove_scsi_controller(controller_id)[source]

Added 8/27/18: Adds a SCSI Controller by node id :param controller_id: Scsi controller’s id :return: whether addition is in progress or ‘OK’ otherwise false

ex_remove_storage(disk_id)[source]

Remove storage from a node

Parameters:
  • node (Node) – The server to add storage to
  • disk_id (str) – The ID of the disk to remove
Return type:

bool

ex_remove_storage_from_node(node, scsi_id)[source]

Remove storage from a node

Parameters:
  • node (Node) – The server to add storage to
  • scsi_id (str) – The ID of the disk to remove
Return type:

bool

ex_remove_tag_from_asset(asset, tag_key)[source]

Remove a tag from an asset

Parameters:
  • asset (Node or NodeImage or NttCisNewtorkDomain or NttCisVlan or NttCisPublicIpBlock) – The asset to remove a tag from. (required)
  • tag_key (NttCisTagKey or str) – The tag key you want to remove (required)
Return type:

bool

ex_remove_tag_key(tag_key)[source]

Modify a specific tag key

Parameters:tag_key (NttCisTagKey or str) – The tag key you want to remove (required)
Return type:bool
ex_rename_network(network, new_name)[source]

Rename a network in MCP 1 data center

Parameters:
  • network (NttCisNetwork) – The network to rename
  • new_name (str) – The new name of the network
Return type:

bool

ex_reserve_ip(vlan, ip, description)[source]
ex_reset(node)[source]

This function will abruptly reset a server. Unlike reboot_node, success ensures the node will restart but some OS and application configurations may be adversely affected by the equivalent of pulling the power plug out of the machine.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_set_firewall_rule_state(rule, state)[source]

Change the state (enabled or disabled) of a rule

Parameters:
  • rule (NttCisFirewallRule) – The rule to delete
  • state (bool) – The desired state enabled (True) or disabled (False)
Return type:

bool

ex_shutdown_graceful(node)[source]
ex_software_usage_report(start_date, end_date)[source]

Get detailed software usage reports

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
Return type:

list of list

ex_start_drs_failover_preview(consistency_group_id, snapshot_id)[source]

Brings a Consistency Group into PREVIEWING_SNAPSHOT mode.

Parameters:
  • consistency_group_id (str) – Id of the Consistency Group to put into PRIEVEW_MODE
  • snapshot_id (str) – Id of the Snapshot to preview
Returns:

True if response_code contains either ‘IN_PROGRESS’ or ‘OK’ otherwise False

Return type:

bool

ex_start_node(node)[source]
ex_stop_drs_failover_preview(consistency_group_id)[source]

Takes a Consistency Group out of PREVIEW_MODE and back to DRS_MODE

Parameters:consistency_group_id – Consistency Group’s Id

:type str

Returns:True if response_code contains either ‘IN_PROGRESS’ or ‘OK’ otherwise False
Return type:bool
ex_summary_usage_report(start_date, end_date)[source]

Get summary usage information

Parameters:
  • start_date (str in format YYYY-MM-DD) – Start date for the report
  • end_date (str in format YYYY-MM-DD) – End date for the report
Return type:

list of list

ex_unreserve_ip_addresses(vlan, ip)[source]
ex_update_monitoring_plan(node, service_plan='ESSENTIALS')[source]

Updates the service plan on a node with monitoring

Parameters:
  • node (Node) – The node to monitor
  • service_plan (str) – The service plan, one of ESSENTIALS or ADVANCED
Return type:

bool

ex_update_network_domain(network_domain)[source]

Update the properties of a network domain

Parameters:network_domain (NttCisNetworkDomain) – The network domain with updated properties
Returns:an instance of NttCisNetworkDomain
Return type:NttCisNetworkDomain
ex_update_node(node, name=None, description=None, cpu_count=None, ram_mb=None)[source]

Update the node, the name, CPU or RAM

Parameters:
  • node (Node) – Node which should be used
  • name (str) – The new name (optional)
  • description (str) – The new description (optional)
  • cpu_count (int) – The new CPU count (optional)
  • ram_mb (int) – The new Memory in MB (optional)
Return type:

bool

ex_update_vlan(vlan)[source]

Updates the properties of the given VLAN Only name and description are updated

Parameters:vlan (NttCisetworkDomain) – The VLAN to update
Returns:an instance of NttCisVlan
Return type:NttCisVlan
ex_update_vm_tools(node)[source]

This function triggers an update of the VMware Tools software running on the guest OS of a Server.

Parameters:node (Node) – Node which should be used
Return type:bool
ex_wait_for_state(state, func, poll_interval=2, timeout=60, *args, **kwargs)[source]

Wait for the function which returns a instance with field status to match

Keep polling func until one of the desired states is matched

Parameters:
  • state (str or list) – Either the desired state (str) or a list of states
  • func (function) – The function to call, e.g. ex_get_vlan
  • poll_interval (int) – The number of seconds to wait between checks
  • timeout (int) – The total number of seconds to wait to reach a state
  • args (Positional arguments) – The arguments for func
  • kwargs (Keyword arguments) – The arguments for func
features = {'create_node': ['password']}
get_snapshot(snapshot_id)[source]

Get snapshot of a server by snapshot id.

Parameters:snapshot_id (str) – ID of snapshot to retrieve.

:return a snapshot :rtype: dict

import_image(ovf_package_name, name, cluster_id=None, datacenter_id=None, description=None, is_guest_os_customization=None, tagkey_name_value_dictionaries=None)[source]

Import image

Parameters:
  • ovf_package_name (str) – Image OVF package name
  • name (str) – Image name
  • cluster_id (str) – Provide either cluster_id or datacenter_id
  • datacenter_id (str) – Provide either cluster_id or datacenter_id
  • description (str) – Optional. Description of image
  • is_guest_os_customization (bool) – Optional. true for NGOC image
  • tagkey_name_value_dictionaries (dictionaries) – Optional tagkey name value dict
Returns:

Return true if successful

Return type:

bool

list_datacenter_properties(location)[source]
return a list of available sizes
Currently, the size of the node is dictated by the chosen OS base image, they cannot be set explicitly.

@inherits: NodeDriver.list_sizes

list_images(location=None)[source]

List images available

Note: Currently only returns the default ‘base OS images’
provided by NTTCIS. Customer images (snapshots) use ex_list_customer_images
Parameters:ex_location (NodeLocation or str) – Filters the node list to nodes that are located in this location
Returns:List of images available
Return type:list of NodeImage
list_locations(ex_id=None)[source]

List locations (datacenters) available for instantiating servers and networks.

Parameters:ex_id (str) – Filters the location list to this id
Returns:List of locations
Return type:list of NttCisDatacenter
list_networks(location=None)[source]

List networks deployed across all data center locations for your organization. The response includes the location of each network.

Parameters:location (NodeLocation or str) – The location
Returns:a list of NttCisNetwork objects
Return type:list of NttCisNetwork
list_nodes(ex_location=None, ex_name=None, ex_ipv6=None, ex_ipv4=None, ex_vlan=None, ex_image=None, ex_deployed=None, ex_started=None, ex_state=None, ex_network_domain=None, ex_snaphots=None)[source]

List nodes deployed for your organization.

keyword ex_location:
 Filters the node list to nodes that are located in this location
type ex_location:
 NodeLocation or str
keyword ex_name:
 Filters the node list to nodes that have this name

:type ex_name str

keyword ex_ipv6:
 Filters the node list to nodes that have this ipv6 address
type ex_ipv6:
 str
keyword ex_ipv4:
 Filters the node list to nodes that have this ipv4 address
type ex_ipv4:
 str
keyword ex_vlan:
 Filters the node list to nodes that are in this VLAN
type ex_vlan:
 DimensionDataVlan or str
keyword ex_image:
 Filters the node list to nodes that have this image
type ex_image:
 NodeImage or str
keyword ex_deployed:
 Filters the node list to nodes that are deployed or not
type ex_deployed:
 bool
keyword ex_started:
 Filters the node list to nodes that are started or not
type ex_started:
 bool
keyword ex_state:
 Filters the node list by nodes that are in this state
type ex_state:
 str
Parameters:ex_network_domain
Filters the node list to nodes in this
network domain
type ex_network_domain:
 NttCisNetworkDomain or str
return:a list of Node objects
rtype:list of Node
list_sizes(location=None)[source]
return a list of available sizes
Currently, the size of the node is dictated by the chosen OS base image, they cannot be set explicitly.

@inherits: NodeDriver.list_sizes

list_snapshot_windows(location, plan)[source]

List snapshot windows in a given location :param location: a location object or location id such as “NA9” :param plan: ‘ESSENTIALS’ or ‘ADVANCED’ :return: dictionary with keys id, day_of_week, start_hour, availability :rtype: dict

list_snapshots(node, page_size=None)[source]

List snapshots of a server. The list of snapshots can get large. Therefore, page_size is optional to limit this if desired.

Parameters:
  • node (str) – Node nameof the node on which to enable snapshots.
  • page_size – (Optional) Limit the number of records returned

:return snapshots :rtype: list of dictionaries

name = 'NTTC-CIS'
reboot_node(node)[source]

Reboots a node by requesting the OS restart via the hypervisor

Parameters:node (Node) – The node to reboot
Return type:bool
selected_region = None
start_node(node)[source]

Powers on an existing deployed server

Parameters:node (Node) – Node which should be used
Return type:bool
stop_node(node)[source]

This function will attempt to “gracefully” stop a server by initiating a shutdown sequence within the guest operating system. A successful response on this function means the system has successfully passed the request into the operating system.

Parameters:node (Node) – Node which should be used
Return type:bool
type = 'nttcis'
website = 'https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html'

libcloud.compute.drivers.onapp module

class libcloud.compute.drivers.onapp.OnAppNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Base OnApp node driver.

Parameters:
  • key (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

connectionCls

alias of libcloud.common.onapp.OnAppConnection

create_node(name, ex_memory, ex_cpus, ex_cpu_shares, ex_hostname, ex_template_id, ex_primary_disk_size, ex_swap_disk_size, ex_required_virtual_machine_build=1, ex_required_ip_address_assignment=1, **kwargs)[source]

Add a VS

Parameters:kwargs (dict) – All keyword arguments to create a VS
Return type:OnAppNode
delete_key_pair(key)[source]

Delete an existing key pair.

Parameters:key_pair (KeyPair) – Key pair object.
Returns:True on success
Return type:bool
destroy_node(node, ex_convert_last_backup=0, ex_destroy_all_backups=0)[source]

Delete a VS

Parameters:
  • node – OnApp node
  • convert_last_backup (int) – set 1 to convert the last VS’s backup to template, otherwise set 0
  • destroy_all_backups (int) – set 1 to destroy all existing backups of this VS, otherwise set 0
get_key_pair(name)[source]

Retrieve a single key pair.

Parameters:name (str) – ID of the key pair to retrieve.
Return type:KeyPair object
import_key_pair_from_string(name, key_material)[source]

Import a new public key from string.

Parameters:
  • name (str) – Key pair name (unused).
  • key_material (str) – Public key material.
Return type:

KeyPair object

list_images()[source]

List all images

Return type:list of NodeImage
list_key_pairs()[source]

List all the available key pair objects.

Return type:list of KeyPair objects
list_nodes()[source]

List all VS

Return type:list of OnAppNode
name = 'OnApp'
type = 'onapp'
website = 'http://onapp.com/'

libcloud.compute.drivers.opennebula module

OpenNebula.org driver.

class libcloud.compute.drivers.opennebula.ACTION[source]

Bases: object

All actions, except RESUME, only apply when the VM is in the “Running” state.

CANCEL = 'CANCEL'

The VM is forcibly shutdown, its memory state is deleted. If a persistent disk image was used, that disk image is transferred back to the front-end. Any non-persistent disk images are deleted.

DONE = 'DONE'

The VM is forcibly shutdown, its memory state is deleted. If a persistent disk image was used, that disk image is transferred back to the front-end. Any non-persistent disk images are deleted.

REBOOT = 'REBOOT'

Introduced in OpenNebula v3.2.

The VM is gracefully restarted by sending the ACPI signal.

RESUME = 'RESUME'

The VM is resumed using the saved memory state from the checkpoint file, and the VM’s disk image. The VM is either started immediately, or re-scheduled depending on how it was suspended.

SHUTDOWN = 'SHUTDOWN'

The VM is gracefully shutdown by sending the ACPI signal. If the VM does not shutdown, then it is considered to still be running. If successfully, shutdown, its memory state is deleted. If a persistent disk image was used, that disk image is transferred back to the front-end. Any non-persistent disk images are deleted.

STOP = 'STOPPED'

The VM is stopped, and its memory state stored to a checkpoint file. VM state, and disk image, are transferred back to the front-end. Resuming the VM requires the VM instance to be re-scheduled.

SUSPEND = 'SUSPENDED'

The VM is stopped, and its memory state stored to a checkpoint file. The VM state, and disk image, are left on the host to be resumed later. Resuming the VM does not require the VM to be re-scheduled. Rather, after suspending, the VM resources are reserved for later resuming.

class libcloud.compute.drivers.opennebula.OpenNebulaResponse(response, connection)[source]

Bases: libcloud.common.base.XmlResponse

XmlResponse class for the OpenNebula.org driver.

Parameters:
  • response (httplib.HTTPResponse) – HTTP response object. (optional)
  • connection (Connection) – Parent connection object.
parse_error()[source]

Check if response contains any errors.

@raise: InvalidCredsError

Return type:ElementTree
Returns:Contents of HTTP response body.
success()[source]

Check if response has the appropriate HTTP response code to be a success.

Return type:bool
Returns:True is success, else False.
class libcloud.compute.drivers.opennebula.OpenNebulaConnection(*args, **kwargs)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Connection class for the OpenNebula.org driver. with plain_auth support

add_default_headers(headers)[source]

Add headers required by the OpenNebula.org OCCI interface.

Includes adding Basic HTTP Authorization headers for authenticating against the OpenNebula.org OCCI interface.

Parameters:headers (dict) – Dictionary containing HTTP headers.
Return type:dict
Returns:Dictionary containing updated headers.
host = ''
plain_auth = False
port = (4567, 443)
responseCls

alias of OpenNebulaResponse

secure = True
class libcloud.compute.drivers.opennebula.OpenNebulaNodeSize(id, name, ram, disk, bandwidth, price, driver, cpu=None, vcpu=None)[source]

Bases: libcloud.compute.base.NodeSize

NodeSize class for the OpenNebula.org driver.

class libcloud.compute.drivers.opennebula.OpenNebulaNetwork(id, name, address, size, driver, extra=None)[source]

Bases: object

Provide a common interface for handling networks of all types.

Network objects are analogous to physical switches connecting two or more physical nodes together. The Network object provides the interface in libcloud through which we can manipulate networks in different cloud providers in the same way. Network objects don’t actually do much directly themselves, instead the network driver handles the connection to the network.

You don’t normally create a network object yourself; instead you use a driver and then have that create the network for you.

>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver()
>>> network = driver.create_network()
>>> network = driver.list_networks()[0]
>>> network.name
'dummy-1'
get_uuid()[source]

Unique hash for this network.

The hash is a function of an SHA1 hash of the network’s ID and its driver which means that it should be unique between all networks. In some subclasses there is no ID available so the public IP address is used. This means that, unlike a properly done system UUID, the same UUID may mean a different system install at a different time

>>> from libcloud.network.drivers.dummy import DummyNetworkDriver
>>> driver = DummyNetworkDriver()
>>> network = driver.create_network()
>>> network.get_uuid()
'd3748461511d8b9b0e0bfa0d4d3383a619a2bb9f'

Note, for example, that this example will always produce the same UUID!

Return type:str
Returns:Unique identifier for this instance.
class libcloud.compute.drivers.opennebula.OpenNebulaNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

OpenNebula.org node driver.

Parameters:
  • key (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 = {'ACTIVE': running, 'DONE': terminated, 'FAILED': terminated, 'HOLD': pending, 'INIT': pending, 'PENDING': pending, 'STOPPED': terminated, 'SUSPENDED': pending}
connectionCls

alias of OpenNebulaConnection

create_node(name, size, image, networks=None)[source]

Create a new OpenNebula node.

@inherits: NodeDriver.create_node

Parameters:networks (OpenNebulaNetwork or list of OpenNebulaNetwork) – List of virtual networks to which this node should connect. (optional)
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_list_networks(location=None)[source]

List virtual networks on a provider.

Parameters:location (NodeLocation) – Location from which to request a list of virtual networks. (optional)
Returns:List of virtual networks available to be connected to a compute node.
Return type:list of OpenNebulaNetwork
ex_node_action(node, action)[source]

Build action representation and instruct node to commit action.

Build action representation from the compute node ID, and the action which should be carried out on that compute node. Then instruct the node to carry out that action.

Parameters:
  • node (Node) – Compute node instance.
  • action (str) – Action to be carried out on the compute node.
Returns:

False if an HTTP Bad Request is received, else, True is returned.

Return type:

bool

list_images(location=None)[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 of NodeImage
list_locations()[source]

List data centers for a provider

Returns:list of node location objects
Return type:list of NodeLocation
list_nodes()[source]

List all nodes.

Returns:list of node objects
Return type:list of Node
list_sizes(location=None)[source]

Return list of sizes on a provider.

@inherits: NodeDriver.list_sizes

Returns:List of compute node sizes supported by the cloud provider.
Return type:list of OpenNebulaNodeSize
name = 'OpenNebula'
type = 'opennebula'
website = 'http://opennebula.org/'
class libcloud.compute.drivers.opennebula.OpenNebula_1_4_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.opennebula.OpenNebulaNodeDriver

OpenNebula.org node driver for OpenNebula.org v1.4.

Parameters:
  • key (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

name = 'OpenNebula (v1.4)'
class libcloud.compute.drivers.opennebula.OpenNebula_2_0_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.opennebula.OpenNebulaNodeDriver

OpenNebula.org node driver for OpenNebula.org v2.0 through OpenNebula.org v2.2.

Parameters:
  • key (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

create_node(name, size, image, networks=None, context=None)[source]

Create a new OpenNebula node.

@inherits: NodeDriver.create_node

Parameters:
  • networks (OpenNebulaNetwork or list of OpenNebulaNetwork) – List of virtual networks to which this node should connect. (optional)
  • context (dict) – Custom (key, value) pairs to be injected into compute node XML description. (optional)
Returns:

Instance of a newly created node.

Return type:

Node

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
list_sizes(location=None)[source]

Return list of sizes on a provider.

@inherits: NodeDriver.list_sizes

Returns:List of compute node sizes supported by the cloud provider.
Return type:list of OpenNebulaNodeSize
name = 'OpenNebula (v2.0 - v2.2)'
class libcloud.compute.drivers.opennebula.OpenNebula_3_0_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.opennebula.OpenNebula_2_0_NodeDriver

OpenNebula.org node driver for OpenNebula.org v3.0.

Parameters:
  • key (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

ex_node_set_save_name(node, name)[source]

Build action representation and instruct node to commit action.

Build action representation from the compute node ID, the disk image which will be saved, and the name under which the image will be saved upon shutting down the compute node.

Parameters:
  • node (Node) – Compute node instance.
  • name (str) – Name under which the image should be saved after shutting down the compute node.
Returns:

False if an HTTP Bad Request is received, else, True is returned.

Return type:

bool

name = 'OpenNebula (v3.0)'
class libcloud.compute.drivers.opennebula.OpenNebula_3_2_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.opennebula.OpenNebula_3_0_NodeDriver

OpenNebula.org node driver for OpenNebula.org v3.2.

Parameters:
  • key (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

list_sizes(location=None)[source]

Return list of sizes on a provider.

@inherits: NodeDriver.list_sizes

Returns:List of compute node sizes supported by the cloud provider.
Return type:list of OpenNebulaNodeSize
name = 'OpenNebula (v3.2)'
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
class libcloud.compute.drivers.opennebula.OpenNebula_3_8_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.opennebula.OpenNebula_3_6_NodeDriver

OpenNebula.org node driver for OpenNebula.org v3.8.

Parameters:
  • key (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

name = 'OpenNebula (v3.8)'
plain_auth = False

libcloud.compute.drivers.openstack module

OpenStack driver

class libcloud.compute.drivers.openstack.OpenStack_1_0_Response(*args, **kwargs)[source]

Bases: libcloud.common.openstack.OpenStackResponse

class libcloud.compute.drivers.openstack.OpenStack_1_0_Connection(user_id, key, secure=True, host=None, port=None, timeout=None, proxy_url=None, ex_force_base_url=None, ex_force_auth_url=None, ex_force_auth_version=None, ex_force_auth_token=None, ex_token_scope='project', ex_domain_name='Default', ex_tenant_name=None, ex_tenant_domain_id='default', ex_force_service_type=None, ex_force_service_name=None, ex_force_service_region=None, ex_force_microversion=None, ex_auth_cache=None, retry_delay=None, backoff=None)[source]

Bases: libcloud.compute.drivers.openstack.OpenStackComputeConnection

XML_NAMESPACE = 'http://docs.rackspacecloud.com/servers/api/v1.0'
accept_format = 'application/xml'
default_content_type = 'application/xml; charset=UTF-8'
responseCls

alias of OpenStack_1_0_Response

class libcloud.compute.drivers.openstack.OpenStack_1_0_NodeDriver(*args, **kwargs)[source]

Bases: libcloud.compute.drivers.openstack.OpenStackNodeDriver

OpenStack node driver.

Extra node attributes:
  • password: root password, available after create.
  • hostId: represents the host your cloud server runs on
  • imageId: id of image
  • flavorId: id of flavor
connectionCls

alias of OpenStack_1_0_Connection

create_image(node, name, description=None, reboot=True)[source]

Create an image for node.

@inherits: NodeDriver.create_image

Parameters:
  • node (Node) – node to use as a base for image
  • name (str) – name for new image
Return type:

NodeImage

create_node(name, size, image, ex_metadata=None, ex_files=None, ex_shared_ip_group=None, ex_shared_ip_group_id=None)[source]

Create a new node

@inherits: NodeDriver.create_node

Parameters:
  • ex_metadata (dict) – Key/Value metadata to associate with a node
  • ex_files (dict) – File Path => File contents to create on the node
  • ex_shared_ip_group_id (str) – The server is launched into that shared IP group
delete_image(image)[source]

Delete an image for node.

@inherits: NodeDriver.delete_image

Parameters:image (NodeImage) – the image to be deleted
Return type:bool
ex_confirm_resize(node)[source]

Confirm a resize request which is currently in progress. If a resize request is not explicitly confirmed or reverted it’s automatically confirmed after 24 hours.

For more info refer to the API documentation: http://goo.gl/zjFI1

Parameters:node (Node) – node for which the resize request will be confirmed.
Return type:bool
ex_create_ip_group(group_name, node_id=None)[source]

Creates a shared IP group.

Parameters:
  • group_name (str) – group name which should be used
  • node_id (str) – ID of the node which should be used
Return type:

bool

ex_delete_ip_group(group_id)[source]

Deletes the specified shared IP group.

Parameters:group_id (str) – group id which should be used
Return type:bool
ex_limits()[source]

Extra call to get account’s limits, such as rates (for example amount of POST requests per day) and absolute limits like total amount of available RAM to be used by servers.

Returns:dict with keys ‘rate’ and ‘absolute’
Return type:dict
ex_list_ip_addresses(node_id)[source]

List all server addresses.

Parameters:node_id (str) – ID of the node which should be used
Return type:OpenStack_1_0_NodeIpAddresses
ex_list_ip_groups(details=False)[source]

Lists IDs and names for shared IP groups. If details lists all details for shared IP groups.

Parameters:details (bool) – True if details is required
Return type:list of OpenStack_1_0_SharedIpGroup
ex_rebuild(node_id, image_id)[source]

Rebuilds the specified server.

Parameters:
  • node_id (str) – ID of the node which should be used
  • image_id (str) – ID of the image which should be used
Return type:

bool

ex_resize(node, size)[source]

NOTE: This method is here for backward compatibility reasons.

You should use ex_resize_node instead.

ex_resize_node(node, size)[source]

Change an existing server flavor / scale the server up or down.

Parameters:
  • node (Node) – node to resize.
  • size (NodeSize) – new size.
Return type:

bool

ex_revert_resize(node)[source]

Revert a resize request which is currently in progress. All resizes are automatically confirmed after 24 hours if they have not already been confirmed explicitly or reverted.

For more info refer to the API documentation: http://goo.gl/AizBu

Parameters:node (Node) – node for which the resize request will be reverted.
Return type:bool
ex_set_password(node, password)[source]

Sets the Node’s root password.

This will reboot the instance to complete the operation.

Node.extra['password'] will be set to the new value if the operation was successful.

Parameters:
  • node (Node) – node to set password
  • password (str) – new password.
Return type:

bool

ex_set_server_name(node, name)[source]

Sets the Node’s name.

This will reboot the instance to complete the operation.

Parameters:
  • node (Node) – node to set name
  • name (str) – new name
Return type:

bool

ex_share_ip(group_id, node_id, ip, configure_node=True)[source]

Shares an IP address to the specified server.

Parameters:
  • group_id (str) – group id which should be used
  • node_id (str) – ID of the node which should be used
  • ip (str) – ip which should be used
  • configure_node (bool) – configure node
Return type:

bool

ex_unshare_ip(node_id, ip)[source]

Removes a shared IP address from the specified server.

Parameters:
  • node_id (str) – ID of the node which should be used
  • ip (str) – ip which should be used
Return type:

bool

features = {'create_node': ['generates_password']}
type = 'openstack'
class libcloud.compute.drivers.openstack.OpenStack_1_0_SharedIpGroup(id, name, servers=None)[source]

Bases: object

Shared IP group info.

class libcloud.compute.drivers.openstack.OpenStack_1_0_NodeIpAddresses(public_addresses, private_addresses)[source]

Bases: object

List of public and private IP addresses of a Node.

class libcloud.compute.drivers.openstack.OpenStack_1_1_Response(*args, **kwargs)[source]

Bases: libcloud.common.openstack.OpenStackResponse

class libcloud.compute.drivers.openstack.OpenStack_1_1_Connection(user_id, key, secure=True, host=None, port=None, timeout=None, proxy_url=None, ex_force_base_url=None, ex_force_auth_url=None, ex_force_auth_version=None, ex_force_auth_token=None, ex_token_scope='project', ex_domain_name='Default', ex_tenant_name=None, ex_tenant_domain_id='default', ex_force_service_type=None, ex_force_service_name=None, ex_force_service_region=None, ex_force_microversion=None, ex_auth_cache=None, retry_delay=None, backoff=None)[source]

Bases: libcloud.compute.drivers.openstack.OpenStackComputeConnection

accept_format = 'application/json'
default_content_type = 'application/json; charset=UTF-8'
encode_data(data)[source]

Encode body data.

Override in a provider’s subclass.

responseCls

alias of OpenStack_1_1_Response

class libcloud.compute.drivers.openstack.OpenStack_1_1_NodeDriver(*args, **kwargs)[source]

Bases: libcloud.compute.drivers.openstack.OpenStackNodeDriver

OpenStack node driver.

connectionCls

alias of OpenStack_1_1_Connection

create_image(node, name, metadata=None)[source]

Creates a new image.

Parameters:
  • node (Node) – Node
  • name (str) – The name for the new image.
  • metadata (dict) – Key and value pairs for metadata.
Return type:

NodeImage

create_key_pair(name)[source]

Create a new key pair object.

Parameters:name (str) – Key pair name.
Return type:KeyPair object
create_node(name, size, image=None, ex_keyname=None, ex_userdata=None, ex_config_drive=None, ex_security_groups=None, ex_metadata=None, ex_files=None, networks=None, ex_disk_config=None, ex_admin_pass=None, ex_availability_zone=None, ex_blockdevicemappings=None, ex_os_scheduler_hints=None)[source]

Create a new node

@inherits: NodeDriver.create_node

Parameters:
  • ex_keyname (str) – The name of the key pair
  • ex_userdata (str) – String containing user data see https://help.ubuntu.com/community/CloudInit
  • ex_config_drive (bool) – Enable config drive see http://docs.openstack.org/grizzly/openstack-compute/admin/content/config-drive.html
  • ex_security_groups (list of OpenStackSecurityGroup) – List of security groups to assign to the node
  • ex_metadata (dict) – Key/Value metadata to associate with a node
  • ex_files (dict) – File Path => File contents to create on the node
  • networks (list of OpenStackNetwork) – The server is launched into a set of Networks.
  • ex_disk_config (str) – Name of the disk configuration. Can be either AUTO or MANUAL.
  • ex_config_drive – If True enables metadata injection in a server through a configuration drive.
  • ex_admin_pass (str) – The root password for the node
  • ex_availability_zone (str) – Nova availability zone for the node
  • ex_blockdevicemappings (dict) – Enables fine grained control of the block device mapping for an instance.
  • ex_os_scheduler_hints (dict) – The dictionary of data to send to the scheduler.
create_volume_snapshot(volume, name=None, ex_description=None, ex_force=True)[source]

Create snapshot from volume

Parameters:
  • volume (StorageVolume) – Instance of StorageVolume
  • name (str | NoneType) – Name of snapshot (optional)
  • ex_description (str | NoneType) – Description of the snapshot (optional)
  • ex_force (bool) – Specifies if we create a snapshot that is not in state available. For example in-use. Defaults to True. (optional)
Return type:

VolumeSnapshot

delete_image(image)[source]

Delete a NodeImage

@inherits: NodeDriver.delete_image

Parameters:image (NodeImage) – image witch should be used
Return type:bool
delete_key_pair(key_pair)[source]

Delete a KeyPair.

Parameters:keypair (OpenStackKeyPair) – KeyPair to delete
Return type:bool
destroy_volume_snapshot(snapshot)[source]

Destroys a snapshot.

Parameters:snapshot (VolumeSnapshot) – The snapshot to delete
Return type:bool
ex_attach_floating_ip_to_node(node, ip)[source]

Attach the floating IP to the node

Parameters:
Return type:

bool

ex_confirm_resize(node)[source]

Confirms a pending resize action.

Parameters:node (Node) – Node to resize.
Return type:bool
ex_create_floating_ip(ip_pool=None)[source]

Create new floating IP. The ip_pool attribute is optional only if your infrastructure has only one IP pool available.

Parameters:ip_pool (str) – name of the floating IP pool
Return type:OpenStack_1_1_FloatingIpAddress
ex_create_keypair(name)[source]

Create a new KeyPair

Parameters:name (str) – Name of the new KeyPair
Return type:OpenStackKeyPair
ex_create_network(name, cidr)[source]

Create a new Network

Parameters:
  • name (str) – Name of network which should be used
  • cidr (str) – cidr of network which should be used
Return type:

OpenStackNetwork

ex_create_security_group(name, description)[source]

Create a new Security Group

Parameters:
  • name (str) – Name of the new Security Group
  • description (str) – Description of the new Security Group
Return type:

OpenStackSecurityGroup

ex_create_security_group_rule(security_group, ip_protocol, from_port, to_port, cidr=None, source_security_group=None)[source]

Create a new Rule in a Security Group

Parameters:
  • security_group (OpenStackSecurityGroup) – Security Group in which to add the rule
  • ip_protocol (str) – Protocol to which this rule applies Examples: tcp, udp, …
  • from_port (int) – First port of the port range
  • to_port (int) – Last port of the port range
  • cidr (str) – CIDR notation of the source IP range for this rule
  • source_security_group (L{OpenStackSecurityGroup) – Existing Security Group to use as the source (instead of CIDR)
Return type:

OpenStackSecurityGroupRule

ex_create_snapshot(volume, name, description=None, force=False)[source]

Create a snapshot based off of a volume.

Parameters:
  • volume (StorageVolume) – volume
  • name (str) – New name for the volume snapshot
  • description (str) – Description of the snapshot (optional)
  • force (bool) – Whether to force creation (optional)
Return type:

VolumeSnapshot

ex_delete_floating_ip(ip)[source]

Delete specified floating IP

Parameters:ip (OpenStack_1_1_FloatingIpAddress) – floating IP to remove
Return type:bool
ex_delete_keypair(keypair)[source]

Delete a KeyPair.

Parameters:keypair (OpenStackKeyPair) – KeyPair to delete
Return type:bool
ex_delete_network(network)[source]

Delete a Network

Parameters:network (OpenStackNetwork) – Network which should be used
Return type:bool
ex_delete_security_group(security_group)[source]

Delete a Security Group.

Parameters:security_group (OpenStackSecurityGroup) – Security Group should be deleted
Return type:bool
ex_delete_security_group_rule(rule)[source]

Delete a Rule from a Security Group.

Parameters:rule (OpenStackSecurityGroupRule) – Rule should be deleted
Return type:bool
ex_delete_snapshot(snapshot)[source]

Delete a VolumeSnapshot

Parameters:snapshot (VolumeSnapshot) – snapshot
Return type:bool
ex_detach_floating_ip_from_node(node, ip)[source]

Detach the floating IP from the node

Parameters:
Return type:

bool

ex_get_console_output(node, length=None)[source]

Get console output

Parameters:
  • node (Node) – node
  • length (int) – Optional number of lines to fetch from the console log
Returns:

Dictionary with the output

Return type:

dict

ex_get_floating_ip(ip)[source]

Get specified floating IP

Parameters:ip (str) – floating IP to get
Return type:OpenStack_1_1_FloatingIpAddress
ex_get_metadata(node)[source]

Get a Node’s metadata.

Parameters:node (Node) – Node
Returns:Key/Value metadata associated with node.
Return type:dict
ex_get_metadata_for_node(node)[source]

Return the metadata associated with the node.

Parameters:node (Node) – Node instance
Returns:A dictionary or other mapping of strings to strings, associating tag names with tag values.
ex_get_network(network_id)[source]

Retrieve the Network with the given ID

Parameters:networkId (str) – ID of the network

:rtype OpenStackNetwork

ex_get_node_security_groups(node)[source]

Get Security Groups of the specified server.

Return type:list of OpenStackSecurityGroup
ex_get_size(size_id)[source]

Get a NodeSize

Parameters:size_id (str) – ID of the size which should be used
Return type:NodeSize
ex_get_size_extra_specs(size_id)[source]

Get the extra_specs field of a NodeSize

Parameters:size_id (str) – ID of the size which should be used
Return type:dict
ex_get_snapshot(snapshotId)[source]
ex_import_keypair(name, keyfile)[source]

Import a KeyPair from a file

Parameters:
  • name (str) – Name of the new KeyPair
  • keyfile (str) – Path to the public key file (in OpenSSH format)
Return type:

OpenStackKeyPair

ex_import_keypair_from_string(name, key_material)[source]

Import a KeyPair from a string

Parameters:
  • name (str) – Name of the new KeyPair
  • key_material (str) – Public key (in OpenSSH format)
Return type:

OpenStackKeyPair

ex_list_floating_ip_pools()[source]

List available floating IP pools

Return type:list of OpenStack_1_1_FloatingIpPool
ex_list_floating_ips()[source]

List floating IPs

Return type:list of OpenStack_1_1_FloatingIpAddress
ex_list_keypairs()[source]

Get a list of KeyPairs that are available.

Return type:list of OpenStackKeyPair
ex_list_networks()[source]

Get a list of Networks that are available.

Return type:list of OpenStackNetwork
ex_list_security_groups()[source]

Get a list of Security Groups that are available.

Return type:list of OpenStackSecurityGroup
ex_list_snapshots()[source]
ex_pause_node(node)[source]
ex_rebuild(node, image, **kwargs)[source]

Rebuild a Node.

Parameters:
  • node (Node) – Node to rebuild.
  • image (NodeImage) – New image to use.
  • ex_metadata (dict) – Key/Value metadata to associate with a node
  • ex_files (dict) – File Path => File contents to create on the node
  • ex_keyname (str) – Name of existing public key to inject into instance
  • ex_userdata (str) – String containing user data see https://help.ubuntu.com/community/CloudInit
  • ex_security_groups (list of OpenStackSecurityGroup) – List of security groups to assign to the node
  • ex_disk_config (str) – Name of the disk configuration. Can be either AUTO or MANUAL.
  • ex_config_drive (bool) – If True enables metadata injection in a server through a configuration drive.
Return type:

bool

ex_rescue(node, password=None)[source]

Rescue a node

Parameters:
  • node (Node) – node
  • password (str) – password
Return type:

Node

ex_resize(node, size)[source]

Change a node size.

Parameters:
  • node (Node) – Node to resize.
  • size (NodeSize) – New size to use.
Return type:

bool

ex_resume_node(node)[source]
ex_revert_resize(node)[source]

Cancels and reverts a pending resize action.

Parameters:node (Node) – Node to resize.
Return type:bool
ex_set_metadata(node, metadata)[source]

Sets the Node’s metadata.

Parameters:
  • node (Node) – Node
  • metadata (dict) – Key/Value metadata to associate with a node
Return type:

dict

ex_set_password(node, password)[source]

Changes the administrator password for a specified server.

Parameters:
  • node (Node) – Node to rebuild.
  • password (str) – The administrator password.
Return type:

bool

ex_set_server_name(node, name)[source]

Sets the Node’s name.

Parameters:
  • node (Node) – Node
  • name (str) – The name of the server.
Return type:

Node

ex_start_node(node)[source]
ex_stop_node(node)[source]
ex_suspend_node(node)[source]
ex_unpause_node(node)[source]
ex_unrescue(node)[source]

Unrescue a node

Parameters:node (Node) – node
Return type:bool
ex_update_node(node, **node_updates)[source]

Update the Node’s editable attributes. The OpenStack API currently supports editing name and IPv4/IPv6 access addresses.

The driver currently only supports updating the node name.

Parameters:
  • node (Node) – Node
  • name (str) – New name for the server
Return type:

Node

features = {'create_node': ['generates_password']}
get_image(image_id)[source]

Get a NodeImage

@inherits: NodeDriver.get_image

Parameters:image_id (str) – ID of the image which should be used
Return type:NodeImage
get_key_pair(name)[source]

Retrieve a single key pair.

Parameters:name (str) – Name of the key pair to retrieve.
Return type:KeyPair
import_key_pair_from_string(name, key_material)[source]

Import a new public key from string.

Parameters:
  • name (str) – Key pair name.
  • key_material (str) – Public key material.
Return type:

KeyPair object

list_key_pairs()[source]

List all the available key pair objects.

Return type:list of KeyPair objects
list_volume_snapshots(volume)[source]

List snapshots for a storage volume.

Return type:list of VolumeSnapshot
type = 'openstack'
class libcloud.compute.drivers.openstack.OpenStack_1_1_FloatingIpPool(name, connection)[source]

Bases: object

Floating IP Pool info.

create_floating_ip()[source]

Create new floating IP in the pool

Return type:OpenStack_1_1_FloatingIpAddress
delete_floating_ip(ip)[source]

Delete specified floating IP from the pool

Parameters:ip (OpenStack_1_1_FloatingIpAddress) – floating IP to remove
Return type:bool
get_floating_ip(ip)[source]

Get specified floating IP from the pool

Parameters:ip (str) – floating IP to get
Return type:OpenStack_1_1_FloatingIpAddress
list_floating_ips()[source]

List floating IPs in the pool

Return type:list of OpenStack_1_1_FloatingIpAddress
class libcloud.compute.drivers.openstack.OpenStack_2_FloatingIpPool(id, name, connection)[source]

Bases: object

Floating IP Pool info.

create_floating_ip()[source]

Create new floating IP in the pool

Return type:OpenStack_2_FloatingIpAddress
delete_floating_ip(ip)[source]

Delete specified floating IP from the pool

Parameters:ip (OpenStack_1_1_FloatingIpAddress) – floating IP to remove
Return type:bool
get_floating_ip(ip)[source]

Get specified floating IP from the pool

Parameters:ip (str) – floating IP to get
Return type:OpenStack_2_FloatingIpAddress
list_floating_ips()[source]

List floating IPs in the pool

Return type:list of OpenStack_2_FloatingIpAddress
class libcloud.compute.drivers.openstack.OpenStack_1_1_FloatingIpAddress(id, ip_address, pool, node_id=None, driver=None)[source]

Bases: object

Floating IP info.

delete()[source]

Delete this floating IP

Return type:bool
class libcloud.compute.drivers.openstack.OpenStack_2_FloatingIpAddress(id, ip_address, pool, node_id=None, driver=None, extra=None)[source]

Bases: libcloud.compute.drivers.openstack.OpenStack_1_1_FloatingIpAddress

Floating IP info 2.0.

get_node_id()[source]
get_pool()[source]
class libcloud.compute.drivers.openstack.OpenStack_2_PortInterfaceState[source]

Bases: libcloud.common.types.Type

Standard states of OpenStack_2_PortInterfaceState

ACTIVE = 'active'
BUILD = 'build'
DOWN = 'down'
UNKNOWN = 'unknown'
class libcloud.compute.drivers.openstack.OpenStack_2_PortInterface(id, state, driver, created=None, extra=None)[source]

Bases: libcloud.compute.base.UuidMixin

Port Interface info. Similar in functionality to a floating IP (can be attached / detached from a compute instance) but implementation-wise a bit different.

> A port is a connection point for attaching a single device, such as the > NIC of a server, to a network. The port also describes the associated > network configuration, such as the MAC and IP addresses to be used on > that port. https://docs.openstack.org/python-openstackclient/pike/cli/command-objects/port.html

Also see: https://developer.openstack.org/api-ref/compute/#port-interfaces-servers-os-interface

Parameters:
  • id (str) – Port Interface ID.
  • state (OpenStack_2_PortInterfaceState) – State of the OpenStack_2_PortInterface.
  • created (datetime.datetime) – A datetime object that represents when the port interface was created
  • extra (dict) – Optional provided specific attributes associated with this image.
delete()[source]

Delete this Port Interface

Return type:bool
class libcloud.compute.drivers.openstack.OpenStackNodeDriver(*args, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver, libcloud.common.openstack.OpenStackDriverMixin

Base OpenStack node driver. Should not be used directly.

NODE_STATE_MAP = {'ACTIVE': running, 'BUILD': pending, 'DELETED': terminated, 'DELETE_IP': pending, 'ERROR': error, 'HARD_REBOOT': rebooting, 'PASSWORD': pending, 'PREP_RESIZE': pending, 'QUEUE_RESIZE': pending, 'REBOOT': rebooting, 'REBUILD': pending, 'RESCUE': pending, 'RESIZE': reconfiguring, 'SHARE_IP': pending, 'SHARE_IP_NO_CONFIG': pending, 'SHUTOFF': stopped, 'SUSPENDED': suspended, 'UNKNOWN': unknown, 'VERIFY_RESIZE': running}
SNAPSHOT_STATE_MAP = {'available': available, 'creating': creating, 'deleting': deleting, 'error': error, 'error_restoring': error, 'restoring': restoring}
VOLUME_STATE_MAP = {'attaching': attaching, 'available': available, 'backing-up': backup, 'creating': creating, 'deleting': deleting, 'error': error, 'error_deleting': error, 'error_extending': error, 'error_restoring': error, 'in-use': inuse, 'restoring-backup': backup}
api_name = 'openstack'
attach_volume(node, volume, device='auto')[source]

Attaches volume to node.

Parameters:
  • node (Node) – Node to attach volume to.
  • volume (StorageVolume) – Volume to attach.
  • device (str) – Where the device is exposed, e.g. ‘/dev/sdb’
Rytpe:

bool

create_volume(size, name, location=None, snapshot=None, ex_volume_type=None)[source]

Create a new volume.

Parameters:
  • size (int) – Size of volume in gigabytes (required)
  • name (str) – Name of the volume to be created
  • location (NodeLocation) – Which data center to create a volume in. If empty, undefined behavior will be selected. (optional)
  • snapshot (VolumeSnapshot) – Snapshot from which to create the new volume. (optional)
  • ex_volume_type (str) – What kind of volume to create. (optional)
Returns:

The newly created volume.

Return type:

StorageVolume

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
destroy_volume(volume)[source]

Destroys a storage volume.

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
detach_volume(volume, ex_node=None)[source]

Detaches a volume from a node.

Parameters:volume (StorageVolume) – Volume to be detached
Return type:bool
ex_get_node_details(node_id)[source]

Lists details of the specified server.

Parameters:node_id (str) – ID of the node which should be used
Return type:Node
ex_get_volume(volumeId)[source]
ex_hard_reboot_node(node)[source]

Hard reboots the specified server

Parameters:node (Node) – node
Return type:bool
ex_soft_reboot_node(node)[source]

Soft reboots the specified server

Parameters:node (Node) – node
Return type:bool
get_image(image_id)[source]

Get an image based on an image_id

@inherits: NodeDriver.get_image

Parameters:image_id (str) – Image identifier
Returns:A NodeImage object
Return type:NodeImage
list_images(location=None, ex_only_active=True)[source]

Lists all active images

@inherits: NodeDriver.list_images

Parameters:ex_only_active (bool) – True if list only active (optional)
list_locations()[source]

List data centers for a provider

Returns:list of node location objects
Return type:list of NodeLocation
list_nodes(ex_all_tenants=False)[source]

List the nodes in a tenant

Parameters:ex_all_tenants (bool) – List nodes for all the tenants. Note: Your user must have admin privileges for this functionality to work.
list_sizes(location=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 of NodeSize
list_volumes()[source]

List storage volumes.

Return type:list of StorageVolume
name = 'OpenStack'
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
stop_node(node)[source]

Stop a node

Parameters:node (Node) – The node to be stopped.
Returns:True if the stop was successful, otherwise False
Return type:bool
website = 'http://openstack.org/'

libcloud.compute.drivers.outscale module

Outscale SDK

class libcloud.compute.drivers.outscale.OutscaleNodeDriver(key: str = None, secret: str = None, region: str = 'eu-west-2', service: str = 'api', version: str = 'latest', base_uri: str = 'outscale.com')[source]

Bases: libcloud.compute.base.NodeDriver

Outscale SDK node driver

attach_volume(node: libcloud.compute.base.Node, volume: libcloud.compute.base.StorageVolume, device: str = None)[source]

Attach a volume to a node.

Parameters:
  • node (Node) – the ID of the VM you want to attach the volume to (required)
  • volume (StorageVolume) – the ID of the volume you want to attach (required)
  • device (str) – the name of the device (required)
Returns:

the attached volume

Return type:

dict

create_image(ex_architecture: str = None, node: libcloud.compute.base.Node = None, name: str = None, description: str = None, ex_block_device_mapping: dict = None, ex_no_reboot: bool = False, ex_root_device_name: str = None, ex_dry_run: bool = False, ex_source_region_name: str = None, ex_file_location: str = None)[source]

Create a new image.

Parameters:
  • node (str) – a valid Node object
  • ex_architecture – The architecture of the OMI (by default,

i386). :type ex_architecture: str

Parameters:
  • description (str) – a description for the new OMI
  • name (str) – A unique name for the new OMI.
  • ex_block_device_mapping (dict) – One or more block device mappings.
  • ex_no_reboot – If false, the VM shuts down before creating

the OMI and then reboots. If true, the VM does not. :type ex_no_reboot: bool

Parameters:
  • ex_root_device_name (str) – The name of the root device.
  • ex_source_region_name – The name of the source Region,

which must be the same as the Region of your account. :type ex_source_region_name: str

Parameters:ex_file_location – The pre-signed URL of the OMI manifest

file, or the full path to the OMI stored in an OSU bucket. If you specify this parameter, a copy of the OMI is created in your account. :type ex_file_location: str

Parameters:ex_dry_run – If true, checks whether you have the required

permissions to perform the action. :type ex_dry_run: bool

Returns:the created image
Return type:dict
create_key_pair(name: str, ex_dry_run: bool = False, ex_public_key: str = None)[source]

Create a new key pair.

Parameters:name – A unique name for the keypair, with a maximum

length of 255 ASCII printable characters. :type name: str

Parameters:ex_dry_run – If true, checks whether you have the required

permissions to perform the action. :type ex_dry_run: bool

Parameters:ex_public_key (str) – The public key. It must be base64-encoded.
Returns:the created key pair
Return type:dict
create_node(image: libcloud.compute.base.NodeImage, name: str = None, ex_dry_run: bool = False, ex_block_device_mapping: dict = None, ex_boot_on_creation: bool = True, ex_bsu_optimized: bool = True, ex_client_token: str = None, ex_deletion_protection: bool = False, ex_keypair_name: str = None, ex_max_vms_count: int = None, ex_min_vms_count: int = None, ex_nics: List[dict] = None, ex_performance: str = None, ex_placement: dict = None, ex_private_ips: List[str] = None, ex_security_group_ids: List[str] = None, ex_security_groups: List[str] = None, ex_subnet_id: str = None, ex_user_data: str = None, ex_vm_initiated_shutdown_behavior: str = None, ex_vm_type: str = None)[source]

Create a new instance.

Parameters:
  • image (NodeImage) – The image used to create the VM.
  • name (str) – The name of the Node.
  • ex_dry_run – If true, checks whether you have the required

permissions to perform the action. :type ex_dry_run: bool

Parameters:
  • ex_block_device_mapping (dict) – One or more block device mappings.
  • ex_boot_on_creation – By default or if true, the VM is

started on creation. If false, the VM is stopped on creation. :type ex_boot_on_creation: bool

Parameters:ex_bsu_optimized – If true, the VM is created with optimized

BSU I/O. :type ex_bsu_optimized: bool

Parameters:ex_client_token – A unique identifier which enables you to

manage the idempotency. :type ex_client_token: bool

Parameters:ex_deletion_protection – If true, you cannot terminate the

VM using Cockpit, the CLI or the API. If false, you can. :type ex_deletion_protection: bool

Parameters:
  • ex_keypair_name (str) – The name of the keypair.
  • ex_max_vms_count – The maximum number of VMs you want to

create. If all the VMs cannot be created, the largest possible number of VMs above MinVmsCount is created. :type ex_max_vms_count: integer

Parameters:ex_min_vms_count – The minimum number of VMs you want to

create. If this number of VMs cannot be created, no VMs are created. :type ex_min_vms_count: integer

Parameters:ex_nics – One or more NICs. If you specify this parameter,

you must define one NIC as the primary network interface of the VM with 0 as its device number. :type ex_nics: list of dict

Parameters:ex_performance – The performance of the VM (standard | high
highest).
Parameters:
  • ex_placement (dict) – Information about the placement of the VM.
  • ex_private_ips (list) – One or more private IP addresses of the VM.
  • ex_security_group_ids – One or more IDs of security group

for the VMs. :type ex_security_group_ids: list

Parameters:ex_security_groups – One or more names of security groups

for the VMs. :type ex_security_groups: list

Parameters:ex_subnet_id – The ID of the Subnet in which you want to

create the VM. :type ex_subnet_id: str

Parameters:ex_user_data – Data or script used to add a specific

configuration to the VM. It must be base64-encoded. :type ex_user_data: str

Parameters:ex_vm_initiated_shutdown_behavior – The VM behavior when

you stop it. By default or if set to stop, the VM stops. If set to restart, the VM stops then automatically restarts. If set to terminate, the VM stops and is terminated. create the VM. :type ex_vm_initiated_shutdown_behavior: str

Parameters:ex_vm_type (str) – The type of VM (t2.small by default).
Returns:the created instance
Return type:dict
create_volume(ex_subregion_name: str, ex_dry_run: bool = False, ex_iops: int = None, size: int = None, snapshot: libcloud.compute.base.VolumeSnapshot = None, ex_volume_type: str = None)[source]

Create a new volume.

Parameters:
  • snapshot (str) – the ID of the snapshot from which you want to create the volume (required)
  • ex_dry_run – If true, checks whether you have the required

permissions to perform the action. :type ex_dry_run: bool

Parameters:
  • size (int) – the size of the volume, in gibibytes (GiB), the maximum allowed size for a volume is 14,901 GiB
  • ex_subregion_name – The Subregion in which you want to

create the volume. :type ex_subregion_name: str

Parameters:ex_volume_type – the type of volume you want to create (io1
gp2 | standard)
Parameters:ex_iops – The number of I/O operations per second (IOPS).

This parameter must be specified only if you create an io1 volume. The maximum number of IOPS allowed for io1 volumes is 13000. :type ex_iops: integer

Returns:the created volume
Return type:dict
create_volume_snapshot(ex_description: str = None, ex_dry_run: bool = False, ex_file_location: str = None, ex_snapshot_size: int = None, ex_source_region_name: str = None, ex_source_snapshot: libcloud.compute.base.VolumeSnapshot = None, volume: libcloud.compute.base.StorageVolume = None)[source]

Create a new volume snapshot.

Parameters:
  • ex_description (str) – a description for the new OMI
  • ex_snapshot_size – The size of the snapshot created in your

account, in bytes. This size must be exactly the same as the source snapshot one. :type ex_snapshot_size: integer

Parameters:ex_source_snapshot – The ID of the snapshot you want to

copy. :type ex_source_snapshot: str

Parameters:volume – The ID of the volume you want to create a

snapshot of. :type volume: str

Parameters:ex_source_region_name – The name of the source Region,

which must be the same as the Region of your account. :type ex_source_region_name: str

Parameters:ex_file_location – The pre-signed URL of the OMI manifest

file, or the full path to the OMI stored in an OSU bucket. If you specify this parameter, a copy of the OMI is created in your account. :type ex_file_location: str

Parameters:ex_dry_run – If true, checks whether you have the required

permissions to perform the action. :type ex_dry_run: bool

Returns:the created snapshot
Return type:dict
delete_image(node_image: libcloud.compute.base.NodeImage)[source]

Delete an image.

Parameters:node_image (str) – the ID of the OMI you want to delete (required)
Returns:request
Return type:bool
delete_key_pair(key_pair: libcloud.compute.base.KeyPair)[source]

Delete a key pair.

Parameters:key_pair – the name of the keypair

you want to delete (required) :type key_pair: KeyPair

Returns:bool
Return type:bool
destroy_node(node: libcloud.compute.base.Node)[source]

Delete instance.

Parameters:node (Node) – one or more IDs of VMs (required)
Returns:request
Return type:bool
destroy_volume(volume: libcloud.compute.base.StorageVolume)[source]

Delete a volume.

Parameters:volume (StorageVolume) – the ID of the volume you want to delete (required)
Returns:request
Return type:bool
destroy_volume_snapshot(snapshot: libcloud.compute.base.VolumeSnapshot)[source]

Delete a volume snapshot.

Parameters:snapshot (VolumeSnapshot) – the ID of the snapshot you want to delete (required)
Returns:request
Return type:bool
detach_volume(volume: libcloud.compute.base.StorageVolume, ex_dry_run: bool = False, ex_force_unlink: bool = False)[source]

Detach a volume from a node.

Parameters:volume – the ID of the volume you want to detach

(required) :type volume: str

Parameters:ex_force_unlink – Forces the detachment of the volume in

case of previous failure. Important: This action may damage your data or file systems. :type ex_force_unlink: bool

Parameters:ex_dry_run – If true, checks whether you have the required

permissions to perform the action. :type ex_dry_run: bool

Returns:the attached volume
Return type:dict
ex_accept_net_peering(net_peering_id: List[str] = None, dry_run: bool = False)[source]

Accepts a Net peering connection request. To accept this request, you must be the owner of the peer Net. If you do not accept the request within 7 days, the state of the Net peering connection becomes expired.

Parameters:net_peering_id – The ID of the Net peering connection you

want to accept. (required) :type net_peering_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The accepted Net Peering
Return type:dict
ex_attach_public_ip(allow_relink: bool = None, dry_run: bool = False, nic_id: str = None, vm_id: str = None, public_ip: str = None, public_ip_id: str = None)[source]

Attach public ip to a node.

Parameters:allow_relink – If true, allows the EIP to be associated

with the VM or NIC that you specify even if it is already associated with another VM or NIC. :type allow_relink: bool

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

:param nic_id:(Net only) The ID of the NIC. This parameter is required if the VM has more than one NIC attached. Otherwise, you need to specify the VmId parameter instead. You cannot specify both parameters at the same time. :type nic_id: str

Parameters:
  • vm_id – the ID of the VM
  • public_ip – The EIP. In the public Cloud, this parameter

is required. :type public_ip: str

Parameters:public_ip_id – The allocation ID of the EIP. In a Net,

this parameter is required. :type public_ip_id: str

Returns:the attached volume
Return type:dict
ex_check_account(login: str, password: str, dry_run: bool = False)[source]

Validates the authenticity of the account.

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Parameters:
  • login (str) – the login of the account
  • password (str) – the password of the account
  • dry_run (bool) – the password of the account
Returns:

True if the action successful

Return type:

bool

ex_create_access_key(expiration_date: datetime.datetime = None, dry_run: bool = False)[source]

Creates a new secret access key and the corresponding access key ID for a specified user. The created key is automatically set to ACTIVE.

Parameters:expiration_date – The date and time at which you want the

access key to expire, in ISO 8601 format (for example, 2017-06-14 or 2017-06-14T00:00:00Z). If not specified, the access key has no expiration date. :type expiration_date: datetime

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:access key if action is successful
Return type:dict
ex_create_account(city: str = None, company_name: str = None, country: str = None, customer_id: str = None, email: str = None, first_name: str = None, last_name: str = None, zip_code: str = None, job_title: str = None, mobile_number: str = None, phone_number: str = None, state_province: str = None, vat_number: str = None, dry_run: bool = False)[source]

Creates a new 3DS OUTSCALE account.

You need 3DS OUTSCALE credentials and the appropriate quotas to create a new account via API. To get quotas, you can send an email to sales@outscale.com. If you want to pass a numeral value as a string instead of an integer, you must wrap your string in additional quotes (for example, ‘“92000”’).

Parameters:
  • city (str) – The city of the account owner.
  • company_name – The name of the company for the account.

permissions to perform the action. :type company_name: str

Parameters:
  • country (str) – The country of the account owner.
  • customer_id (str) – The ID of the customer. It must be 8 digits.
  • email (str) – The email address for the account.
  • first_name (str) – The first name of the account owner.
  • last_name (str) – The last name of the account owner.
  • zip_code (str) – The ZIP code of the city.
  • job_title (str) – The job title of the account owner.
  • mobile_number – The mobile phone number of the account

owner. :type mobile_number: str

Parameters:phone_number – The landline phone number of the account

owner. :type phone_number: str

Parameters:
  • state_province (str) – The state/province of the account.
  • vat_number – The value added tax (VAT) number for

the account. :type vat_number: str

Parameters:dry_run (bool) – the password of the account
Returns:True if the action is successful
Return type:bool
ex_create_api_access_rule(description: str = None, ip_ranges: List[str] = None, ca_ids: List[str] = None, cns: List[str] = None, dry_run: bool = False)[source]

Create an API access rule. It is a rule to allow access to the API from your account. You need to specify at least the CaIds or the IpRanges parameter.

Parameters:
  • description (str) – The description of the new rule.
  • ip_ranges – One or more IP ranges, in CIDR notation

(for example, 192.0.2.0/16). :type ip_ranges: List of str

Parameters:ca_ids – One or more IDs of Client Certificate Authorities

(CAs). :type ca_ids: List of str

Parameters:cns – One or more Client Certificate Common Names (CNs).

If this parameter is specified, you must also specify the ca_ids parameter. :type cns: List of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a dict containing the API access rule created.
Return type:dict
ex_create_certificate_authority(ca_perm: str, description: str = None, dry_run: bool = False)[source]

Creates a Client Certificate Authority (CA).

Parameters:
  • ca_perm (str) – The CA in PEM format. (required)
  • description (bool) – The description of the CA.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:the created Ca.
Return type:dict
ex_create_client_gateway(bgp_asn: int = None, connection_type: str = None, public_ip: str = None, dry_run: bool = False)[source]

Provides information about your client gateway. This action registers information to identify the client gateway that you deployed in your network. To open a tunnel to the client gateway, you must provide the communication protocol type, the valid fixed public IP address of the gateway, and an Autonomous System Number (ASN).

Parameters:bgp_asn – An Autonomous System Number (ASN) used by

the Border Gateway Protocol (BGP) to find the path to your client gateway through the Internet. (required) :type bgp_asn: int (required)

Parameters:connection_type – The communication protocol used to

establish tunnel with your client gateway (only ipsec.1 is supported). (required) :type connection_type: str

Parameters:public_ip – The public fixed IPv4 address of your

client gateway. (required) :type public_ip: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:Client Gateway as dict
Return type:dict
ex_create_dhcp_options(domaine_name: str = None, domaine_name_servers: list = None, ntp_servers: list = None, dry_run: bool = False)[source]

Creates a new set of DHCP options, that you can then associate with a Net using the UpdateNet method.

Parameters:domaine_name – Specify a domain name

(for example, MyCompany.com). You can specify only one domain name. :type domaine_name: str

Parameters:domaine_name_servers – The IP addresses of domain name

servers. If no IP addresses are specified, the OutscaleProvidedDNS value is set by default. :type domaine_name_servers: list of str

Parameters:ntp_servers – The IP addresses of the Network Time

Protocol (NTP) servers. :type ntp_servers: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The created Dhcp Options
Return type:dict

Creates a new DirectLink between a customer network and a specified DirectLink location.

Parameters:bandwidth – The bandwidth of the DirectLink

(1Gbps | 10Gbps). (required) :type bandwidth: str

Parameters:
  • direct_link_name (str) – The name of the DirectLink. (required)
  • location – The code of the requested location for

the DirectLink, returned by the list_locations method. Protocol (NTP) servers. :type location: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Direct Link
Return type:dict

Creates a DirectLink interface. DirectLink interfaces enable you to reach one of your Nets through a virtual gateway.

Parameters:direct_link_id – The ID of the existing DirectLink for which

you want to create the DirectLink interface. (required) :type direct_link_id: str

Parameters:bgp_asn – The BGP (Border Gateway Protocol) ASN (Autonomous

System Number) on the customer’s side of the DirectLink interface. (required) :type bgp_asn: int

Parameters:
  • bgp_key (str) – The BGP authentication key.
  • client_private_ip – The IP address on the customer’s side

of the DirectLink interface. (required) :type client_private_ip: str

Parameters:direct_link_interface_name – The name of the DirectLink

interface. (required) :type direct_link_interface_name: str

Parameters:outscale_private_ip – The IP address on 3DS OUTSCALE’s side

of the DirectLink interface. :type outscale_private_ip: str

:param virtual_gateway_id:The ID of the target virtual gateway. (required) :type virtual_gateway_id: str

Parameters:vlan – The VLAN number associated with the DirectLink

interface. (required) :type vlan: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Direct Link Interface
Return type:dict
ex_create_flexible_gpu(delete_on_vm_deletion: bool = None, generation: str = None, model_name: str = None, subregion_name: str = None, dry_run: bool = False)[source]

Allocates a flexible GPU (fGPU) to your account. You can then attach this fGPU to a virtual machine (VM).

Parameters:delete_on_vm_deletion – If true, the fGPU is deleted when

the VM is terminated. :type delete_on_vm_deletion: bool

Parameters:generation – The processor generation that the fGPU must be

compatible with. If not specified, the oldest possible processor generation is selected (as provided by ReadFlexibleGpuCatalog for the specified model of fGPU). :type generation: str

Parameters:model_name – The model of fGPU you want to allocate. For

more information, see About Flexible GPUs: https://wiki.outscale.net/display/EN/About+Flexible+GPUs (required) :type model_name: str

Parameters:subregion_name – The Subregion in which you want to create

the fGPU. (required) :type subregion_name: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Flexible GPU
Return type:dict
ex_create_image_export_task(image: libcloud.compute.base.NodeImage = None, osu_export_disk_image_format: str = None, osu_export_api_key_id: str = None, osu_export_api_secret_key: str = None, osu_export_bucket: str = None, osu_export_manifest_url: str = None, osu_export_prefix: str = None, dry_run: bool = False)[source]

Exports an Outscale machine image (OMI) to an Object Storage Unit (OSU) bucket. This action enables you to copy an OMI between accounts in different Regions. To copy an OMI in the same Region, you can also use the CreateImage method. The copy of the OMI belongs to you and is independent from the source OMI.

Parameters:
  • image (NodeImage) – The ID of the OMI to export. (required)
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Parameters:osu_export_disk_image_format – The format of the

export disk (qcow2 | vdi | vmdk). (required) :type osu_export_disk_image_format: str

Parameters:osu_export_api_key_id – The API key of the OSU

account that enables you to access the bucket. :type osu_export_api_key_id: str

Parameters:osu_export_api_secret_key – The secret key of the

OSU account that enables you to access the bucket. :type osu_export_api_secret_key: str

Parameters:osu_export_bucket – The name of the OSU bucket

you want to export the object to. (required) :type osu_export_bucket: str

Parameters:
  • osu_export_manifest_url (str) – The URL of the manifest file.
  • osu_export_prefix – The prefix for the key of

the OSU object. This key follows this format: prefix + object_export_task_id + ‘.’ + disk_image_format. :type osu_export_prefix: str

Returns:the created image export task
Return type:dict
ex_create_internet_service(dry_run: bool = False)[source]

Creates an Internet service you can use with a Net. An Internet service enables your virtual machines (VMs) launched in a Net to connect to the Internet. By default, a Net includes an Internet service, and each Subnet is public. Every VM launched within a default Subnet has a private and a public IP addresses.

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Internet Service
Return type:dict
ex_create_listener_rule(vms: [<class 'libcloud.compute.base.Node'>] = None, l_load_balancer_name: str = None, l_load_balancer_port: str = None, lr_action: str = None, lr_host_name_pattern: str = None, lr_id: str = None, lr_name: str = None, lr_path_pattern: str = None, lr_priority: int = None, dry_run: bool = False)[source]

Creates a rule for traffic redirection for the specified listener. Each rule must have either the HostNamePattern or PathPattern parameter specified. Rules are treated in priority order, from the highest value to the lowest value. Once the rule is created, you need to register backend VMs with it. For more information, see the RegisterVmsInLoadBalancer method. https://docs.outscale.com/api#registervmsinloadbalancer

Parameters:
  • vms (list of Node) – The IDs of the backend VMs. (required)
  • l_load_balancer_name – The name of the load balancer to

which the listener is attached. (required) :type l_load_balancer_name: str

Parameters:l_load_balancer_port – The port of load balancer on which

the load balancer is listening (between 1 and 65535 both included). (required) :type l_load_balancer_port: int

Parameters:lr_action – The type of action for the rule

(always forward). :type lr_action: str

Parameters:lr_host_name_pattern – A host-name pattern for the rule,

with a maximum length of 128 characters. This host-name pattern supports maximum three wildcards, and must not contain any special characters except [-.?]. :type lr_host_name_pattern: str

Parameters:
  • lr_id (str) – The ID of the listener.
  • lr_name (str) – A human-readable name for the listener rule.
  • lr_path_pattern – A path pattern for the rule, with a

maximum length of 128 characters. This path pattern supports maximum three wildcards, and must not contain any special characters except [_-.$/~”’@:+?]. :type lr_path_pattern: str

Parameters:lr_priority – The priority level of the listener rule,

between 1 and 19999 both included. Each rule must have a unique priority level. Otherwise, an error is returned. (required) :type lr_priority: int

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Listener Rule
Return type:dict
ex_create_load_balancer(load_balancer_name: str = None, load_balancer_type: str = None, security_groups: List[str] = None, subnets: List[str] = None, subregion_names: str = None, tag_keys: List[str] = None, tag_values: List[str] = None, l_backend_port: int = None, l_backend_protocol: str = None, l_load_balancer_port: int = None, l_load_balancer_protocol: str = None, l_server_certificate_id: str = None, dry_run: bool = False)[source]

Creates a load balancer. The load balancer is created with a unique Domain Name Service (DNS) name. It receives the incoming traffic and routes it to its registered virtual machines (VMs). By default, this action creates an Internet-facing load balancer, resolving to public IP addresses. To create an internal load balancer in a Net, resolving to private IP addresses, use the LoadBalancerType parameter.

Parameters:load_balancer_name – The name of the load balancer for

which you want to create listeners. (required) :type load_balancer_name: str

Parameters:load_balancer_type – The type of load balancer:

internet-facing or internal. Use this parameter only for load balancers in a Net. :type load_balancer_type: str

Parameters:security_groups – One or more IDs of security groups you

want to assign to the load balancer. :type security_groups: list of str

Parameters:subnets – One or more IDs of Subnets in your Net that you

want to attach to the load balancer. :type subnets: list of str

Parameters:subregion_names – One or more names of Subregions

(currently, only one Subregion is supported). This parameter is not required if you create a load balancer in a Net. To create an internal load balancer, use the LoadBalancerType parameter. :type subregion_names: list of str

Parameters:tag_keys – The key of the tag, with a minimum of 1

character. (required) :type tag_keys: list of str

Parameters:tag_values – The value of the tag, between 0 and 255

characters. (required) :type tag_values: list of str

Parameters:l_backend_port – The port on which the back-end VM is

listening (between 1 and 65535, both included). (required) :type l_backend_port: int

Parameters:l_backend_protocol – The protocol for routing traffic to

back-end VMs (HTTP | HTTPS | TCP | SSL | UDP). :type l_backend_protocol: int

Parameters:l_load_balancer_port – The port on which the load balancer

is listening (between 1 and 65535, both included). (required) :type l_load_balancer_port: int

Parameters:l_load_balancer_protocol – The routing protocol

(HTTP | HTTPS | TCP | SSL | UDP). (required) :type l_load_balancer_protocol: str

Parameters:l_server_certificate_id – The ID of the server certificate.

(required) :type l_server_certificate_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Load Balancer
Return type:dict
ex_create_load_balancer_listeners(load_balancer_name: str = None, l_backend_port: int = None, l_backend_protocol: str = None, l_load_balancer_port: int = None, l_load_balancer_protocol: str = None, l_server_certificate_id: str = None, dry_run: bool = False)[source]

Creates one or more listeners for a specified load balancer.

Parameters:load_balancer_name – The name of the load balancer for

which you want to create listeners. (required) :type load_balancer_name: str

Parameters:l_backend_port – The port on which the back-end VM is

listening (between 1 and 65535, both included). (required) :type l_backend_port: int

Parameters:l_backend_protocol – The protocol for routing traffic to

back-end VMs (HTTP | HTTPS | TCP | SSL | UDP). :type l_backend_protocol: int

Parameters:l_load_balancer_port – The port on which the load balancer

is listening (between 1 and 65535, both included). (required) :type l_load_balancer_port: int

Parameters:l_load_balancer_protocol – The routing protocol

(HTTP | HTTPS | TCP | SSL | UDP). (required) :type l_load_balancer_protocol: str

Parameters:l_server_certificate_id – The ID of the server certificate.

(required) :type l_server_certificate_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Load Balancer Listener
Return type:dict
ex_create_load_balancer_policy(cookie_name: str = None, load_balancer_name: str = None, policy_name: str = None, policy_type: str = None, dry_run: bool = False)[source]

Creates a stickiness policy with sticky session lifetimes defined by the browser lifetime. The created policy can be used with HTTP or HTTPS listeners only. If this policy is implemented by a load balancer, this load balancer uses this cookie in all incoming requests to direct them to the specified back-end server virtual machine (VM). If this cookie is not present, the load balancer sends the request to any other server according to its load-balancing algorithm.

You can also create a stickiness policy with sticky session lifetimes following the lifetime of an application-generated cookie. Unlike the other type of stickiness policy, the lifetime of the special Load Balancer Unit (LBU) cookie follows the lifetime of the application-generated cookie specified in the policy configuration. The load balancer inserts a new stickiness cookie only when the application response includes a new application cookie. The session stops being sticky if the application cookie is removed or expires, until a new application cookie is issued.

Parameters:cookie_name – The name of the application cookie used for

stickiness. This parameter is required if you create a stickiness policy based on an application-generated cookie. :type cookie_name: str

Parameters:load_balancer_name – The name of the load balancer for

which you want to create a policy. (required) :type load_balancer_name: str

Parameters:policy_name – The name of the policy. This name must be

unique and consist of alphanumeric characters and dashes (-). (required) :type policy_name: str

Parameters:policy_type – The type of stickiness policy you want to

create: app or load_balancer. (required) :type policy_type: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Load Balancer Policy
Return type:dict
ex_create_load_balancer_tags(load_balancer_names: List[str] = None, tag_keys: List[str] = None, tag_values: List[str] = None, dry_run: bool = False)[source]

Adds one or more tags to the specified load balancers. If a tag with the same key already exists for the load balancer, the tag value is replaced.

Parameters:load_balancer_names – The name of the load balancer for

which you want to create listeners. (required) :type load_balancer_names: str

Parameters:tag_keys – The key of the tag, with a minimum of 1

character. (required) :type tag_keys: list of str

Parameters:tag_values – The value of the tag, between 0 and 255

characters. (required) :type tag_values: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Load Balancer Tags
Return type:dict
ex_create_nat_service(public_ip: str = None, subnet_id: str = None, dry_run: bool = False)[source]

Creates a network address translation (NAT) service in the specified public Subnet of a Net. A NAT service enables virtual machines (VMs) placed in the private Subnet of this Net to connect to the Internet, without being accessible from the Internet. When creating a NAT service, you specify the allocation ID of the External IP (EIP) you want to use as public IP for the NAT service. Once the NAT service is created, you need to create a route in the route table of the private Subnet, with 0.0.0.0/0 as destination and the ID of the NAT service as target. For more information, see LinkPublicIP and CreateRoute. This action also enables you to create multiple NAT services in the same Net (one per public Subnet).

Parameters:public_ip – The allocation ID of the EIP to associate

with the NAT service. (required) :type public_ip: str

Parameters:subnet_id – The ID of the Subnet in which you want to

create the NAT service. (required) :type subnet_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Nat Service
Return type:dict
ex_create_net(ip_range: str = None, tenancy: str = None, dry_run: bool = False)[source]

Creates a Net with a specified IP range. The IP range (network range) of your Net must be between a /28 netmask (16 IP addresses) and a /16 netmask (65 536 IP addresses).

Parameters:ip_range – The IP range for the Net, in CIDR notation

(for example, 10.0.0.0/16). (required) :type ip_range: str

Parameters:tenancy – The tenancy options for the VMs (default if a VM

created in a Net can be launched with any tenancy, dedicated if it can be launched with dedicated tenancy VMs running on single-tenant hardware). :type tenancy: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Nat Service
Return type:dict
ex_create_net_access_point(net_id: str = None, route_table_ids: List[str] = None, service_name: str = None, dry_run: bool = False)[source]

Creates a Net access point to access a 3DS OUTSCALE service from this Net without using the Internet and External IP addresses. You specify the service using its prefix list name. For more information, see DescribePrefixLists: https://docs.outscale.com/api#describeprefixlists To control the routing of traffic between the Net and the specified service, you can specify one or more route tables. Virtual machines placed in Subnets associated with the specified route table thus use the Net access point to access the service. When you specify a route table, a route is automatically added to it with the destination set to the prefix list ID of the service, and the target set to the ID of the access point.

Parameters:
  • net_id (str) – The ID of the Net. (required)
  • route_table_ids – One or more IDs of route tables to use

for the connection. :type route_table_ids: list of str

Parameters:service_name – The prefix list name corresponding to the

service (for example, com.outscale.eu-west-2.osu for OSU). (required) :type service_name: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Access Net Point
Return type:dict
ex_create_net_peering(accepter_net_id: str = None, source_net_id: str = None, dry_run: bool = False)[source]

Requests a Net peering connection between a Net you own and a peer Net that belongs to you or another account. This action creates a Net peering connection that remains in the pending-acceptance state until it is accepted by the owner of the peer Net. If the owner of the peer Net does not accept the request within 7 days, the state of the Net peering connection becomes expired. For more information, see AcceptNetPeering: https://docs.outscale.com/api#acceptnetpeering

Parameters:accepter_net_id – The ID of the Net you want to connect

with. (required) :type accepter_net_id: str

Parameters:source_net_id – The ID of the Net you send the peering

request from. (required) :type source_net_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Net Peering
Return type:dict
ex_create_nic(description: str = None, private_ips_is_primary: List[str] = None, private_ips: List[str] = None, security_group_ids: List[str] = None, subnet_id: str = None, dry_run: bool = False)[source]

Creates a network interface card (NIC) in the specified Subnet.

Parameters:
  • description (str) – A description for the NIC.
  • private_ips_is_primary – If true, the IP address is the

primary private IP address of the NIC. :type private_ips_is_primary: list of str

Parameters:
  • private_ips (list of str) – The private IP addresses of the NIC.
  • security_group_ids – One or more IDs of security groups for

the NIC. :type security_group_ids: list of str

Parameters:subnet_id – The ID of the Subnet in which you want to

create the NIC. (required) :type subnet_id: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Nic
Return type:dict
ex_create_public_ip(dry_run: bool = False)[source]

Create a new public ip.

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:the created public ip
Return type:dict
ex_create_route(destination_ip_range: str = None, gateway_id: str = None, nat_service_id: str = None, net_peering_id: str = None, nic_id: str = None, route_table_id: str = None, vm_id: str = None, dry_run: bool = False)[source]

Creates a route in a specified route table within a specified Net. You must specify one of the following elements as the target:

  • Net peering connection
  • NAT VM
  • Internet service
  • Virtual gateway
  • NAT service
  • Network interface card (NIC)

The routing algorithm is based on the most specific match.

Parameters:destination_ip_range – The IP range used for the

destination match, in CIDR notation (for example, 10.0.0.0/24). (required) :type destination_ip_range: str

Parameters:gateway_id – The ID of an Internet service or virtual

gateway attached to your Net. :type gateway_id: str

Parameters:
  • nat_service_id (str) – The ID of a NAT service.
  • net_peering_id (str) – The ID of a Net peering connection.
  • nic_id (str) – The ID of a NIC.
  • vm_id – The ID of a NAT VM in your Net (attached to exactly

one NIC). :type vm_id: str

Parameters:route_table_id – The ID of the route table for which you

want to create a route. (required) :type route_table_id: str`

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Route
Return type:dict
ex_create_route_table(net_id: str = None, dry_run: bool = False)[source]

Creates a route table for a specified Net. You can then add routes and associate this route table with a Subnet.

Parameters:net_id – The ID of the Net for which you want to create a

route table. (required) :type net_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Route Table
Return type:dict
ex_create_security_group(description: str = None, net_id: str = None, security_group_name: str = None, dry_run: bool = False)[source]

Creates a security group. This action creates a security group either in the public Cloud or in a specified Net. By default, a default security group for use in the public Cloud and a default security group for use in a Net are created. When launching a virtual machine (VM), if no security group is explicitly specified, the appropriate default security group is assigned to the VM. Default security groups include a default rule granting VMs network access to each other. When creating a security group, you specify a name. Two security groups for use in the public Cloud or for use in a Net cannot have the same name. You can have up to 500 security groups in the public Cloud. You can create up to 500 security groups per Net. To add or remove rules, use the ex_create_security_group_rule method.

Parameters:description – A description for the security group, with a

maximum length of 255 ASCII printable characters. (required) :type description: str

Parameters:
  • net_id (str) – The ID of the Net for the security group.
  • security_group_name – The name of the security group.

(required) :type security_group_name: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Security Group
Return type:dict
ex_create_security_group_rule(flow: str = None, from_port_range: int = None, ip_range: str = None, rules: List[dict] = None, sg_account_id_to_link: str = None, sg_id: str = None, sg_name_to_link: str = None, to_port_range: int = None, dry_run: bool = False)[source]

Configures the rules for a security group. The modifications are effective at virtual machine (VM) level as quickly as possible, but a small delay may occur.

You can add one or more egress rules to a security group for use with a Net. It allows VMs to send traffic to either one or more destination IP address ranges or destination security groups for the same Net. We recommend using a set of IP permissions to authorize outbound access to a destination security group. We also recommended this method to create a rule with a specific IP protocol and a specific port range. In a set of IP permissions, we recommend to specify the the protocol.

You can also add one or more ingress rules to a security group. In the public Cloud, this action allows one or more IP address ranges to access a security group for your account, or allows one or more security groups (source groups) to access a security group for your own 3DS OUTSCALE account or another one. In a Net, this action allows one or more IP address ranges to access a security group for your Net, or allows one or more other security groups (source groups) to access a security group for your Net. All the security groups must be for the same Net.

Parameters:flow – The direction of the flow: Inbound or Outbound.

You can specify Outbound for Nets only.type (required) description: bool

Parameters:from_port_range – The beginning of the port range for

the TCP and UDP protocols, or an ICMP type number. :type from_port_range: int

Parameters:ip_range – The name The IP range for the security group

rule, in CIDR notation (for example, 10.0.0.0/16). :type ip_range: str

Parameters:rules – Information about the security group rule to create:

https://docs.outscale.com/api#createsecuritygrouprule :type rules: list of dict

Parameters:sg_account_id_to_link – The account ID of the

owner of the security group for which you want to create a rule. :type sg_account_id_to_link: str

Parameters:sg_id – The ID of the security group for which

you want to create a rule. (required) :type sg_id: str

Parameters:sg_name_to_link – The ID of the source security

group. If you are in the Public Cloud, you can also specify the name of the source security group. :type sg_name_to_link: str

Parameters:to_port_range – the end of the port range for the TCP and

UDP protocols, or an ICMP type number. :type to_port_range: int

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Security Group Rule
Return type:dict
ex_create_server_certificate(body: str = None, chain: str = None, name: str = None, path: str = None, private_key: str = None, dry_run: bool = False)[source]

Creates a server certificate and its matching private key. These elements can be used with other services (for example, to configure SSL termination on load balancers). You can also specify the chain of intermediate certification authorities if your certificate is not directly signed by a root one. You can specify multiple intermediate certification authorities in the CertificateChain parameter. To do so, concatenate all certificates in the correct order (the first certificate must be the authority of your certificate, the second must the the authority of the first one, and so on). The private key must be a RSA key in PKCS1 form. To check this, open the PEM file and ensure its header reads as follows: BEGIN RSA PRIVATE KEY. [IMPORTANT] This private key must not be protected by a password or a passphrase.

Parameters:
  • body (str) – The PEM-encoded X509 certificate. (required)
  • chain – The PEM-encoded intermediate certification

authorities. :type chain: str

Parameters:name – A unique name for the certificate. Constraints:

1-128 alphanumeric characters, pluses (+), equals (=), commas (,), periods (.), at signs (@), minuses (-), or underscores (_). (required) :type name: str

Parameters:path – The path to the server certificate, set to a slash

(/) if not specified. :type path: str

Parameters:private_key – The PEM-encoded private key matching

the certificate. (required) :type private_key: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new server certificate
Return type:dict
ex_create_snapshot_export_task(osu_export_disk_image_format: str = None, osu_export_api_key_id: str = None, osu_export_api_secret_key: str = None, osu_export_bucket: str = None, osu_export_manifest_url: str = None, osu_export_prefix: str = None, snapshot: libcloud.compute.base.VolumeSnapshot = None, dry_run: bool = False)[source]

Exports a snapshot to an Object Storage Unit (OSU) bucket. This action enables you to create a backup of your snapshot or to copy it to another account. You, or other users you send a pre-signed URL to, can then download this snapshot from the OSU bucket using the CreateSnapshot method. This procedure enables you to copy a snapshot between accounts within the same Region or in different Regions. To copy a snapshot within the same Region, you can also use the CreateSnapshot direct method. The copy of the source snapshot is independent and belongs to you.

Parameters:osu_export_disk_image_format – The format of the export

disk (qcow2 | vdi | vmdk). (required) :type osu_export_disk_image_format: str

Parameters:osu_export_api_key_id – The API key of the OSU account

that enables you to access the bucket. :type osu_export_api_key_id : str

Parameters:osu_export_api_secret_key – The secret key of the OSU

account that enables you to access the bucket. :type osu_export_api_secret_key : str

Parameters:osu_export_bucket – The name of the OSU bucket you want

to export the object to. (required) :type osu_export_bucket : str

Parameters:osu_export_manifest_url – The URL of the manifest file.

:type osu_export_manifest_url : str

Parameters:osu_export_prefix – The prefix for the key of the OSU

object. This key follows this format: prefix + object_export_task_id + ‘.’ + disk_image_format. :type osu_export_prefix : str

Parameters:snapshot – The ID of the snapshot to export. (required)

:type snapshot : VolumeSnapshot

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run : bool

Returns:the created snapshot export task
Return type:dict
ex_create_subnet(ip_range: str = None, net_id: str = None, subregion_name: str = None, dry_run: bool = False)[source]

Creates a Subnet in an existing Net. To create a Subnet in a Net, you have to provide the ID of the Net and the IP range for the Subnet (its network range). Once the Subnet is created, you cannot modify its IP range. The IP range of the Subnet can be either the same as the Net one if you create only a single Subnet in this Net, or a subset of the Net one. In case of several Subnets in a Net, their IP ranges must not overlap. The smallest Subnet you can create uses a /30 netmask (four IP addresses).

Parameters:ip_range – The IP range in the Subnet, in CIDR notation

(for example, 10.0.0.0/16). (required) :type ip_range: str

Parameters:net_id – The ID of the Net for which you want to create a

Subnet. (required) :type net_id: str

Parameters:subregion_name – the name of the Subregion in which you

want to create the Subnet. :type subregion_name: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Subnet
Return type:dict
ex_create_tag(resource_ids: list, tag_key: str = None, tag_value: str = None, dry_run: bool = False)[source]

Adds one tag to the specified resources. If a tag with the same key already exists for the resource, the tag value is replaced. You can tag the following resources using their IDs:

Parameters:
  • resource_ids (list) – One or more resource IDs. (required)
  • tag_key – The key of the tag, with a minimum of 1 character.

(required) :type tag_key: str

Parameters:tag_value – The value of the tag, between

0 and 255 characters. (required) :type tag_value: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. (required) :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_create_tags(resource_ids: list, tags: list = None, dry_run: bool = False)[source]

Adds one or more tags to the specified resources. If a tag with the same key already exists for the resource, the tag value is replaced. You can tag the following resources using their IDs:

Parameters:
  • resource_ids (list) – One or more resource IDs. (required)
  • tags – The key of the tag, with a minimum of 1 character.

(required) :type tags: list of dict

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_create_virtual_gateway(connection_type: str = None, dry_run: bool = False)[source]

Creates a virtual gateway. A virtual gateway is the access point on the Net side of a VPN connection.

Parameters:connection_type – The type of VPN connection supported

by the virtual gateway (only ipsec.1 is supported). (required) :type connection_type: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new virtual gateway
Return type:dict
ex_create_vpn_connection(client_gateway_id: str = None, connection_type: str = None, static_routes_only: bool = None, virtual_gateway_id: str = None, dry_run: bool = False)[source]

Creates a VPN connection between a specified virtual gateway and a specified client gateway. You can create only one VPN connection between a virtual gateway and a client gateway.

Parameters:
  • client_gateway_id (str) – The ID of the client gateway. (required)
  • connection_type – The type of VPN connection (only ipsec.1

is supported). (required) :type connection_type: str

Parameters:static_routes_only – If false, the VPN connection uses

dynamic routing with Border Gateway Protocol (BGP). If true, routing is controlled using static routes. For more information about how to create and delete static routes, see CreateVpnConnectionRoute: https://docs.outscale.com/api#createvpnconnectionroute and DeleteVpnConnectionRoute: https://docs.outscale.com/api#deletevpnconnectionroute :type static_routes_only: bool

Parameters:virtual_gateway_id – The ID of the virtual gateway.

(required) :type virtual_gateway_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Vpn Connection
Return type:dict
ex_create_vpn_connection_route(destination_ip_range: str = None, vpn_connection_id: str = None, dry_run: bool = False)[source]

Creates a static route to a VPN connection. This enables you to select the network flows sent by the virtual gateway to the target VPN connection.

Parameters:destination_ip_range – The network prefix of the route, in

CIDR notation (for example, 10.12.0.0/16).(required) :type destination_ip_range: str

Parameters:vpn_connection_id – The ID of the target VPN connection of

the static route. (required) :type vpn_connection_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_access_key(access_key_id: str, dry_run: bool = False)[source]

Deletes the specified access key associated with the account that sends the request.

Parameters:access_key_id – The ID of the access key you want to

delete. (required) :type access_key_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_api_access_rule(api_access_rule_id: str, dry_run: bool = False)[source]

Delete an API access rule. You cannot delete the last remaining API access rule.

Parameters:api_access_rule_id – The id of the targeted rule

(required). :type api_access_rule_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:true if successful.
Return type:bool if successful or dict
ex_delete_certificate_authority(ca_id: str, dry_run: bool = False)[source]

Deletes a specified Client Certificate Authority (CA).

Parameters:
  • ca_id (str) – The ID of the CA you want to delete. (required)
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

ex_delete_client_gateway(client_gateway_id: str = None, dry_run: bool = False)[source]

Deletes a client gateway. You must delete the VPN connection before deleting the client gateway.

Parameters:client_gateway_id – The ID of the client gateway

you want to delete. (required) :type client_gateway_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:Returns True if action is successful
Return type:bool
ex_delete_dhcp_options(dhcp_options_set_id: str = None, dry_run: bool = False)[source]

Deletes a specified DHCP options set. Before deleting a DHCP options set, you must disassociate it from the Nets you associated it with. To do so, you need to associate with each Net a new set of DHCP options, or the default one if you do not want to associate any DHCP options with the Net.

Parameters:dhcp_options_set_id – The ID of the DHCP options set

you want to delete. (required) :type dhcp_options_set_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool

Deletes a specified DirectLink. Before deleting a DirectLink, ensure that all your DirectLink interfaces related to this DirectLink are deleted.

Parameters:direct_link_id – The ID of the DirectLink you want to

delete. (required) :type direct_link_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool

Deletes a specified DirectLink interface.

Parameters:direct_link_interface_id – the ID of the DirectLink

interface you want to delete. (required) :type direct_link_interface_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_export_task(export_task_id: str = None, dry_run: bool = False)[source]

Deletes an export task. If the export task is not running, the command fails and an error is returned.

Parameters:export_task_id – The ID of the export task to delete.

(required) :type export_task_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_flexible_gpu(flexible_gpu_id: str = None, dry_run: bool = False)[source]

Releases a flexible GPU (fGPU) from your account. The fGPU becomes free to be used by someone else.

Parameters:flexible_gpu_id – The ID of the fGPU you want

to delete. (required) :type flexible_gpu_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_internet_service(internet_service_id: str = None, dry_run: bool = False)[source]

Deletes an Internet service. Before deleting an Internet service, you must detach it from any Net it is attached to.

Parameters:internet_service_id – The ID of the Internet service you

want to delete.(required) :type internet_service_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_listener_rule(listener_rule_name: str = None, dry_run: bool = False)[source]

Deletes a listener rule. The previously active rule is disabled after deletion.

Parameters:listener_rule_name – The name of the rule you want to

delete. (required) :type listener_rule_name: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_load_balancer(load_balancer_name: str = None, dry_run: bool = False)[source]

Deletes a specified load balancer.

Parameters:load_balancer_name – The name of the load balancer you want

to delete. (required) :type load_balancer_name: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_load_balancer_listeners(load_balancer_name: str = None, load_balancer_ports: List[int] = None, dry_run: bool = False)[source]

Deletes listeners of a specified load balancer.

Parameters:load_balancer_name – The name of the load balancer for

which you want to delete listeners. (required) :type load_balancer_name: str

Parameters:load_balancer_ports – One or more port numbers of the

listeners you want to delete.. (required) :type load_balancer_ports: list of int

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_load_balancer_policy(load_balancer_name: str = None, policy_name: str = None, dry_run: bool = False)[source]

Deletes a specified policy from a load balancer. In order to be deleted, the policy must not be enabled for any listener.

Parameters:load_balancer_name – The name of the load balancer for

which you want to delete a policy. (required) :type load_balancer_name: str

Parameters:policy_name – The name of the policy you want to delete.

(required) :type policy_name: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_load_balancer_tags(load_balancer_names: List[str] = None, tag_keys: List[str] = None, dry_run: bool = False)[source]

Deletes a specified load balancer tags.

Parameters:load_balancer_names – The names of the load balancer for

which you want to delete tags. (required) :type load_balancer_names: str

Parameters:tag_keys – The key of the tag, with a minimum of

1 character. :type tag_keys: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_nat_service(nat_service_id: str = None, dry_run: bool = False)[source]

Deletes a specified network address translation (NAT) service. This action disassociates the External IP address (EIP) from the NAT service, but does not release this EIP from your account. However, it does not delete any NAT service routes in your route tables.

Parameters:nat_service_id – the ID of the NAT service you want to

delete. (required) :type nat_service_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_net(net_id: str = None, dry_run: bool = False)[source]

Deletes a specified Net. Before deleting the Net, you need to delete or detach all the resources associated with the Net:

  • Virtual machines (VMs)
  • Net peering connections
  • Custom route tables
  • External IP addresses (EIPs) allocated to resources in the Net
  • Network Interface Cards (NICs) created in the Subnets
  • Virtual gateways, Internet services and NAT services
  • Load balancers
  • Security groups
  • Subnets
Parameters:
  • net_id (str) – The ID of the Net you want to delete. (required)
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_net_access_point(net_access_point_id: str = None, dry_run: bool = False)[source]

Deletes one or more Net access point. This action also deletes the corresponding routes added to the route tables you specified for the Net access point.

Parameters:net_access_point_id – The ID of the Net access point.

(required) :type net_access_point_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_net_peering(net_peering_id: List[str] = None, dry_run: bool = False)[source]

Deletes a Net peering connection. If the Net peering connection is in the active state, it can be deleted either by the owner of the requester Net or the owner of the peer Net. If it is in the pending-acceptance state, it can be deleted only by the owner of the requester Net. If it is in the rejected, failed, or expired states, it cannot be deleted.

Parameters:net_peering_id – The ID of the Net peering connection you

want to delete. (required) :type net_peering_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_nic(nic_id: str = None, dry_run: bool = False)[source]

Deletes the specified network interface card (NIC). The network interface must not be attached to any virtual machine (VM).

Parameters:
  • nic_id (str) – The ID of the NIC you want to delete. (required)
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_public_ip(dry_run: bool = False, public_ip: str = None, public_ip_id: str = None)[source]

Delete public ip.

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Parameters:public_ip – The EIP. In the public Cloud, this parameter is

required. :type public_ip: str

Parameters:public_ip_id – The ID representing the association of the

EIP with the VM or the NIC. In a Net, this parameter is required. :type public_ip_id: str

Returns:request
Return type:dict
ex_delete_route(destination_ip_range: str = None, route_table_id: str = None, dry_run: bool = False)[source]

Deletes a route from a specified route table.

Parameters:destination_ip_range – The exact IP range for the route.

(required) :type destination_ip_range: str

Parameters:route_table_id – The ID of the route table from which you

want to delete a route. (required) :type route_table_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_route_table(route_table_id: str = None, dry_run: bool = False)[source]

Deletes a specified route table. Before deleting a route table, you must disassociate it from any Subnet. You cannot delete the main route table.

Parameters:route_table_id – The ID of the route table you want to

delete. (required) :type route_table_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_security_group(security_group_id: str = None, security_group_name: str = None, dry_run: bool = False)[source]

Deletes a specified security group. You can specify either the name of the security group or its ID. This action fails if the specified group is associated with a virtual machine (VM) or referenced by another security group.

Parameters:security_group_id – The ID of the security group you want

to delete. :type security_group_id: str

Parameters:
  • security_group_name (str) – the name of the security group.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_security_group_rule(flow: str = None, from_port_range: int = None, ip_protocol: str = None, ip_range: str = None, rules: List[dict] = None, sg_account_id_to_unlink: str = None, sg_id: str = None, sg_name_to_unlink: str = None, to_port_range: int = None, dry_run: bool = False)[source]

Deletes one or more inbound or outbound rules from a security group. For the rule to be deleted, the values specified in the deletion request must exactly match the value of the existing rule. In case of TCP and UDP protocols, you have to indicate the destination port or range of ports. In case of ICMP protocol, you have to specify the ICMP type and code. Rules (IP permissions) consist of the protocol, IP address range or source security group. To remove outbound access to a destination security group, we recommend to use a set of IP permissions. We also recommend to specify the protocol in a set of IP permissions.

Parameters:flow – The direction of the flow: Inbound or Outbound.

You can specify Outbound for Nets only.type (required) description: bool

Parameters:from_port_range – The beginning of the port range for

the TCP and UDP protocols, or an ICMP type number. :type from_port_range: int

Parameters:ip_range – The name The IP range for the security group

rule, in CIDR notation (for example, 10.0.0.0/16). :type ip_range: str

Parameters:ip_protocol – The IP protocol name (tcp, udp, icmp) or

protocol number. By default, -1, which means all protocols. :type ip_protocol: str

Parameters:rules – Information about the security group rule to create:

https://docs.outscale.com/api#createsecuritygrouprule :type rules: list of dict

Parameters:sg_account_id_to_unlink – The account ID of the

owner of the security group for which you want to delete a rule. :type sg_account_id_to_unlink: str

Parameters:sg_id – The ID of the security group for which

you want to delete a rule. (required) :type sg_id: str

Parameters:sg_name_to_unlink – The ID of the source security

group. If you are in the Public Cloud, you can also specify the name of the source security group. :type sg_name_to_unlink: str

Parameters:to_port_range – the end of the port range for the TCP and

UDP protocols, or an ICMP type number. :type to_port_range: int

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Security Group Rule
Return type:dict
ex_delete_server_certificate(name: str = None, dry_run: bool = False)[source]

Deletes a specified server certificate.

Parameters:name – The name of the server certificate you

want to delete. (required) :type name: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_subnet(subnet_id: str = None, dry_run: bool = False)[source]

Deletes a specified Subnet. You must terminate all the running virtual machines (VMs) in the Subnet before deleting it.

Parameters:subnet_id – The ID of the Subnet you want to delete.

(required) :type subnet_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_tags(resource_ids: list, tags: list = None, dry_run: bool = False)[source]

Deletes one or more tags from the specified resources.

Parameters:
  • resource_ids (list) – One or more resource IDs. (required)
  • tags – The key of the tag, with a minimum of 1 character.

(required) :type tags: list of dict

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_virtual_gateway(virtual_gateway_id: str = None, dry_run: bool = False)[source]

Deletes a specified virtual gateway. Before deleting a virtual gateway, we recommend to detach it from the Net and delete the VPN connection.

Parameters:virtual_gateway_id – The ID of the virtual gateway

you want to delete. (required) :type virtual_gateway_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_vpn_connection(vpn_connection_id: str = None, dry_run: bool = False)[source]

Deletes a specified VPN connection. If you want to delete a Net and all its dependencies, we recommend to detach the virtual gateway from the Net and delete the Net before deleting the VPN connection. This enables you to delete the Net without waiting for the VPN connection to be deleted.

Parameters:vpn_connection_id – the ID of the VPN connection you want

to delete. (required) :type vpn_connection_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_delete_vpn_connection_route(vpn_connection_id: str = None, destination_ip_range: str = None, dry_run: bool = False)[source]

Deletes a specified VPN connection. If you want to delete a Net and all its dependencies, we recommend to detach the virtual gateway from the Net and delete the Net before deleting the VPN connection. This enables you to delete the Net without waiting for the VPN connection to be deleted.

Parameters:vpn_connection_id – the ID of the VPN connection you want

to delete. (required) :type vpn_connection_id: str

Parameters:destination_ip_range – The network prefix of the route to

delete, in CIDR notation (for example, 10.12.0.0/16). (required) :type destination_ip_range: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_deregister_vms_in_load_balancer(backend_vm_ids: List[str] = None, load_balancer_name: str = None, dry_run: bool = False)[source]

Deregisters a specified virtual machine (VM) from a load balancer.

Parameters:backend_vm_ids – One or more IDs of back-end VMs.

(required) :type backend_vm_ids: str

Parameters:load_balancer_name – The name of the load balancer.

(required) :type load_balancer_name: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_detach_public_ip(public_ip: str = None, link_public_ip_id: str = None, dry_run: bool = False)[source]

Detach public ip from a node.

Parameters:public_ip – (Required in a Net) The ID representing the

association of the EIP with the VM or the NIC :type public_ip: str

Parameters:link_public_ip_id – (Required in a Net) The ID

representing the association of the EIP with the VM or the NIC. :type link_public_ip_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:the attached volume
Return type:dict

Attaches one of your allocated flexible GPUs (fGPUs) to one of your virtual machines (Nodes). The fGPU is in the attaching state until the VM is stopped, after which it becomes attached.

Parameters:flexible_gpu_id – The ID of the fGPU you want to attach.

(required) :type flexible_gpu_id: str

Parameters:vm_id – The ID of the VM you want to attach the fGPU to.

(required) :type vm_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool

Attaches an Internet service to a Net. To enable the connection between the Internet and a Net, you must attach an Internet service to this Net.

Parameters:internet_service_id – The ID of the Internet service you

want to attach. (required) :type internet_service_id: str

Parameters:net_id – The ID of the Net to which you want to attach the

Internet service. (required) :type net_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool

Attaches a network interface card (NIC) to a virtual machine (VM). The interface and the VM must be in the same Subregion. The VM can be either running or stopped. The NIC must be in the available state.

Parameters:
  • nic_id (str) – The ID of the NIC you want to delete. (required)
  • device_number – The ID of the NIC you want to delete.

(required) :type device_number: str

Parameters:node – The index of the VM device for the NIC attachment

(between 1 and 7, both included). :type node: Node

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a Link Id
Return type:str

Assigns one or more secondary private IP addresses to a specified network interface card (NIC). This action is only available in a Net. The private IP addresses to be assigned can be added individually using the PrivateIps parameter, or you can specify the number of private IP addresses to be automatically chosen within the Subnet range using the SecondaryPrivateIpCount parameter. You can specify only one of these two parameters. If none of these parameters are specified, a private IP address is chosen within the Subnet range.

Parameters:allow_relink – If true, allows an IP address that is

already assigned to another NIC in the same Subnet to be assigned to the NIC you specified. :type allow_relink: str

Parameters:
  • nic_id (str) – The ID of the NIC. (required)
  • private_ips – The secondary private IP address or addresses

you want to assign to the NIC within the IP address range of the Subnet. :type private_ips: list of str

Parameters:secondary_private_ip_count – The secondary private IP a

ddress or addresses you want to assign to the NIC within the IP address range of the Subnet. :type secondary_private_ip_count: int

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

:return:True if the action is successful :rtype: bool

Associates a Subnet with a route table. The Subnet and the route table must be in the same Net. The traffic is routed according to the route table defined within this Net. You can associate a route table with several Subnets.

Parameters:
  • route_table_id (str) – The ID of the route table. (required)
  • subnet_id (str) – The ID of the Subnet. (required)
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:Link Route Table Id
Return type:str

Attaches a virtual gateway to a Net.

Parameters:net_id – The ID of the Net to which you want to attach

the virtual gateway. (required) :type net_id: str

Parameters:virtual_gateway_id – The ID of the virtual

gateway. (required) :type virtual_gateway_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:
Return type:dict
ex_list_access_keys(access_key_ids: list = None, states: list = None, dry_run: bool = False)[source]

Returns information about the access key IDs of a specified user. If the user does not have any access key ID, this action returns an empty list.

Parameters:
  • access_key_ids (list of str) – The IDs of the access keys.
  • states (list of str) – The states of the access keys (ACTIVE | INACTIVE).
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:list of Access Keys
Return type:list of dict
ex_list_client_gateways(client_gateway_ids: list = None, bgp_asns: list = None, connection_types: list = None, public_ips: list = None, states: list = None, tag_keys: list = None, tag_values: list = None, tags: list = None, dry_run: bool = False)[source]

Deletes a client gateway. You must delete the VPN connection before deleting the client gateway.

Parameters:client_gateway_ids – The IDs of the client gateways.

you want to delete. (required) :type client_gateway_ids: list of ``str`

Parameters:bgp_asns – The Border Gateway Protocol (BGP) Autonomous

System Numbers (ASNs) of the connections. :type bgp_asns: list of int

Parameters:connection_types – The types of communication tunnels

used by the client gateways (only ipsec.1 is supported). (required) :type connection_types: list```of ``str

Parameters:public_ips – The public IPv4 addresses of the

client gateways. :type public_ips: list of str

Parameters:states – The states of the client gateways

(pending | available | deleting | deleted). :type states: list of str

Parameters:tag_keys – The keys of the tags associated with

the client gateways. :type tag_keys: list of str

Parameters:tag_values – The values of the tags associated with the

client gateways. :type tag_values: list of str

Parameters:tags – the key/value combination of the tags

associated with the client gateways, in the following format: “Filters”:{“Tags”:[“TAGKEY=TAGVALUE”]}. :type tags: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:Returns list of Client Gateway
Return type:list of dict
ex_list_consumption_account(from_date: str = None, to_date: str = None, dry_run: bool = False)[source]

Displays information about the consumption of your account for each billable resource within the specified time period.

Parameters:from_date – The beginning of the time period, in

ISO 8601 date-time format (for example, 2017-06-14 or 2017-06-14T00:00:00Z). (required) :type from_date: str

Parameters:to_date – The end of the time period, in

ISO 8601 date-time format (for example, 2017-06-30 or 2017-06-30T00:00:00Z). (required) :type to_date: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a list of Consumption Entries
Return type:list of dict
ex_list_dhcp_options(default: bool = None, dhcp_options_set_id: list = None, domaine_names: list = None, domaine_name_servers: list = None, ntp_servers: list = None, tag_keys: list = None, tag_values: list = None, tags: list = None, dry_run: bool = False)[source]

Retrieves information about the content of one or more DHCP options sets.

Parameters:default – SIf true, lists all default DHCP options set.

If false, lists all non-default DHCP options set. :type default: list of bool

Parameters:
  • dhcp_options_set_id (list of str) – The IDs of the DHCP options sets.
  • domaine_names – The domain names used for the DHCP

options sets. :type domaine_names: list of str

Parameters:domaine_name_servers – The domain name servers used for

the DHCP options sets. :type domaine_name_servers: list of str

Parameters:ntp_servers – The Network Time Protocol (NTP) servers used

for the DHCP options sets. :type ntp_servers: list of str

Parameters:tag_keys – The keys of the tags associated with the DHCP

options sets. :type ntp_servers: list of str

Parameters:tag_values – The values of the tags associated with the

DHCP options sets. :type tag_values: list of str

Parameters:tags – The key/value combination of the tags associated

with the DHCP options sets, in the following format: “Filters”:{“Tags”:[“TAGKEY=TAGVALUE”]}. :type tags: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a list of Dhcp Options
Return type:list of dict

Lists all DirectLinks in the Region.

Parameters:direct_link_interface_ids – The IDs of the DirectLink

interfaces. :type direct_link_interface_ids: list of str

Parameters:
  • direct_link_ids (list of str) – The IDs of the DirectLinks.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:list of Direct Link interfaces
Return type:list of dict

Lists all DirectLinks in the Region.

Parameters:
  • direct_link_ids (list of str) – The IDs of the DirectLinks. (required)
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:list of Direct Links
Return type:list of dict
ex_list_flexible_gpu_catalog(dry_run: bool = False)[source]

Lists all flexible GPUs available in the public catalog.

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:Returns the Flexible Gpu Catalog
Return type:list of dict
ex_list_flexible_gpus(delete_on_vm_deletion: bool = None, flexible_gpu_ids: list = None, generations: list = None, model_names: list = None, states: list = None, subregion_names: list = None, vm_ids: list = None, dry_run: bool = False)[source]

Lists one or more flexible GPUs (fGPUs) allocated to your account.

Parameters:delete_on_vm_deletion – Indicates whether the fGPU is

deleted when terminating the VM. :type delete_on_vm_deletion: bool

Parameters:
  • flexible_gpu_ids (list of str) – One or more IDs of fGPUs.
  • generations – The processor generations that the fGPUs are

compatible with. (required) :type generations: list of str

Parameters:model_names – One or more models of fGPUs. For more

information, see About Flexible GPUs: https://wiki.outscale.net/display/EN/About+Flexible+GPUs :type model_names: list of str

Parameters:states – The states of the fGPUs

(allocated | attaching | attached | detaching). :type states: list of str

Parameters:subregion_names – The Subregions where the fGPUs are

located. :type subregion_names: list of str

Parameters:
  • vm_ids (list of str) – One or more IDs of VMs.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:Returns the Flexible Gpu Catalog
Return type:list of dict
ex_list_image_export_tasks(dry_run: bool = False, task_ids: List[str] = None)[source]

Lists one or more image export tasks.

Parameters:
  • task_ids (list of str) – The IDs of the export tasks.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:image export tasks
Return type:list of dict
ex_list_internet_services(internet_service_ids: List[str] = None, link_net_ids: List[str] = None, link_states: List[str] = None, tag_keys: List[str] = None, tag_values: List[str] = None, tags: List[str] = None, dry_run: bool = False)[source]

Lists one or more of your Internet services. An Internet service enables your virtual machines (VMs) launched in a Net to connect to the Internet. By default, a Net includes an Internet service, and each Subnet is public. Every VM launched within a default Subnet has a private and a public IP addresses.

Parameters:
  • internet_service_ids (list of str) – One or more filters.
  • link_net_ids – The IDs of the Nets the Internet services

are attached to. :type link_net_ids: list of str

Parameters:link_states – The current states of the attachments

between the Internet services and the Nets (only available, if the Internet gateway is attached to a VPC). (required) :type link_states: list of str

Parameters:tag_keys – The keys of the tags associated with the

Internet services. :type tag_keys: list of str

Parameters:tag_values – The values of the tags associated with the

Internet services. :type tag_values: list of str

Parameters:tags – The key/value combination of the tags associated

with the Internet services, in the following format: “Filters”:{“Tags”:[“TAGKEY=TAGVALUE”]}. :type tags: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:Returns the list of Internet Services
Return type:list of dict
ex_list_listener_rules(listener_rule_names: List[str] = None, dry_run: bool = False)[source]

Describes one or more listener rules. By default, this action returns the full list of listener rules for the account.

Parameters:
  • listener_rule_names (list of str) – The names of the listener rules.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:Returns the list of Listener Rules
Return type:list of dict
ex_list_load_balancer_tags(load_balancer_names: List[str] = None, dry_run: bool = False)[source]

Describes the tags associated with one or more specified load balancers.

Parameters:load_balancer_names – The names of the load balancer.

(required) :type load_balancer_names: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a list of load balancer tags
Return type:list of dict
ex_list_load_balancers(load_balancer_names: List[str] = None, dry_run: bool = False)[source]

Lists one or more load balancers and their attributes.

Parameters:load_balancer_names – The names of the load balancer.

(required) :type load_balancer_names: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a list of load balancer
Return type:list of dict
ex_list_nat_services(nat_service_ids: List[str] = None, net_ids: List[str] = None, states: List[str] = None, subnet_ids: List[str] = None, tag_keys: List[str] = None, tag_values: List[str] = None, tags: List[str] = None, dry_run: bool = False)[source]

Lists one or more network address translation (NAT) services.

Parameters:
  • nat_service_ids (list of str) – The IDs of the NAT services.
  • net_ids (list of str) – The IDs of the Nets in which the NAT services are.
  • states – The states of the NAT services

(pending | available | deleting | deleted). :type states: list of str

Parameters:subnet_ids – The IDs of the Subnets in which the NAT

services are. :type subnet_ids: list of str

Parameters:tag_keys – The keys of the tags associated with the NAT

services. :type tag_keys: list of str

Parameters:tag_values – The values of the tags associated with the NAT

services. :type tag_values: list of str

Parameters:tags – The values of the tags associated with the NAT

services. :type tags: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a list of back end vms health
Return type:list of dict
ex_list_net_peerings(accepter_net_account_ids: List[str] = None, accepter_net_ip_ranges: List[str] = None, accepter_net_net_ids: List[str] = None, net_peering_ids: List[str] = None, source_net_account_ids: List[str] = None, source_net_ip_ranges: List[str] = None, source_net_net_ids: List[str] = None, state_messages: List[str] = None, states_names: List[str] = None, tag_keys: List[str] = None, tag_values: List[str] = None, tags: List[str] = None, dry_run: bool = False)[source]

Lists one or more peering connections between two Nets.

Parameters:accepter_net_account_ids – The account IDs of the owners of

the peer Nets. :type accepter_net_account_ids: list of str

Parameters:accepter_net_ip_ranges – The IP ranges of the peer Nets, in

CIDR notation (for example, 10.0.0.0/24). :type accepter_net_ip_ranges: list of str

Parameters:
  • accepter_net_net_ids (list of str) – The IDs of the peer Nets.
  • source_net_account_ids – The account IDs of the owners of

the peer Nets. :type source_net_account_ids: list of str

Parameters:
  • source_net_ip_ranges (list of str) – The IP ranges of the peer Nets.
  • source_net_net_ids (list of str) – The IDs of the peer Nets.
  • net_peering_ids (list of str) – The IDs of the Net peering connections.
  • state_messages – Additional information about the states of

the Net peering connections. :type state_messages: list of str

Parameters:states_names – The states of the Net peering connections

(pending-acceptance | active | rejected | failed | expired | deleted). :type states_names: list of str

Parameters:tag_keys – The keys of the tags associated with the Net

peering connections. :type tag_keys: list of str

Parameters:tag_values – the values of the tags associated with the

Net peering connections. :type tag_values: list of str

Parameters:tags – The key/value combination of the tags associated

with the Net peering connections, in the following format: “Filters”:{“Tags”:[“TAGKEY=TAGVALUE”]}. :type tags: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:A list of Net Access Points
Return type:list of dict
ex_list_nets(dhcp_options_set_ids: List[str] = None, ip_ranges: List[str] = None, is_default: bool = None, net_ids: List[str] = None, states: List[str] = None, tag_keys: List[str] = None, tag_values: List[str] = None, tags: List[str] = None, dry_run: bool = False)[source]

Lists one or more Nets.

Parameters:
  • dhcp_options_set_ids (list of str) – The IDs of the DHCP options sets.
  • ip_ranges – The IP ranges for the Nets, in CIDR notation

(for example, 10.0.0.0/16). :type ip_ranges: list of str

Parameters:
  • is_default (bool) – If true, the Net used is the default one.
  • net_ids (list of str) – The IDs of the Nets.
  • states (list of str) – The states of the Nets (pending | available).
  • tag_keys (list of str) – The keys of the tags associated with the Nets.
  • tag_values – The values of the tags associated with the

Nets. :type tag_values: list of str

Parameters:tags – The key/value combination of the tags associated

with the Nets, in the following format: “Filters”:{“Tags”:[“TAGKEY=TAGVALUE”]}. :type tags: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:A list of Nets
Return type:list of dict
ex_list_nets_access_point_services(service_ids: List[str] = None, service_names: List[str] = None, dry_run: bool = False)[source]

Describes 3DS OUTSCALE services available to create Net access points. For more information, see CreateNetAccessPoint: https://docs.outscale.com/api#createnetaccesspoint

Parameters:
  • service_ids (list of str) – The IDs of the services.
  • service_names – The names of the prefix lists, which

identify the 3DS OUTSCALE services they are associated with. :type service_names: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:A list of Services
Return type:list of dict
ex_list_nets_access_points(net_access_point_ids: List[str] = None, net_ids: List[str] = None, service_names: List[str] = None, states: List[str] = None, tag_keys: List[str] = None, tag_values: List[str] = None, tags: List[str] = None, dry_run: bool = False)[source]

Describes one or more Net access points.

Parameters:
  • net_access_point_ids (list of str) – The IDs of the Net access points.
  • net_ids (list of str) – The IDs of the Nets.
  • service_names – The The names of the prefix lists

corresponding to the services. For more information, see DescribePrefixLists: https://docs.outscale.com/api#describeprefixlists :type service_names: list of str

Parameters:states – The states of the Net access points

(pending | available | deleting | deleted). :type states: list of str

Parameters:tag_keys – The keys of the tags associated with the Net

access points. :type tag_keys: list of str

Parameters:tag_values – The values of the tags associated with the

Net access points. :type tag_values: list of str

Parameters:tags – The key/value combination of the tags associated

with the Net access points, in the following format: “Filters”:{“Tags”:[“TAGKEY=TAGVALUE”]}. :type tags: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:A list of Net Access Points
Return type:list of dict
ex_list_nics(link_nic_sort_numbers: List[int] = None, link_nic_vm_ids: List[str] = None, nic_ids: List[str] = None, private_ips_private_ips: List[str] = None, subnet_ids: List[str] = None, dry_run: bool = False)[source]

Lists one or more network interface cards (NICs). A NIC is a virtual network interface that you can attach to a virtual machine (VM) in a Net.

Parameters:link_nic_sort_numbers – The device numbers the NICs are

attached to. :type link_nic_sort_numbers: list of int

Parameters:link_nic_vm_ids – The IDs of the VMs the NICs are attached

to. :type link_nic_vm_ids: list of str

Parameters:
  • nic_ids (list of str) – The IDs of the NICs.
  • private_ips_private_ips – The private IP addresses of the

NICs. :type private_ips_private_ips: list of str

Parameters:
  • subnet_ids (list of str) – The IDs of the Subnets for the NICs.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:A list of the Nics
Return type:list of dict
ex_list_node_types(bsu_optimized: bool = None, memory_sizes: List[int] = None, vcore_counts: List[int] = None, vm_type_names: List[str] = None, volume_counts: List[int] = None, volume_sizes: List[int] = None, dry_run: bool = False)[source]

Lists one or more predefined VM types.

Parameters:bsu_optimized – Indicates whether the VM is optimized for

BSU I/O. :type bsu_optimized: bool

Parameters:
  • memory_sizes (list of int) – The amounts of memory, in gibibytes (GiB).
  • vcore_counts (list of int) – The numbers of vCores.
  • vm_type_names – The names of the VM types. For more

information, see Instance Types. :type vm_type_names: list of str

Parameters:volume_counts – The maximum number of ephemeral storage

disks. :type volume_counts: list of int

Parameters:volume_sizes – The size of one ephemeral storage disk,

in gibibytes (GiB). :type volume_sizes: list of int

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:list of vm types
Return type:list of dict
ex_list_nodes_states(all_vms: bool = None, subregion_names: List[str] = None, vm_ids: List[str] = None, vm_states: List[str] = None, dry_run: bool = False)[source]

Lists the status of one or more virtual machines (VMs).

Parameters:all_vms – If true, includes the status of all VMs. By

default or if set to false, only includes the status of running VMs. :type all_vms: bool

Parameters:
  • subregion_names (list of str) – The names of the Subregions of the VMs.
  • vm_ids (list of str) – One or more IDs of VMs.
  • vm_states – The states of the VMs

(pending | running | stopping | stopped | shutting-down | terminated | quarantine) :type vm_states: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:list the status of one or more vms
Return type:list of dict
ex_list_product_types(product_type_ids: List[str] = None, dry_run: bool = False)[source]

Describes one or more product types.

Parameters:
  • product_type_ids (list of str) – The IDs of the product types.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:A list of Product Type
Return type:list of dict
ex_list_public_ip_ranges(dry_run: bool = False)[source]

Lists available regions details.

Parameters:dry_run – If true, checks whether you have the

required permissions to perform the action. :type dry_run: bool

Returns:regions details
Return type:dict
ex_list_public_ips(data: str = '{}')[source]

List all public IPs.

Parameters:data – json stringify following the outscale api

documentation for filter :type data: string

Returns:nodes
Return type:dict
ex_list_quotas(collections: List[str] = None, quota_names: List[str] = None, quota_types: List[str] = None, short_descriptions: List[str] = None, dry_run: bool = False)[source]

Describes one or more of your quotas.

Parameters:
  • collections (list of str) – The group names of the quotas.
  • quota_names (list of str) – The names of the quotas.
  • quota_types – The resource IDs if these are

resource-specific quotas, global if they are not. :type quota_types: list of str

Parameters:
  • short_descriptions (list of str) – The description of the quotas.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:A list of Product Type
Return type:list of dict
ex_list_regions(ex_dry_run: bool = False)[source]

Lists available regions details.

Parameters:ex_dry_run – If true, checks whether you have the required

permissions to perform the action. :type ex_dry_run: bool :return: regions details :rtype: dict

ex_list_route_tables(link_route_table_ids: List[str] = None, link_route_table_link_route_table_ids: List[str] = None, link_route_table_main: bool = None, link_subnet_ids: List[str] = None, net_ids: List[str] = None, route_creation_methods: List[str] = None, route_destination_ip_ranges: List[str] = None, route_destination_service_ids: List[str] = None, route_gateway_ids: List[str] = None, route_nat_service_ids: List[str] = None, route_net_peering_ids: List[str] = None, route_states: List[str] = None, route_table_ids: List[str] = None, route_vm_ids: List[str] = None, tag_keys: List[str] = None, tag_values: List[str] = None, tags: List[str] = None, dry_run: bool = False)[source]

Lists one or more of your route tables. In your Net, each Subnet must be associated with a route table. If a Subnet is not explicitly associated with a route table, it is implicitly associated with the main route table of the Net.

Parameters:link_route_table_ids – The IDs of the route tables involved

in the associations. :type link_route_table_ids: list of str

Parameters:link_route_table_link_route_table_ids – The IDs of the

associations between the route tables and the Subnets. :type link_route_table_link_route_table_ids: list of str

Parameters:link_route_table_main – If true, the route tables are the

main ones for their Nets. :type link_route_table_main: bool

Parameters:link_subnet_ids – The IDs of the Subnets involved in the

associations. :type link_subnet_ids: list of str

Parameters:net_ids – The IDs of the route tables involved

in the associations. :type net_ids: list of str

Parameters:
  • route_creation_methods (list of str) – The methods used to create a route.
  • route_destination_ip_ranges – The IP ranges specified in

routes in the tables. :type route_destination_ip_ranges: list of str

Parameters:route_destination_service_ids – The service IDs specified

in routes in the tables. :type route_destination_service_ids: list of str

Parameters:route_gateway_ids – The IDs of the gateways specified in

routes in the tables. :type route_gateway_ids: list of str

Parameters:route_nat_service_ids – The IDs of the NAT services

specified in routes in the tables. :type route_nat_service_ids: list of str

Parameters:route_net_peering_ids – The IDs of the Net peering

connections specified in routes in the tables. :type route_net_peering_ids: list of str

Parameters:route_states – The states of routes in the route tables

(active | blackhole). The blackhole state indicates that the target of the route is not available. :type route_states: list of str

Parameters:
  • route_table_ids (list of str) – The IDs of the route tables.
  • route_vm_ids – The IDs of the VMs specified in routes in

the tables. :type route_vm_ids: list of str

Parameters:tag_keys – The keys of the tags associated with the route

tables. :type tag_keys: list of str

Parameters:tag_values – The values of the tags associated with the

route tables. :type tag_values: list of str

Parameters:tags – The key/value combination of the tags associated

with the route tables, in the following format: “Filters”:{“Tags”:[“TAGKEY=TAGVALUE”]}. :type tags: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:list of Route Tables
Return type:list of dict
ex_list_secret_access_key(access_key_id: str = None, dry_run: bool = False)[source]

Gets information about the secret access key associated with the account that sends the request.

Parameters:
  • access_key_id (str) – The ID of the access key. (required)
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:Access Key
Return type:dict
ex_list_security_groups(account_ids: List[str] = None, net_ids: List[str] = None, security_group_ids: List[str] = None, security_group_names: List[str] = None, tag_keys: List[str] = None, tag_values: List[str] = None, tags: List[str] = None, dry_run: bool = False)[source]

Lists one or more security groups. You can specify either the name of the security groups or their IDs.

Parameters:account_ids – The account IDs of the owners of the security

groups. :type account_ids: list of str

Parameters:net_ids – The IDs of the Nets specified when the security

groups were created. :type net_ids: list of str

Parameters:
  • security_group_ids (list of str) – The IDs of the security groups.
  • security_group_names (list of str) – The names of the security groups.
  • tag_keys – the keys of the tags associated with the

security groups. :type tag_keys: list of str

Parameters:tag_values – The values of the tags associated with the

security groups. :type tag_values: list of str

Parameters:tags – the key/value combination of the tags associated

with the security groups, in the following format: “Filters”:{“Tags”:[“TAGKEY=TAGVALUE”]}. :type tags: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a list of Security Groups
Return type:list of dict
ex_list_server_certificates(paths: str = None, dry_run: bool = False)[source]

List your server certificates.

Parameters:
  • paths (str) – The path to the server certificate.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:server certificate
Return type:list of dict
ex_list_snapshot_export_tasks(dry_run: bool = False, task_ids: List[str] = None)[source]

Lists one or more image export tasks.

Parameters:
  • task_ids (list of str) – The IDs of the export tasks.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:snapshot export tasks
Return type:list of dict
ex_list_subnets(available_ip_counts: List[str] = None, ip_ranges: List[str] = None, net_ids: List[str] = None, states: List[str] = None, subnet_ids: List[str] = None, subregion_names: List[str] = None, tag_keys: List[str] = None, tag_values: List[str] = None, tags: List[str] = None, dry_run: bool = False)[source]

Lists one or more of your Subnets. If you do not specify any Subnet ID, this action describes all of your Subnets.

Parameters:
  • available_ip_counts (str) – The number of available IPs.
  • ip_ranges – The IP ranges in the Subnets, in CIDR notation

(for example, 10.0.0.0/16). :type ip_ranges: str

Parameters:
  • net_ids (str) – The IDs of the Nets in which the Subnets are.
  • states (str) – The states of the Subnets (pending | available).
  • subnet_ids (str) – The IDs of the Subnets.
  • subregion_names – The names of the Subregions in which the

Subnets are located. :type subregion_names: str

Parameters:tag_keys – the keys of the tags associated with the

subnets. :type tag_keys: list of str

Parameters:tag_values – The values of the tags associated with the

subnets. :type tag_values: list of str

Parameters:tags – the key/value combination of the tags associated

with the subnets, in the following format: “Filters”:{“Tags”:[“TAGKEY=TAGVALUE”]}. :type tags: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a list of Subnets
Return type:list of dict
ex_list_subregions(ex_dry_run: bool = False)[source]

Lists available subregions details.

Parameters:ex_dry_run – If true, checks whether you have the required

permissions to perform the action. :type ex_dry_run: bool :return: subregions details :rtype: dict

ex_list_tags(resource_ids: list = None, resource_types: list = None, keys: list = None, values: list = None, dry_run: bool = False)[source]

Lists one or more tags for your resources.

Parameters:
  • resource_ids (list) – One or more resource IDs.
  • resource_types (list) – One or more resource IDs.
  • keys (list) – One or more resource IDs.
  • values (list) – One or more resource IDs.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:list of tags
Return type:list of dict
ex_list_virtual_gateways(connection_types: List[str] = None, link_net_ids: List[str] = None, link_states: List[str] = None, states: List[str] = None, tag_keys: List[str] = None, tag_values: List[str] = None, tags: List[str] = None, virtual_gateway_id: List[str] = None, dry_run: bool = False)[source]

Lists one or more virtual gateways.

Parameters:connection_types – The types of the virtual gateways

(only ipsec.1 is supported). :type connection_types: list of dict

Parameters:link_net_ids – The IDs of the Nets the virtual gateways

are attached to. :type link_net_ids: list of dict

Parameters:link_states – The current states of the attachments

between the virtual gateways and the Nets (attaching | attached | detaching | detached). :type link_states: list of dict

Parameters:states – The states of the virtual gateways

(pending | available | deleting | deleted). :type states: list of dict

Parameters:tag_keys – The keys of the tags associated with the

virtual gateways. :type tag_keys: list of dict

Parameters:tag_values – The values of the tags associated with

the virtual gateways. :type tag_values: list of dict

Parameters:tags – The key/value combination of the tags associated

with the virtual gateways, in the following format: “Filters”:{“Tags”:[“TAGKEY=TAGVALUE”]}. :type tags: list of dict

Parameters:
  • virtual_gateway_id (list of dict) – The IDs of the virtual gateways.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:list of virtual gateway
Return type:list of dict
ex_list_vms_health(backend_vm_ids: List[str] = None, load_balancer_name: str = None, dry_run: bool = False)[source]

Lists the state of one or more back-end virtual machines (VMs) registered with a specified load balancer.

Parameters:load_balancer_name – The name of the load balancer.

(required) :type load_balancer_name: str

Parameters:
  • backend_vm_ids (list of str) – One or more IDs of back-end VMs.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a list of back end vms health
Return type:list of dict
ex_list_vpn_connections(bgp_asns: List[int] = None, client_gateway_ids: List[str] = None, connection_types: List[str] = None, route_destination_ip_ranges: List[str] = None, states: List[str] = None, static_routes_only: bool = None, tag_keys: List[str] = None, tag_values: List[str] = None, tags: List[str] = None, dry_run: bool = False)[source]

Describes one or more VPN connections.

Parameters:bgp_asns – The Border Gateway Protocol (BGP) Autonomous

System Numbers (ASNs) of the connections. :type bgp_asns: list of int

Parameters:
  • client_gateway_ids (list of str) – The IDs of the client gateways.
  • connection_types – The types of the VPN connections (only

ipsec.1 is supported). :type connection_types: list of str

Parameters:states – The states of the vpn connections

(pending | available). :type states: str

Parameters:
  • route_destination_ip_ranges (str) – The destination IP ranges.
  • static_routes_only – If false, the VPN connection uses

dynamic routing with Border Gateway Protocol (BGP). If true, routing is controlled using static routes. For more information about how to create and delete static routes, see CreateVpnConnectionRoute: https://docs.outscale.com/api#createvpnconnectionroute and DeleteVpnConnectionRoute: https://docs.outscale.com/api#deletevpnconnectionroute :type static_routes_only: bool

Parameters:tag_keys – the keys of the tags associated with the

subnets. :type tag_keys: list of str

Parameters:tag_values – The values of the tags associated with the

subnets. :type tag_values: list of str

Parameters:tags – the key/value combination of the tags associated

with the subnets, in the following format: “Filters”:{“Tags”:[“TAGKEY=TAGVALUE”]}. :type tags: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a list of Subnets
Return type:list of dict
ex_read_account(dry_run: bool = False)[source]

Gets information about the account that sent the request.

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:the account information
Return type:dict
ex_read_admin_password_node(node: libcloud.compute.base.Node, dry_run: bool = False)[source]

Retrieves the administrator password for a Windows running virtual machine (VM). The administrator password is encrypted using the keypair you specified when launching the VM.

Parameters:
  • node (Node) – the ID of the VM (required)
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The Admin Password of the specified Node.
Return type:str
ex_read_api_access_rules(api_access_rules_ids: List[str] = None, ca_ids: List[str] = None, cns: List[str] = None, descriptions: List[str] = None, ip_ranges: List[str] = None, dry_run: bool = False)[source]

Read API access rules.

Parameters:api_access_rules_ids – The List containing rules ids to

filter the request. :type api_access_rules_ids: List of str

Parameters:
  • ca_ids (List of str) – The List containing CA ids to filter the request.
  • cns (List of str) – The List containing cns to filter the request.
  • descriptions – The List containing descriptions to filter

the request. :type descriptions: List of str

Parameters:ip_ranges – The List containing ip ranges in CIDR notation

(for example, 192.0.2.0/16) to filter the request. :type ip_ranges: List of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a List of API access rules.
Return type:List of dict if successful or dict
ex_read_certificate_authorities(ca_fingerprints: List[str] = None, ca_ids: List[str] = None, descriptions: List[str] = None, dry_run: bool = False)[source]

Returns information about one or more of your Client Certificate Authorities (CAs).

Parameters:
  • ca_fingerprints (list of str) – The fingerprints of the CAs.
  • ca_ids (list of str) – The IDs of the CAs.
  • descriptions (list of str) – The descriptions of the CAs.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a list of all Ca matching filled filters.
Return type:list of dict
ex_read_console_output_node(node: libcloud.compute.base.Node, dry_run: bool = False)[source]

Gets the console output for a virtual machine (VM). This console provides the most recent 64 KiB output.

Parameters:
  • node (Node) – the ID of the VM (required)
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The Console Output of the specified Node.
Return type:str
ex_register_vms_in_load_balancer(backend_vm_ids: List[str] = None, load_balancer_name: str = None, dry_run: bool = False)[source]

Registers one or more virtual machines (VMs) with a specified load balancer. The VMs must be running in the same network as the load balancer (in the public Cloud or in the same Net). It may take a little time for a VM to be registered with the load balancer. Once the VM is registered with a load balancer, it receives traffic and requests from this load balancer and is called a back-end VM.

Parameters:load_balancer_name – The name of the load balancer.

(required) :type load_balancer_name: str

Parameters:
  • backend_vm_ids (list of str) – One or more IDs of back-end VMs.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a list of back end vms health
Return type:list of dict
ex_reject_net_peering(net_peering_id: List[str] = None, dry_run: bool = False)[source]

Rejects a Net peering connection request. The Net peering connection must be in the pending-acceptance state to be rejected. The rejected Net peering connection is then in the rejected state.

Parameters:net_peering_id – The ID of the Net peering connection you

want to reject. (required) :type net_peering_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The rejected Net Peering
Return type:dict
ex_reset_account_password(password: str = '', token: str = '', dry_run: bool = False)[source]

Sends an email to the email address provided for the account with a token to reset your password.

Parameters:
  • password (str) – The new password for the account.
  • token – The token you received at the email address

provided for the account. :type token: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_send_reset_password_email(email: str, dry_run: bool = False)[source]

Replaces the account password with the new one you provide. You must also provide the token you received by email when asking for a password reset using the SendResetPasswordEmail method.

Parameters:
  • email (str) – The email address provided for the account.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool

Detaches a flexible GPU (fGPU) from a virtual machine (VM). The fGPU is in the detaching state until the VM is stopped, after which it becomes available for allocation again.

Parameters:flexible_gpu_id – The ID of the fGPU you want to attach.

(required) :type flexible_gpu_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool

Detaches an Internet service from a Net. This action disables and detaches an Internet service from a Net. The Net must not contain any running virtual machine (VM) using an External IP address (EIP).

Parameters:internet_service_id – The ID of the Internet service you

want to detach. (required) :type internet_service_id: str

Parameters:net_id – The ID of the Net from which you want to detach

the Internet service. (required) :type net_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool

Detaches a network interface card (NIC) from a virtual machine (VM). The primary NIC cannot be detached.

Parameters:link_nic_id – The ID of the NIC you want to delete.

(required) :type link_nic_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool

Unassigns one or more secondary private IPs from a network interface card (NIC).

Parameters:
  • nic_id (str) – The ID of the NIC. (required)
  • private_ips – One or more secondary private IP addresses

you want to unassign from the NIC. (required) :type private_ips: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool

Disassociates a Subnet from a route table. After disassociation, the Subnet can no longer use the routes in this route table, but uses the routes in the main route table of the Net instead.

Parameters:
  • link_route_table_id (str) – The ID of the route table. (required)
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool

Detaches a virtual gateway from a Net. You must wait until the virtual gateway is in the detached state before you can attach another Net to it or delete the Net it was previously attached to.

Parameters:net_id – The ID of the Net from which you want to detach

the virtual gateway. (required) :type net_id: str

Parameters:virtual_gateway_id – The ID of the Net from which you

want to detach the virtual gateway. (required) :type virtual_gateway_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:True if the action is successful
Return type:bool
ex_update_access_key(access_key_id: str = None, state: str = None, dry_run: bool = False)[source]

Modifies the status of the specified access key associated with the account that sends the request. When set to ACTIVE, the access key is enabled and can be used to send requests. When set to INACTIVE, the access key is disabled.

Parameters:
  • access_key_id (str) – The ID of the access key. (required)
  • state – The new state of the access key

(ACTIVE | INACTIVE). (required) :type state: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:Access Key
Return type:dict
ex_update_account(city: str = None, company_name: str = None, country: str = None, email: str = None, first_name: str = None, last_name: str = None, zip_code: str = None, job_title: str = None, mobile_number: str = None, phone_number: str = None, state_province: str = None, vat_number: str = None, dry_run: bool = False)[source]

Updates the account information for the account that sends the request.

Parameters:
  • city (str) – The city of the account owner.
  • company_name – The name of the company for the account.

permissions to perform the action. :type company_name: str

Parameters:
  • country (str) – The country of the account owner.
  • email (str) – The email address for the account.
  • first_name (str) – The first name of the account owner.
  • last_name (str) – The last name of the account owner.
  • zip_code (str) – The ZIP code of the city.
  • job_title (str) – The job title of the account owner.
  • mobile_number – The mobile phone number of the account

owner. :type mobile_number: str

Parameters:phone_number – The landline phone number of the account

owner. :type phone_number: str

Parameters:
  • state_province (str) – The state/province of the account.
  • vat_number – The value added tax (VAT) number for

the account. :type vat_number: str

Parameters:dry_run (bool) – the password of the account
Returns:The new account information
Return type:dict
ex_update_api_access_rule(api_access_rule_id: str, ca_ids: List[str] = None, cns: List[str] = None, description: str = None, ip_ranges: List[str] = None, dry_run: bool = False)[source]

Update an API access rules. The new rule you specify fully replaces the old rule. Therefore, for a parameter that is not specified, any previously set value is deleted.

Parameters:api_access_rule_id – The id of the rule we want to update

(required). :type api_access_rule_id: str

Parameters:ca_ids – One or more IDs of Client Certificate Authorities

(CAs). :type ca_ids: List of str

Parameters:cns – One or more Client Certificate Common Names (CNs).

If this parameter is specified, you must also specify the ca_ids parameter. :type cns: List of str

Parameters:
  • description (str) – The description of the new rule.
  • ip_ranges – One or more IP ranges, in CIDR notation

(for example, 192.0.2.0/16). :type ip_ranges: List of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a List of API access rules.
Return type:List of dict if successful or dict
ex_update_certificate_authority(ca_id: str, description: str = None, dry_run: bool = False)[source]

Modifies the specified attribute of a Client Certificate Authority (CA).

Parameters:
  • ca_id (str) – The ID of the CA. (required)
  • description (str) – The description of the CA.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a the created Ca or the request result.
Return type:dict
ex_update_flexible_gpu(delete_on_vm_deletion: bool = None, flexible_gpu_id: str = None, dry_run: bool = False)[source]

Modifies a flexible GPU (fGPU) behavior.

Parameters:delete_on_vm_deletion – If true, the fGPU is deleted when

the VM is terminated. :type delete_on_vm_deletion: bool

Parameters:
  • flexible_gpu_id (str) – The ID of the fGPU you want to modify.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:the updated Flexible GPU
Return type:dict
ex_update_image(dry_run: bool = False, image: libcloud.compute.base.NodeImage = None, perm_to_launch_addition_account_ids: List[str] = None, perm_to_launch_addition_global_permission: bool = None, perm_to_launch_removals_account_ids: List[str] = None, perm_to_launch_removals_global_permission: bool = None)[source]

Modifies the specified attribute of an Outscale machine image (OMI). You can specify only one attribute at a time. You can modify the permissions to access the OMI by adding or removing account IDs or groups. You can share an OMI with a user that is in the same Region. The user can create a copy of the OMI you shared, obtaining all the rights for the copy of the OMI. For more information, see CreateImage.

Parameters:
  • image (NodeImage) – The ID of the OMI to export. (required)
  • perm_to_launch_addition_account_ids – The account

ID of one or more users who have permissions for the resource. :type perm_to_launch_addition_account_ids: list of dict

Parameters:perm_to_launch_addition_global_permission

If true, the resource is public. If false, the resource is private. :type perm_to_launch_addition_global_permission: boolean

Parameters:perm_to_launch_removals_account_ids – The account

ID of one or more users who have permissions for the resource. :type perm_to_launch_removals_account_ids: list of dict

Parameters:perm_to_launch_removals_global_permission – If true,

the resource is public. If false, the resource is private. :type perm_to_launch_removals_global_permission: boolean

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:the new image
Return type:dict
ex_update_listener_rule(host_pattern: str = None, listener_rule_name: str = None, path_pattern: str = None, dry_run: bool = False)[source]

Updates the pattern of the listener rule. This call updates the pattern matching algorithm for incoming traffic.

Parameters:host_pattern – TA host-name pattern for the rule, with a

maximum length of 128 characters. This host-name pattern supports maximum three wildcards, and must not contain any special characters except [-.?]. :type host_pattern: ``str`

Parameters:listener_rule_name – The name of the listener rule.

(required) :type listener_rule_name: str

Parameters:path_pattern – A path pattern for the rule, with a maximum

length of 128 characters. This path pattern supports maximum three wildcards, and must not contain any special characters except [_-.$/~”’@:+?]. :type path_pattern: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:Update the specified Listener Rule
Return type:dict
ex_update_load_balancer(access_log_is_enabled: bool = None, access_log_osu_bucket_name: str = None, access_log_osu_bucket_prefix: str = None, access_log_publication_interval: int = None, health_check_interval: int = None, health_check_healthy_threshold: int = None, health_check_path: str = None, health_check_port: int = None, health_check_protocol: str = None, health_check_timeout: int = None, health_check_unhealthy_threshold: int = None, load_balancer_name: str = None, load_balancer_port: int = None, policy_names: List[str] = None, server_certificate_id: str = None, dry_run: bool = False)[source]

Modifies the specified attributes of a load balancer.

You can set a new SSL certificate to an SSL or HTTPS listener of a load balancer. This certificate replaces any certificate used on the same load balancer and port.

You can also replace the current set of policies for a load balancer with another specified one. If the PolicyNames parameter is empty, all current policies are disabled.

Parameters:access_log_is_enabled – If true, access logs are enabled

for your load balancer. If false, they are not. If you set this to true in your request, the OsuBucketName parameter is required. :type access_log_is_enabled: ``bool`

Parameters:access_log_osu_bucket_name – The name of the Object Storage

Unit (OSU) bucket for the access logs. :type access_log_osu_bucket_name: str

Parameters:access_log_osu_bucket_prefix – The path to the folder of

the access logs in your Object Storage Unit (OSU) bucket (by default, the root level of your bucket). :type access_log_osu_bucket_prefix: str

Parameters:access_log_publication_interval – The time interval for the

publication of access logs in the Object Storage Unit (OSU) bucket, in minutes. This value can be either 5 or 60 (by default, 60). :type access_log_publication_interval: int

Parameters:health_check_interval – Information about the health check

configuration. (required) :type health_check_interval: int

Parameters:health_check_path – The path for HTTP or HTTPS requests.

(required) :type health_check_path: str

Parameters:health_check_port – The port number (between 1 and 65535,

both included). (required) :type health_check_port: int

Parameters:health_check_protocol – The protocol for the URL of the VM

(HTTP | HTTPS | TCP | SSL | UDP). (required) :type health_check_protocol: str

Parameters:health_check_timeout – The maximum waiting time for a

response before considering the VM as unhealthy, in seconds (between 2 and 60 both included). (required) :type health_check_timeout: int

Parameters:health_check_healthy_threshold – The number of consecutive

failed pings before considering the VM as unhealthy (between 2 and 10 both included). (required) :type health_check_healthy_threshold: int

Parameters:health_check_unhealthy_threshold – The number of

consecutive failed pings before considering the VM as unhealthy (between 2 and 10 both included).(required) :type health_check_unhealthy_threshold: int

Parameters:load_balancer_name – The name of the load balancer.

(required) :type load_balancer_name: str

Parameters:load_balancer_port – The port on which the load balancer is

listening (between 1 and 65535, both included). :type load_balancer_port: int

Parameters:policy_names – The list of policy names (must contain all

the policies to be enabled). :type policy_names: list of str

Parameters:server_certificate_id – The list of policy names (must

contain all the policies to be enabled). :type server_certificate_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:Update the specified Load Balancer
Return type:dict
ex_update_net(net_id: str = None, dhcp_options_set_id: str = None, dry_run: bool = False)[source]

Associates a DHCP options set with a specified Net.

Parameters:
  • net_id (str) – The ID of the Net. (required)
  • dhcp_options_set_id – The ID of the DHCP options set

(or default if you want to associate the default one). (required) :type dhcp_options_set_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The modified Nat Service
Return type:dict
ex_update_net_access_point(add_route_table_ids: List[str] = None, net_access_point_id: str = None, remove_route_table_ids: List[str] = None, dry_run: bool = False)[source]

Modifies the attributes of a Net access point. This action enables you to add or remove route tables associated with the specified Net access point.

Parameters:add_route_table_ids – One or more IDs of route tables to

associate with the specified Net access point. :type add_route_table_ids: list of str

Parameters:net_access_point_id – The ID of the Net access point.

(required) :type net_access_point_id: str

Parameters:remove_route_table_ids – One or more IDs of route tables to

disassociate from the specified Net access point. :type remove_route_table_ids: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The modified Net Access Point
Return type:dict
ex_update_nic(description: str = None, link_nic_delete_on_vm_deletion: str = None, link_nic_id: str = None, security_group_ids: List[str] = None, nic_id: str = None, dry_run: bool = False)[source]

Modifies the specified network interface card (NIC). You can specify only one attribute at a time.

Parameters:
  • description (str) – A new description for the NIC.
  • link_nic_delete_on_vm_deletion – If true, the NIC is

deleted when the VM is terminated. :type link_nic_delete_on_vm_deletion: str

Parameters:
  • link_nic_id (str) – The ID of the NIC attachment.
  • security_group_ids – One or more IDs of security groups

for the NIC. :type security_group_ids: list of str

Parameters:
  • nic_id (list of str) – The ID of the NIC you want to modify. (required)
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The new Nic
Return type:dict
ex_update_node(block_device_mapping: List[dict], bsu_optimized: bool = None, deletion_protection: bool = False, is_source_dest_checked: bool = None, keypair_name: str = True, performance: str = True, security_group_ids: List[str] = None, user_data: str = False, vm_id: str = None, vm_initiated_shutown_behavior: str = None, vm_type: int = None, dry_run: bool = False)[source]

Modifies a specific attribute of a Node (VM). You can modify only one attribute at a time. You can modify the IsSourceDestChecked attribute only if the VM is in a Net. You must stop the VM before modifying the following attributes:

  • VmType
  • UserData
  • BsuOptimized
Parameters:block_device_mapping – One or more block device mappings

of the VM. :type block_device_mapping: dict

Parameters:
  • bsu_optimized (bool) – If true, the VM is optimized for BSU I/O.
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Parameters:deletion_protection – If true, you cannot terminate the VM

using Cockpit, the CLI or the API. If false, you can. :type deletion_protection: bool

Parameters:is_source_dest_checked – (Net only) If true, the

source/destination check is enabled. If false, it is disabled. This value must be false for a NAT VM to perform network address translation (NAT) in a Net. :type is_source_dest_checked: bool

Parameters:
  • keypair_name (str) – The name of the keypair.
  • performance – The performance of the VM

(standard | high | highest). :type performance: str

Parameters:security_group_ids – One or more IDs of security groups for

the VM. :type security_group_ids: bool

Parameters:
  • user_data (str) – The Base64-encoded MIME user data.
  • vm_id (str) – The ID of the VM. (required)
  • vm_initiated_shutown_behavior – The VM behavior when you

stop it. By default or if set to stop, the VM stops. If set to restart, the VM stops then automatically restarts. If set to terminate, the VM stops and is terminated. :type vm_initiated_shutown_behavior: str

Parameters:vm_type – The type of VM. For more information,

see Instance Types: https://wiki.outscale.net/display/EN/Instance+Types :type vm_type: str

Returns:the updated Node
Return type:dict
ex_update_route(destination_ip_range: str = None, gateway_id: str = None, nat_service_id: str = None, net_peering_id: str = None, nic_id: str = None, route_table_id: str = None, vm_id: str = None, dry_run: bool = False)[source]

Replaces an existing route within a route table in a Net. You must specify one of the following elements as the target:

  • Net peering connection
  • NAT virtual machine (VM)
  • Internet service
  • Virtual gateway
  • NAT service
  • Network interface card (NIC)

The routing algorithm is based on the most specific match.

Parameters:destination_ip_range – The IP range used for the

destination match, in CIDR notation (for example, 10.0.0.0/24). (required) :type destination_ip_range: str

Parameters:gateway_id – The ID of an Internet service or virtual

gateway attached to your Net. :type gateway_id: str

Parameters:
  • nat_service_id (str) – The ID of a NAT service.
  • net_peering_id (str) – The ID of a Net peering connection.
  • nic_id (str) – The ID of a NIC.
  • vm_id – The ID of a NAT VM in your Net (attached to exactly

one NIC). :type vm_id: str

Parameters:route_table_id – The ID of the route table for which you

want to create a route. (required) :type route_table_id: str`

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The updated Route
Return type:dict
ex_update_route_propagation(enable: bool = None, route_table_id: str = None, virtual_gateway_id: str = None, dry_run: bool = False)[source]

Configures the propagation of routes to a specified route table of a Net by a virtual gateway.

Parameters:enable – If true, a virtual gateway can propagate routes

to a specified route table of a Net. If false, the propagation is disabled. (required) :type enable: boolean

Parameters:
  • route_table_id (str) – The ID of the route table. (required)
  • virtual_gateway_id – The ID of the virtual

gateway. (required) :type virtual_gateway_id: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:route propagation
Return type:dict
ex_update_server_certificate(name: str = None, new_name: str = None, new_path: str = None, dry_run: bool = False)[source]

Modifies the name and/or the path of a specified server certificate.

Parameters:name – The name of the server certificate

you want to modify. :type name: str

Parameters:new_name (str) – A new name for the server certificate.

:param new_path:A new path for the server certificate. :type new_path: str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:the new server certificate
Return type:dict
ex_update_snapshot(perm_to_create_volume_addition_account_id: List[str] = None, perm_to_create_volume_addition_global_perm: bool = None, perm_to_create_volume_removals_account_id: List[str] = None, perm_to_create_volume_removals_global_perm: bool = None, snapshot: libcloud.compute.base.VolumeSnapshot = None, dry_run: bool = False)[source]

Modifies the permissions for a specified snapshot. You can add or remove permissions for specified account IDs or groups. You can share a snapshot with a user that is in the same Region. The user can create a copy of the snapshot you shared, obtaining all the rights for the copy of the snapshot.

Parameters:perm_to_create_volume_addition_account_id

The account ID of one or more users who have permissions for the resource. :type perm_to_create_volume_addition_account_id: list of str

Parameters:perm_to_create_volume_addition_global_perm – If true,

the resource is public. If false, the resource is private. :type perm_to_create_volume_addition_global_perm: bool

Parameters:perm_to_create_volume_removals_account_id – The account ID of one or more users who have permissions for the resource.

list of str

Parameters:
  • perm_to_create_volume_removals_global_perm (bool) – If true, the resource is public. If false, the resource is private.
  • snapshot (VolumeSnapshot) – The ID of the snapshot. (required)
  • dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:snapshot export tasks
Return type:list of dict
ex_update_subnet(subnet_id: str = None, map_public_ip_on_launch: bool = None, dry_run: bool = False)[source]

Deletes a specified Subnet. You must terminate all the running virtual machines (VMs) in the Subnet before deleting it.

Parameters:subnet_id – The ID of the Subnet you want to delete.

(required) :type subnet_id: str

Parameters:map_public_ip_on_launch – If true, a public IP address is

assigned to the network interface cards (NICs) created in the s specified Subnet. (required) :type map_public_ip_on_launch: bool

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:The updated Subnet
Return type:dict
get_image(image_id: str)[source]

Get a specific image.

Parameters:image_id (str) – the ID of the image you want to select (required)
Returns:the selected image
Return type:dict
get_key_pair(name: str)[source]

Get a specific key pair.

Parameters:name (str) – the name of the key pair you want to select (required)
Returns:the selected key pair
Return type:dict
list_images(account_aliases: List[str] = None, account_ids: List[str] = None, architectures: List[str] = None, block_device_mapping_delete_on_vm_deletion: bool = False, block_device_mapping_device_names: List[str] = None, block_device_mapping_snapshot_ids: List[str] = None, block_device_mapping_volume_sizes: List[int] = None, block_device_mapping_volume_types: List[str] = None, descriptions: List[str] = None, file_locations: List[str] = None, image_ids: List[str] = None, image_names: List[str] = None, permission_to_launch_account_ids: List[str] = None, permission_to_lauch_global_permission: bool = False, root_device_names: List[str] = None, root_device_types: List[str] = None, states: List[str] = None, tag_keys: List[str] = None, tag_values: List[str] = None, tags: List[str] = None, virtualization_types: List[str] = None, dry_run: bool = False)[source]

Lists one or more Outscale machine images (OMIs) you can use.

Parameters:account_aliases – The account aliases of the

owners of the OMIs. :type account_aliases: list of str

Parameters:account_ids – The account IDs of the owners of the

OMIs. By default, all the OMIs for which you have launch permissions are described. :type account_ids: list of str

Parameters:architectures – The architectures of the

OMIs (i386 | x86_64). :type architectures: list of str

Parameters:block_device_mapping_delete_on_vm_deletion – Indicates

whether the block device mapping is deleted when terminating the VM. :type block_device_mapping_delete_on_vm_deletion: bool

Parameters:block_device_mapping_device_names – The device names for

the volumes. :type block_device_mapping_device_names: list of str

Parameters:block_device_mapping_snapshot_ids – The IDs of the

snapshots used to create the volumes. :type block_device_mapping_snapshot_ids: list of str

Parameters:block_device_mapping_volume_sizes – The sizes of the

volumes, in gibibytes (GiB). :type block_device_mapping_volume_sizes: list of int

Parameters:block_device_mapping_volume_types – The types of

volumes (standard | gp2 | io1). :type block_device_mapping_volume_types: list of str

Parameters:descriptions – The descriptions of the OMIs, provided

when they were created. :type descriptions: list of str

Parameters:file_locations – The locations where the OMI files are

stored on Object Storage Unit (OSU). :type file_locations: list of str

Parameters:
  • image_ids (list of str) – The IDs of the OMIs.
  • image_names – The names of the OMIs, provided when

they were created. :type image_names: list of str

Parameters:permission_to_launch_account_ids – The account IDs of the

users who have launch permissions for the OMIs. :type permission_to_launch_account_ids: list of str

Parameters:permission_to_lauch_global_permission – If true, lists

all public OMIs. If false, lists all private OMIs. :type permission_to_lauch_global_permission: list of str

Parameters:root_device_names – The device names of the root

devices (for example, /dev/sda1). :type root_device_names: list of str

Parameters:root_device_types – The types of root device used by

the OMIs (always bsu). :type root_device_types: list of str

Parameters:states – The states of the OMIs

(pending | available | failed). :type states: list of str

Parameters:
  • tag_keys (list of str) – The keys of the tags associated with the OMIs.
  • tag_values – The values of the tags associated

with the OMIs. :type tag_values: list of str

Parameters:tags – The key/value combination of the tags associated

with the OMIs, in the following format:”Filters”: {“Tags”:[“TAGKEY=TAGVALUE”]}. :type tags: list of str

Parameters:virtualization_types – The virtualization types

(always hvm). :type virtualization_types: list of str

Parameters:dry_run – If true, checks whether you have the required

permissions to perform the action. :type dry_run: bool

Returns:a list of image
Return type:list of dict
list_key_pairs(ex_data: str = '{}')[source]

List all key pairs.

Returns:key pairs
Return type:dict
list_locations(ex_dry_run: bool = False)[source]

Lists available locations details.

Parameters:ex_dry_run – If true, checks whether you have the required

permissions to perform the action. :type ex_dry_run: bool :return: locations details :rtype: dict

list_nodes(ex_data: str = '{}')[source]

List all nodes.

Returns:nodes
Return type:dict
list_snapshots(ex_data: str = '{}')[source]

List all volume snapshots.

Returns:snapshots
Return type:dict
list_volume_snapshots(volume)[source]

List all snapshot for a given volume.

Parameters:volume (StorageVolume) – the volume from which to look for snapshots
Return type:list of :class VolumeSnapshot
list_volumes(ex_data: str = '{}')[source]

List all volumes. :rtype: list of StorageVolume

name = 'Outscale API'
reboot_node(node: libcloud.compute.base.Node)[source]

Reboot instance.

Parameters:node (list) – VM(s) you want to reboot (required)
Returns:the rebooted instances
Return type:dict
start_node(node: libcloud.compute.base.Node)[source]

Start a Vm.

Parameters:node (Node) – the VM(s) you want to start (required)
Returns:the rebooted instances
Return type:bool
stop_node(node: libcloud.compute.base.Node)[source]

Stop a Vm.

Parameters:node (Node) – the VM(s) you want to stop (required)
Returns:the rebooted instances
Return type:bool
type = 'outscale'
website = 'http://www.outscale.com'

libcloud.compute.drivers.ovh module

Ovh driver

class libcloud.compute.drivers.ovh.OvhNodeDriver(key, secret, ex_project_id, ex_consumer_key=None, region=None)[source]

Bases: libcloud.compute.base.NodeDriver

Libcloud driver for the Ovh API

For more information on the Ovh API, read the official reference:

Instantiate the driver with the given API credentials.

Parameters:
  • key (str) – Your application key (required)
  • secret (str) – Your application secret (required)
  • ex_project_id (str) – Your project ID
  • ex_consumer_key (str) – Your consumer key (required)
  • region (str) – The datacenter to connect to (optional)
Return type:

None

NODE_STATE_MAP = {'ACTIVE': running, 'BUILD': pending, 'DELETED': terminated, 'DELETE_IP': pending, 'ERROR': error, 'HARD_REBOOT': rebooting, 'PASSWORD': pending, 'PREP_RESIZE': pending, 'QUEUE_RESIZE': pending, 'REBOOT': rebooting, 'REBUILD': pending, 'RESCUE': pending, 'RESIZE': reconfiguring, 'SHARE_IP': pending, 'SHARE_IP_NO_CONFIG': pending, 'SHUTOFF': stopped, 'SUSPENDED': suspended, 'UNKNOWN': unknown, 'VERIFY_RESIZE': running}
SNAPSHOT_STATE_MAP = {'available': available, 'creating': creating, 'deleting': deleting, 'error': error, 'error_restoring': error, 'restoring': restoring}
VOLUME_STATE_MAP = {'attaching': attaching, 'available': available, 'backing-up': backup, 'creating': creating, 'deleting': deleting, 'error': error, 'error_deleting': error, 'error_extending': error, 'error_restoring': error, 'in-use': inuse, 'restoring-backup': backup}
api_name = 'ovh'
attach_volume(node, volume, device=None)[source]

Attach a volume to a node.

Parameters:
  • node (Node) – Node where to attach volume
  • volume (StorageVolume) – The ID of the volume
  • device – Unused parameter
Returns:

True or False representing operation successful

Return type:

bool

connectionCls

alias of libcloud.common.ovh.OvhConnection

create_node(name, image, size, location, ex_keyname=None)[source]

Create a new node

Parameters:
  • name (str) – Name of created node
  • image (NodeImage) – Image used for node
  • size (NodeSize) – Size (flavor) used for node
  • location (NodeLocation) – Location (region) where to create node
  • ex_keyname (str) – Name of SSH key used
Returns:

Created node

:rtype : Node

create_volume(size, name, location, snapshot=None, ex_volume_type='classic', ex_description=None)[source]

Create a volume.

Parameters:
  • size (int) – Size of volume to create (in GB).
  • name (str) – Name of volume to create
  • location (NodeLocation or None) – Location to create the volume in
  • snapshot (VolumeSnapshot) – Snapshot from which to create the new volume. (optional)
  • ex_volume_type (str) – 'classic' or 'high-speed'
  • ex_description (str) – Optional description of volume
Returns:

Storage Volume object

Return type:

StorageVolume

create_volume_snapshot(volume, name=None, ex_description=None)[source]

Create snapshot from volume

Parameters:
  • volume (StorageVolume) – Instance of StorageVolume
  • name (str | NoneType) – Name of snapshot (optional)
  • ex_description (str | NoneType) – Description of the snapshot (optional)
Return type:

VolumeSnapshot

delete_key_pair(key_pair)[source]

Delete an existing key pair.

Parameters:key_pair (KeyPair) – Key pair object.
Return type:bool
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
destroy_volume(volume)[source]

Destroys a storage volume.

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
destroy_volume_snapshot(snapshot)[source]

Destroys a snapshot.

Parameters:snapshot (VolumeSnapshot) – The snapshot to delete
Return type:bool
detach_volume(volume, ex_node=None)[source]

Detach a volume to a node.

Parameters:
  • volume (StorageVolume) – The ID of the volume
  • ex_node (Node) – Node to detach from (optional if volume is attached to only one node)
Returns:

True or False representing operation successful

Return type:

bool

Raises:

Exception: If ex_node is not provided and more than one node is attached to the volume

ex_get_node(node_id)[source]

Get a individual node.

Parameters:node_id (str) – Node’s ID
Returns:Created node

:rtype : Node

ex_get_pricing(size_id, subsidiary='US')[source]
ex_get_size(size_id)[source]

Get an individual size (flavor).

Parameters:size_id (str) – Size’s ID
Returns:Size
Return type:NodeSize
ex_get_volume(volume_id)[source]

Return a Volume object based on a volume ID.

Parameters:volume_id (int) – The ID of the volume
Returns:A StorageVolume object for the volume
Return type:StorageVolume
ex_get_volume_snapshot(snapshot_id)[source]

Returns a single volume snapshot.

Parameters:snapshot_id (str) – Node to run the task on.

:rtype VolumeSnapshot: :return: Volume snapshot.

ex_list_snapshots(location=None)[source]

List all snapshots.

Parameters:location (NodeLocation or None) – Location used to filter
Return type:list of VolumeSnapshot
features = {'create_node': ['ssh_key']}
get_image(image_id)[source]

Returns a single node image from a provider.

Parameters:image_id (str) – Node to run the task on.

:rtype NodeImage: :return: NodeImage instance on success.

get_key_pair(name, ex_location=None)[source]

Get an individual SSH public key by its name and location.

Parameters:
  • name (str) – Name of the key pair to retrieve.
  • ex_location (NodeLocation) – Key’s region
Returns:

Public key

Return type:

KeyPair

import_key_pair_from_string(name, key_material, ex_location)[source]

Import a new public key from string.

Parameters:
  • name (str) – Key pair name.
  • key_material (str) – Public key material.
  • ex_location (NodeLocation) – Location where to store the key
Returns:

Imported key pair object.

Return type:

KeyPair

list_images(location=None, ex_size=None)[source]

List available images

Parameters:
  • location (NodeLocation) – Location (region) used as filter
  • ex_size (NodeImage) – Exclude images which are incompatible with given size
Returns:

List of images

:rtype : list of NodeImage

list_key_pairs(ex_location=None)[source]

List available SSH public keys.

Parameters:ex_location (NodeLocation) – Location (region) used as filter
Returns:Public keys
Return type:``list``of KeyPair
list_locations()[source]

List data centers for a provider

Returns:list of node location objects
Return type:list of NodeLocation
list_nodes(location=None)[source]

List all nodes.

Parameters:location (NodeLocation) – Location (region) used as filter
Returns:List of node objects
Return type:list of Node
classmethod list_regions()[source]
list_sizes(location=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 of NodeSize
list_volume_snapshots(volume)[source]

List snapshots for a storage volume.

Return type:list of VolumeSnapshot
list_volumes(ex_location=None)[source]

Return a list of volumes.

Parameters:ex_location (NodeLocation or None) – Location used to filter
Returns:A list of volume objects.
Return type:list of StorageVolume
name = 'Ovh'
type = 'ovh'
website = 'https://www.ovh.com/'

libcloud.compute.drivers.rackspace module

Rackspace driver

class libcloud.compute.drivers.rackspace.RackspaceConnection(*args, **kwargs)[source]

Bases: libcloud.compute.drivers.openstack.OpenStack_1_1_Connection

Connection class for the Rackspace next-gen OpenStack base driver.

auth_url = 'https://identity.api.rackspacecloud.com'
get_endpoint()[source]

Selects the endpoint to use based on provider specific values, or overrides passed in by the user when setting up the driver.

Returns:url of the relevant endpoint for the driver
get_service_name()[source]

Gets the service name used to look up the endpoint in the service catalog.

Returns:name of the service in the catalog
class libcloud.compute.drivers.rackspace.RackspaceFirstGenConnection(*args, **kwargs)[source]

Bases: libcloud.compute.drivers.openstack.OpenStack_1_0_Connection

Connection class for the Rackspace first-gen driver.

XML_NAMESPACE = 'http://docs.rackspacecloud.com/servers/api/v1.0'
auth_url = 'https://identity.api.rackspacecloud.com'
cache_busting = True
get_endpoint()[source]

Selects the endpoint to use based on provider specific values, or overrides passed in by the user when setting up the driver.

Returns:url of the relevant endpoint for the driver
get_service_name()[source]

Gets the service name used to look up the endpoint in the service catalog.

Returns:name of the service in the catalog
responseCls

alias of libcloud.compute.drivers.openstack.OpenStack_1_0_Response

class libcloud.compute.drivers.rackspace.RackspaceFirstGenNodeDriver(key, secret=None, secure=True, host=None, port=None, region='us', **kwargs)[source]

Bases: libcloud.compute.drivers.openstack.OpenStack_1_0_NodeDriver

@inherits: NodeDriver.__init__

Parameters:region (str) – Region ID which should be used
api_name = 'rackspace'
connectionCls

alias of RackspaceFirstGenConnection

list_locations()[source]

Lists available locations

Locations cannot be set or retrieved via the API, but currently there are two locations, DFW and ORD.

@inherits: OpenStack_1_0_NodeDriver.list_locations

name = 'Rackspace Cloud (First Gen)'
type = 'rackspace_first_gen'
website = 'http://www.rackspace.com'
class libcloud.compute.drivers.rackspace.RackspaceNodeDriver(key, secret=None, secure=True, host=None, port=None, region='dfw', **kwargs)[source]

Bases: libcloud.compute.drivers.openstack.OpenStack_1_1_NodeDriver

@inherits: NodeDriver.__init__

Parameters:region (str) – ID of the region which should be used.
connectionCls

alias of RackspaceConnection

name = 'Rackspace Cloud (Next Gen)'
type = 'rackspace'
website = 'http://www.rackspace.com'

libcloud.compute.drivers.rimuhosting module

RimuHosting Driver

class libcloud.compute.drivers.rimuhosting.RimuHostingConnection(key, secure=True, retry_delay=None, backoff=None, timeout=None)[source]

Bases: libcloud.common.base.ConnectionKey

Connection class for the RimuHosting driver

add_default_headers(headers)[source]

Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers

Should return a dictionary.

api_context = '/r'
host = 'rimuhosting.com'
port = 443
request(action, params=None, data='', headers=None, method='GET')[source]

Request a given action.

Basically a wrapper around the connection object’s request that does some helpful pre-processing.

Parameters:
  • action (str) – A path. This can include arguments. If included, any extra parameters are appended to the existing ones.
  • params (dict) – Optional mapping of additional parameters to send. If None, leave as an empty dict.
  • data (unicode) – A body of data to send with the request.
  • headers (dict) – Extra headers to add to the request None, leave as an empty dict.
  • method (str) – An HTTP method such as “GET” or “POST”.
  • raw (bool) – True to perform a “raw” request aka only send the headers and use the rawResponseCls class. This is used with storage API when uploading a file.
  • stream (bool) – True to return an iterator in Response.iter_content and allow streaming of the response data (for downloading large files)
  • retry_failed – True if failed requests should be retried. This argument can override module level constant and environment variable value on per-request basis.
Returns:

An Response instance.

Return type:

Response instance

responseCls

alias of RimuHostingResponse

exception libcloud.compute.drivers.rimuhosting.RimuHostingException[source]

Bases: Exception

Exception class for RimuHosting driver

class libcloud.compute.drivers.rimuhosting.RimuHostingNodeDriver(key, host='rimuhosting.com', port=443, api_context='/r', secure=True)[source]

Bases: libcloud.compute.base.NodeDriver

RimuHosting node driver

Parameters:
  • key (str) – API key (required)
  • host (str) – hostname for connection
  • port (int) – Override port used for connections.
  • api_context (str) – Optional API context.
  • secure (bool) – Whether to use HTTPS or HTTP.
Return type:

None

connectionCls

alias of RimuHostingConnection

create_node(name, size, image, auth=None, ex_billing_oid=None, ex_host_server_oid=None, ex_vps_order_oid_to_clone=None, ex_num_ips=1, ex_extra_ip_reason=None, ex_memory_mb=None, ex_disk_space_mb=None, ex_disk_space_2_mb=None, ex_control_panel=None)[source]

Creates a RimuHosting instance

@inherits: NodeDriver.create_node

Parameters:
  • name (str) – Must be a FQDN. e.g example.com.
  • ex_billing_oid (str) – If not set, a billing method is automatically picked.
  • ex_host_server_oid (str) – The host server to set the VPS up on.
  • ex_vps_order_oid_to_clone (str) – Clone another VPS to use as the image for the new VPS.
  • ex_num_ips (int) – Number of IPs to allocate. Defaults to 1.
  • ex_extra_ip_reason (str) – Reason for needing the extra IPs.
  • ex_memory_mb (int) – Memory to allocate to the VPS.
  • ex_disk_space_mb (int) – Diskspace to allocate to the VPS. Defaults to 4096 (4GB).
  • ex_disk_space_2_mb (int) – Secondary disk size allocation. Disabled by default.
  • ex_control_panel (str) – Control panel to install on the VPS.
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
features = {'create_node': ['password']}
list_images(location=None)[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 of NodeImage
list_locations()[source]

List data centers for a provider

Returns:list of node location objects
Return type:list of NodeLocation
list_nodes()[source]

List all nodes.

Returns:list of node objects
Return type:list of Node
list_sizes(location=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 of NodeSize
name = 'RimuHosting'
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
type = 'rimuhosting'
website = 'http://rimuhosting.com/'
class libcloud.compute.drivers.rimuhosting.RimuHostingResponse(response, connection)[source]

Bases: libcloud.common.base.JsonResponse

Response Class for RimuHosting driver

Parameters:
  • response (httplib.HTTPResponse) – HTTP response object. (optional)
  • connection (Connection) – Parent connection object.
parse_body()[source]

Parse response body.

Override in a provider’s subclass.

Returns:Parsed body.
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 or False

libcloud.compute.drivers.scaleway module

Scaleway Driver

class libcloud.compute.drivers.scaleway.ScalewayResponse(response, connection)[source]

Bases: libcloud.common.base.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 or False
valid_response_codes = [<HTTPStatus.OK: 200>, <HTTPStatus.ACCEPTED: 202>, <HTTPStatus.CREATED: 201>, <HTTPStatus.NO_CONTENT: 204>]
class libcloud.compute.drivers.scaleway.ScalewayConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Connection class for the Scaleway driver.

add_default_headers(headers)[source]

Add headers that are necessary for every request

allow_insecure = False
host = 'cp-par1.scaleway.com'
request(action, params=None, data=None, headers=None, method='GET', raw=False, stream=False, region=None)[source]

Request a given action.

Basically a wrapper around the connection object’s request that does some helpful pre-processing.

Parameters:
  • action (str) – A path. This can include arguments. If included, any extra parameters are appended to the existing ones.
  • params (dict) – Optional mapping of additional parameters to send. If None, leave as an empty dict.
  • data (unicode) – A body of data to send with the request.
  • headers (dict) – Extra headers to add to the request None, leave as an empty dict.
  • method (str) – An HTTP method such as “GET” or “POST”.
  • raw (bool) – True to perform a “raw” request aka only send the headers and use the rawResponseCls class. This is used with storage API when uploading a file.
  • stream (bool) – True to return an iterator in Response.iter_content and allow streaming of the response data (for downloading large files)
  • retry_failed – True if failed requests should be retried. This argument can override module level constant and environment variable value on per-request basis.
Returns:

An Response instance.

Return type:

Response instance

responseCls

alias of ScalewayResponse

class libcloud.compute.drivers.scaleway.ScalewayNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Scaleway Node Driver Class

This is the primary driver for interacting with Scaleway. It contains all of the standard libcloud methods that Scaleway’s API supports.

Parameters:
  • key (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

SNAPSHOT_STATE_MAP = {'available': available, 'error': error, 'snapshotting': creating}
connectionCls

alias of ScalewayConnection

create_image(node, name, region=None)[source]

Create a VM image from an existing node’s root volume.

Parameters:
  • node (Node) – The node from which to create the image
  • name (str) – The name to give the image
  • region – The region in which to create the image

(if None, use default region specified in __init__) :type region: NodeLocation

Returns:the newly created image object
Return type:NodeImage
create_node(name, size, image, ex_volumes=None, ex_tags=None, region=None)[source]

Create a new node.

Parameters:
  • name (str) – The name to give the node
  • size (NodeSize) – The size of node to create
  • image (NodeImage) – The image to create the node with
  • ex_volumes (dict of :class:`.StorageVolume`s) – Additional volumes to create the node with
  • ex_tags (list of str) – Tags to assign to the node
  • region – The region in which to create the node

(if None, use default region specified in __init__) :type region: NodeLocation

Returns:the newly created node object
Return type:Node
create_volume(size, name, region=None)[source]

Create a new volume.

Parameters:
  • size (int) – Size of volume in gigabytes.
  • name (str) – Name of the volume to be created.
  • region – The region in which to create the volume

(if None, use default region specified in __init__) :type region: NodeLocation

Returns:The newly created volume.
Return type:StorageVolume
create_volume_snapshot(volume, name, region=None)[source]

Create snapshot from volume.

Parameters:
  • volume (:class`StorageVolume`) – The volume to create a snapshot from
  • name (str) – The name to give the snapshot
  • region – The region in which to create the snapshot

(if None, use default region specified in __init__) :type region: NodeLocation

Returns:The newly created snapshot.
Return type:VolumeSnapshot
delete_image(node_image, region=None)[source]

Delete a VM image.

Parameters:
  • node_image (NodeImage) – The image to delete
  • region – The region in which to find/delete the image

(if None, use default region specified in __init__) :type region: NodeLocation

Returns:True if the image was deleted, otherwise False
Return type:bool
delete_key_pair(key_pair)[source]

Delete an existing key pair.

Parameters:key_pair (KeyPair) – Key pair object.
Returns:True of False based on success of Keypair deletion
Return type:bool
destroy_node(node)[source]

Destroy a node.

Parameters:node (Node) – The node to be destroyed
Returns:True if the destroy was successful, otherwise False
Return type:bool
destroy_volume(volume, region=None)[source]

Destroys a storage volume.

Parameters:
  • volume (StorageVolume) – Volume to be destroyed
  • region – The region in which to look for the volume

(if None, use default region specified in __init__) :type region: NodeLocation

Returns:True if the destroy was successful, otherwise False
Return type:bool
destroy_volume_snapshot(snapshot, region=None)[source]

Dostroy a volume snapshot

Parameters:
  • snapshot (class:VolumeSnapshot) – volume snapshot to destroy
  • region – The region in which to look for the snapshot

(if None, use default region specified in __init__) :type region: NodeLocation

Returns:True if the destroy was successful, otherwise False
Return type:bool
get_image(image_id, region=None)[source]

Retrieve a specific VM image.

Parameters:
  • image_id (int) – The id of the image to retrieve
  • region – The region in which to create the image

(if None, use default region specified in __init__) :type region: NodeLocation

Returns:the requested image object
Return type:NodeImage
import_key_pair_from_string(name, key_material)[source]

Import a new public key from string.

Parameters:
  • name (str) – Key pair name.
  • key_material (str) – Public key material.
Returns:

Imported key pair object.

Return type:

KeyPair

list_images(region=None)[source]

List available VM images.

Parameters:region – The region in which to list images

(if None, use default region specified in __init__) :type region: NodeLocation

Returns:list of image objects
Return type:list of NodeImage
list_key_pairs()[source]

List all the available SSH keys.

Returns:Available SSH keys.
Return type:list of KeyPair
list_locations()[source]

List data centers available.

Returns:list of node location objects
Return type:list of NodeLocation
list_nodes(region=None)[source]

List all nodes.

Parameters:region – The region in which to look for nodes

(if None, use default region specified in __init__) :type region: NodeLocation

Returns:list of node objects
Return type:list of Node
list_sizes(region=None)[source]

List available VM sizes.

Parameters:region – The region in which to list sizes

(if None, use default region specified in __init__) :type region: NodeLocation

Returns:list of node size objects
Return type:list of NodeSize
list_volume_snapshots(volume, region=None)[source]

List snapshots for a storage volume.

@inherits NodeDriver.list_volume_snapshots

Parameters:region – The region in which to look for snapshots

(if None, use default region specified in __init__) :type region: NodeLocation

list_volumes(region=None)[source]

Return a list of volumes.

Parameters:region – The region in which to look for volumes

(if None, use default region specified in __init__) :type region: NodeLocation

Returns:A list of volume objects.
Return type:list of StorageVolume
name = 'Scaleway'
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
type = 'scaleway'
website = 'https://www.scaleway.com/'

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: libcloud.common.base.ConnectionUserAndKey

Connection class for UpcloudDriver

add_default_headers(headers)[source]

Adds headers that are needed for all requests

host = 'api.upcloud.com'
responseCls

alias of UpcloudResponse

class libcloud.compute.drivers.upcloud.UpcloudDriver(username, password, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Upcloud node driver

Parameters:
  • username (str) – Username required for authentication
  • password (str) – Password required for authentication
NODE_STATE_MAP = {'error': error, 'maintenance': reconfiguring, 'started': running, 'stopped': 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:

Node

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 = {'create_node': ['ssh_key', 'generates_password']}
list_images()[source]

List available distributions.

Return type:list of NodeImage
list_locations()[source]

List available locations for deployment

Return type:list of NodeLocation
list_nodes()[source]

List nodes

Returns:List of node objects
Return type:list of Node
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 of NodeSize
name = 'Upcloud'
reboot_node(node)[source]

Reboot the given node

Parameters:node (Node) – the node to reboot
Return type:bool
type = 'upcloud'
website = 'https://www.upcloud.com'
class libcloud.compute.drivers.upcloud.UpcloudResponse(response, connection)[source]

Bases: libcloud.common.base.JsonResponse

Response class for UpcloudDriver

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 or False

libcloud.compute.drivers.vcl module

VCL driver

class libcloud.compute.drivers.vcl.VCLConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]

Bases: libcloud.common.xmlrpc.XMLRPCConnection, libcloud.common.base.ConnectionUserAndKey

add_default_headers(headers)[source]

Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers

Should return a dictionary.

endpoint = '/index.php?mode=xmlrpccall'
class libcloud.compute.drivers.vcl.VCLNodeDriver(key, secret, secure=True, host=None, port=None, *args, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

VCL node driver

Parameters:
  • host (str) – The VCL host to which you make requests(required)
  • key (str) – API key or username to used (required)
  • secret (str) – Secret password to be used (required)
  • secure (bool) – Whether to use HTTPS or HTTP.
  • host – Override hostname used for connections. (required)
  • port (int) – Override port used for connections.
Return type:

None

NODE_STATE_MAP = {'error': unknown, 'failed': terminated, 'future': pending, 'loading': pending, 'notavailable': terminated, 'notready': pending, 'ready': running, 'success': pending, 'time': pending, 'timedout': terminated}
connectionCls

alias of VCLConnection

create_node(image, start=None, length='60')[source]

Create a new VCL reservation size and name ignored, image is the id from list_image

@inherits: NodeDriver.create_node

Parameters:
  • image (str) – image is the id from list_image
  • start (str) – start time as unix timestamp
  • length (str) – length of time in minutes
destroy_node(node)[source]

End VCL reservation for the node passed in. Throws error if request fails.

Parameters:node (Node) – The node to be destroyed
Return type:bool
ex_extend_request_time(node, minutes)[source]

Time in minutes to extend the requested node’s reservation time

Parameters:
  • node (Node) – the reservation node to update
  • minutes (str) – the number of mintes to update
Returns:

true on success, throws error on failure

Return type:

bool

ex_get_request_end_time(node)[source]

Get the ending time of the node reservation.

Parameters:node (Node) – the reservation node to update
Returns:unix timestamp
Return type:int
ex_update_node_access(node, ipaddr)[source]

Update the remote ip accessing the node.

Parameters:
  • node (Node) – the reservation node to update
  • ipaddr (str) – the ipaddr used to access the node
Returns:

node with updated information

Return type:

Node

list_images(location=None)[source]

List images available to the user provided credentials

@inherits: NodeDriver.list_images

list_nodes(ipaddr)[source]

List nodes

Parameters:ipaddr (str) – IP address which should be used
Return type:list of Node
list_sizes(location=None)[source]

VCL does not choosing sizes for node creation. Size of images are statically set by administrators.

@inherits: NodeDriver.list_sizes

name = 'VCL'
type = 'vcl'
website = 'http://incubator.apache.org/vcl/'
class libcloud.compute.drivers.vcl.VCLResponse(response, connection)[source]

Bases: libcloud.common.xmlrpc.XMLRPCResponse

Parameters:
  • response (httplib.HTTPResponse) – HTTP response object. (optional)
  • connection (Connection) – Parent connection object.
exceptions = {'VCL_Account': <class 'libcloud.common.types.InvalidCredsError'>}

libcloud.compute.drivers.vcloud module

VMware vCloud driver.

class libcloud.compute.drivers.vcloud.Capacity(limit, used, units)[source]

Bases: object

Represents CPU, Memory or Storage capacity of vDC.

class libcloud.compute.drivers.vcloud.ControlAccess(node, everyone_access_level, subjects=None)[source]

Bases: object

Represents control access settings of a node

class AccessLevel[source]

Bases: object

CHANGE = 'Change'
FULL_CONTROL = 'FullControl'
READ_ONLY = 'ReadOnly'
libcloud.compute.drivers.vcloud.DEFAULT_API_VERSION = '0.8'

Valid vCloud API v1.5 input values.

class libcloud.compute.drivers.vcloud.HostingComConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]

Bases: libcloud.compute.drivers.vcloud.VCloudConnection

vCloud connection subclass for Hosting.com

host = 'vcloud.safesecureweb.com'
class libcloud.compute.drivers.vcloud.HostingComDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.vcloud.VCloudNodeDriver

vCloud node driver for Hosting.com

Parameters:
  • key (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

connectionCls

alias of HostingComConnection

class libcloud.compute.drivers.vcloud.InstantiateVAppXML(name, template, net_href, cpus, memory, password=None, row=None, group=None)[source]

Bases: object

tostring()[source]
class libcloud.compute.drivers.vcloud.Instantiate_1_5_VAppXML(name, template, network, vm_network=None, vm_fence=None, description=None)[source]

Bases: object

tostring()[source]
class libcloud.compute.drivers.vcloud.Lease(lease_id, deployment_lease=None, storage_lease=None, deployment_lease_expiration=None, storage_lease_expiration=None)[source]

Bases: object

Lease information for vApps.

More info at: ‘https://www.vmware.com/support/vcd/doc/
rest-api-doc-1.5-html/types/LeaseSettingsSectionType.html’
Parameters:
  • lease_id (str) – ID (link) to the lease settings section of a vApp.
  • deployment_lease (int or None) – Deployment lease time in seconds
  • storage_lease (int or None) – Storage lease time in seconds
  • deployment_lease_expiration (datetime.datetime or None) – Deployment lease expiration time
  • storage_lease_expiration (datetime.datetime or None) – Storage lease expiration time
get_deployment_time()[source]

Gets the date and time a vApp was deployed. Time is inferred from the deployment lease and expiration or the storage lease and expiration.

Returns:Date and time the vApp was deployed or None if unable to calculate
Return type:datetime.datetime or None
classmethod to_lease(lease_element)[source]

Convert lease settings element to lease instance.

Parameters:lease_element (ET.Element) – “LeaseSettingsSection” XML element
Returns:Lease instance
Return type:Lease
class libcloud.compute.drivers.vcloud.Subject(type, name, access_level, id=None)[source]

Bases: object

User or group subject

class libcloud.compute.drivers.vcloud.TerremarkConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]

Bases: libcloud.compute.drivers.vcloud.VCloudConnection

vCloud connection subclass for Terremark

host = 'services.vcloudexpress.terremark.com'
class libcloud.compute.drivers.vcloud.TerremarkDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.vcloud.VCloudNodeDriver

vCloud node driver for Terremark

Parameters:
  • key (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

connectionCls

alias of TerremarkConnection

list_locations()[source]

List data centers for a provider

Returns:list of node location objects
Return type:list of NodeLocation
class libcloud.compute.drivers.vcloud.VCloudConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Connection class for the vCloud driver

add_default_headers(headers)[source]

Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers

Should return a dictionary.

check_org()[source]
host = None
request(*args, **kwargs)[source]

Request a given action.

Basically a wrapper around the connection object’s request that does some helpful pre-processing.

Parameters:
  • action (str) – A path. This can include arguments. If included, any extra parameters are appended to the existing ones.
  • params (dict) – Optional mapping of additional parameters to send. If None, leave as an empty dict.
  • data (unicode) – A body of data to send with the request.
  • headers (dict) – Extra headers to add to the request None, leave as an empty dict.
  • method (str) – An HTTP method such as “GET” or “POST”.
  • raw (bool) – True to perform a “raw” request aka only send the headers and use the rawResponseCls class. This is used with storage API when uploading a file.
  • stream (bool) – True to return an iterator in Response.iter_content and allow streaming of the response data (for downloading large files)
  • retry_failed – True if failed requests should be retried. This argument can override module level constant and environment variable value on per-request basis.
Returns:

An Response instance.

Return type:

Response instance

responseCls

alias of VCloudResponse

token = None
class libcloud.compute.drivers.vcloud.VCloudNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

vCloud node driver

Parameters:
  • key (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 = {'0': pending, '1': pending, '2': pending, '3': pending, '4': running}
connectionCls

alias of VCloudConnection

create_node(name, size, image, auth=None, ex_network=None, ex_vdc=None, ex_cpus=1, ex_row=None, ex_group=None)[source]

Creates and returns node.

Parameters:
  • ex_network (str) – link to a “Network” e.g., https://services.vcloudexpress...
  • ex_vdc (str) – Name of organisation’s virtual data center where vApp VMs will be deployed.
  • ex_cpus (int) – number of virtual cpus (limit depends on provider)
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_list_nodes(vdcs=None)[source]

List all nodes across all vDCs. Using ‘vdcs’ you can specify which vDCs should be queried.

Parameters:vdcs (Vdc) – None, vDC or a list of vDCs to query. If None all vDCs will be queried.
Return type:list of Node
features = {'create_node': ['password']}
list_images(location=None)[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 of NodeImage
list_nodes()[source]

List all nodes.

Returns:list of node objects
Return type:list of Node
list_sizes(location=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 of NodeSize
name = 'vCloud'
networks
org = None
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
type = 'vcloud'
vdcs

vCloud virtual data centers (vDCs).

Returns:list of vDC objects
Return type:list of Vdc
website = 'http://www.vmware.com/products/vcloud/'
class libcloud.compute.drivers.vcloud.VCloudResponse(response, connection)[source]

Bases: libcloud.common.base.XmlResponse

Parameters:
  • response (httplib.HTTPResponse) – HTTP response object. (optional)
  • connection (Connection) – Parent connection object.
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 or False
class libcloud.compute.drivers.vcloud.VCloud_1_5_Connection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]

Bases: libcloud.compute.drivers.vcloud.VCloudConnection

add_default_headers(headers)[source]

Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers

Should return a dictionary.

class libcloud.compute.drivers.vcloud.VCloud_1_5_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.vcloud.VCloudNodeDriver

Parameters:
  • key (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 = {'-1': unknown, '0': pending, '1': pending, '10': unknown, '2': pending, '3': pending, '4': running, '5': running, '6': unknown, '7': unknown, '8': stopped, '9': unknown}
connectionCls

alias of VCloud_1_5_Connection

create_node(**kwargs)[source]
Creates and returns node. If the source image is:
  • vApp template - a new vApp is instantiated from template
  • existing vApp - a new vApp is cloned from the source vApp. Can
    not clone more vApps is parallel otherwise resource busy error is raised.

@inherits: NodeDriver.create_node

Parameters:
  • image (NodeImage or Node) – OS Image to boot on node. (required). Can be a NodeImage or existing Node that will be cloned.
  • ex_network (str) – Organisation’s network name for attaching vApp VMs to.
  • ex_vdc (str) – Name of organisation’s virtual data center where vApp VMs will be deployed.
  • ex_vm_names (list of str) – list of names to be used as a VM and computer name. The name must be max. 15 characters long and follow the host name requirements.
  • ex_vm_cpu (int) – number of virtual CPUs/cores to allocate for each vApp VM.
  • ex_vm_memory (int) – amount of memory in MB to allocate for each vApp VM.
  • ex_vm_script (str) – full path to file containing guest customisation script for each vApp VM. Useful for creating users & pushing out public SSH keys etc.
  • ex_vm_script_text (str) – content of guest customisation script for each vApp VM. Overrides ex_vm_script parameter.
  • ex_vm_network (str) – Override default vApp VM network name. Useful for when you’ve imported an OVF originating from outside of the vCloud.
  • ex_vm_fence (str) – Fence mode for connecting the vApp VM network (ex_vm_network) to the parent organisation network (ex_network).
  • ex_vm_ipmode (str) – IP address allocation mode for all vApp VM network connections.
  • ex_deploy (bool) – set to False if the node shouldn’t be deployed (started) after creation
  • ex_force_customization (bool) – Used to specify whether to force customization on deployment, if not set default value is False.
  • ex_clone_timeout (int) – timeout in seconds for clone/instantiate VM operation. Cloning might be a time consuming operation especially when linked clones are disabled or VMs are created on different datastores. Overrides the default task completion value.
  • ex_admin_password (str) – set the node admin password explicitly.
  • ex_description (str) – Set a description for the vApp.
destroy_node(node, shutdown=True)[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_add_vm_disk(vapp_or_vm_id, vm_disk_size)[source]

Adds a virtual disk to the specified VM or VMs under the vApp. If the vapp_or_vm_id param represents a link to an vApp all VMs that are attached to this vApp will be modified.

Parameters:
  • vapp_or_vm_id (str) – vApp or VM ID that will be modified. If a vApp ID is used here all attached VMs will be modified
  • vm_disk_size (int) – the disk capacity in GB that will be added to the specified VM or VMs
Return type:

None

ex_change_vm_admin_password(vapp_or_vm_id, ex_admin_password)[source]

Changes the admin (or root) password of VM or VMs under the vApp. If the vapp_or_vm_id param represents a link to an vApp all VMs that are attached to this vApp will be modified.

Parameters:
  • vapp_or_vm_id (str) – vApp or VM ID that will be modified. If a vApp ID is used here all attached VMs will be modified
  • ex_admin_password (str) – admin password to be used.
Return type:

None

ex_deploy_node(node, ex_force_customization=False)[source]

Deploys existing node. Equal to vApp “start” operation.

Parameters:
  • node (Node) – The node to be deployed
  • ex_force_customization (bool) – Used to specify whether to force customization on deployment, if not set default value is False.
Return type:

Node

ex_find_node(node_name, vdcs=None)[source]

Searches for node across specified vDCs. This is more effective than querying all nodes to get a single instance.

Parameters:
  • node_name (str) – The name of the node to search for
  • vdcs (Vdc) – None, vDC or a list of vDCs to search in. If None all vDCs will be searched.
Returns:

node instance or None if not found

Return type:

Node or None

ex_find_vm_nodes(vm_name, max_results=50)[source]

Finds nodes that contain a VM with the specified name.

Parameters:
  • vm_name (str) – The VM name to find nodes for
  • max_results (int) – Maximum number of results up to 128
Returns:

List of node instances

Return type:

list of Node

ex_get_control_access(node)[source]

Returns the control access settings for specified node.

Parameters:node (Node) – node to get the control access for
Return type:ControlAccess
ex_get_metadata(node)[source]
Parameters:node (Node) – node
Returns:dictionary mapping metadata keys to metadata values
Return type:dictionary mapping str to str
ex_power_off_node(node)[source]

Powers on all VMs under specified node. VMs need to be This operation is allowed only when the vApp/VM is powered on.

Parameters:node (Node) – The node to be powered off
Return type:Node
ex_power_on_node(node)[source]

Powers on all VMs under specified node. This operation is allowed only when the vApp/VM is powered off or suspended.

Parameters:node (Node) – The node to be powered on
Return type:Node
ex_query(type, filter=None, page=1, page_size=100, sort_asc=None, sort_desc=None)[source]

Queries vCloud for specified type. See http://www.vmware.com/pdf/vcd_15_api_guide.pdf for details. Each element of the returned list is a dictionary with all attributes from the record.

Parameters:
  • type (str) – type to query (r.g. user, group, vApp etc.)
  • filter (str) – filter expression (see documentation for syntax)
  • page (int) – page number
  • page_size (int) – page size
  • sort_asc (str) – sort in ascending order by specified field
  • sort_desc (str) – sort in descending order by specified field
Return type:

list of dict

ex_set_control_access(node, control_access)[source]

Sets control access for the specified node.

Parameters:
  • node (Node) – node
  • control_access (ControlAccess) – control access settings
Return type:

None

ex_set_metadata_entry(node, key, value)[source]
Parameters:
  • node (Node) – node
  • key (str) – metadata key to be set
  • value (str) – metadata value to be set
Return type:

None

ex_set_vm_cpu(vapp_or_vm_id, vm_cpu)[source]

Sets the number of virtual CPUs for the specified VM or VMs under the vApp. If the vapp_or_vm_id param represents a link to an vApp all VMs that are attached to this vApp will be modified.

Please ensure that hot-adding a virtual CPU is enabled for the powered on virtual machines. Otherwise use this method on undeployed vApp.

Parameters:
  • vapp_or_vm_id (str) – vApp or VM ID that will be modified. If a vApp ID is used here all attached VMs will be modified
  • vm_cpu (int) – number of virtual CPUs/cores to allocate for specified VMs
Return type:

None

ex_set_vm_memory(vapp_or_vm_id, vm_memory)[source]

Sets the virtual memory in MB to allocate for the specified VM or VMs under the vApp. If the vapp_or_vm_id param represents a link to an vApp all VMs that are attached to this vApp will be modified.

Please ensure that hot-change of virtual memory is enabled for the powered on virtual machines. Otherwise use this method on undeployed vApp.

Parameters:
  • vapp_or_vm_id (str) – vApp or VM ID that will be modified. If a vApp ID is used here all attached VMs will be modified
  • vm_memory (int) – virtual memory in MB to allocate for the specified VM or VMs
Return type:

None

ex_shutdown_node(node)[source]

Shutdowns all VMs under specified node. This operation is allowed only when the vApp/VM is powered on.

Parameters:node (Node) – The node to be shut down
Return type:Node
ex_suspend_node(node)[source]

Suspends all VMs under specified node. This operation is allowed only when the vApp/VM is powered on.

Parameters:node (Node) – The node to be suspended
Return type:Node
ex_undeploy_node(node, shutdown=True)[source]

Undeploys existing node. Equal to vApp “stop” operation.

Parameters:
  • node (Node) – The node to be deployed
  • shutdown (bool) – Whether to shutdown or power off the guest when undeploying
Return type:

Node

list_locations()[source]

List data centers for a provider

Returns:list of node location objects
Return type:list of NodeLocation
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
class libcloud.compute.drivers.vcloud.VCloud_5_1_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.vcloud.VCloud_1_5_NodeDriver

Parameters:
  • key (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

class libcloud.compute.drivers.vcloud.VCloud_5_5_Connection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]

Bases: libcloud.compute.drivers.vcloud.VCloud_1_5_Connection

add_default_headers(headers)[source]

Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers

Should return a dictionary.

class libcloud.compute.drivers.vcloud.VCloud_5_5_NodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.vcloud.VCloud_5_1_NodeDriver

Use 5.5 Connection class to explicitly set 5.5 for the version in Accept headers

Parameters:
  • key (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

connectionCls

alias of VCloud_5_5_Connection

ex_acquire_mks_ticket(vapp_or_vm_id, vm_num=0)[source]

Retrieve a mks ticket that you can use to gain access to the console of a running VM. If successful, returns a dict with the following keys:

  • host: host (or proxy) through which the console connection
    is made
  • vmx: a reference to the VMX file of the VM for which this
    ticket was issued
  • ticket: screen ticket to use to authenticate the client
  • port: host port to be used for console access
Parameters:
  • vapp_or_vm_id (str) – vApp or VM ID you want to connect to.
  • vm_num (int) – If a vApp ID is provided, vm_num is position in the vApp VM list of the VM you want to get a screen ticket. Default is 0.
Return type:

dict

ex_create_snapshot(node)[source]

Creates new snapshot of a virtual machine or of all the virtual machines in a vApp. Prior to creation of the new snapshots, any existing user created snapshots associated with the virtual machines are removed.

Parameters:node (Node) – node
Return type:Node
ex_remove_snapshots(node)[source]

Removes all user created snapshots for a vApp or virtual machine.

Parameters:node (Node) – node
Return type:Node
ex_revert_to_snapshot(node)[source]

Reverts a vApp or virtual machine to the current snapshot, if any.

Parameters:node (Node) – node
Return type:Node
class libcloud.compute.drivers.vcloud.Vdc(id, name, driver, allocation_model=None, cpu=None, memory=None, storage=None)[source]

Bases: object

Virtual datacenter (vDC) representation

libcloud.compute.drivers.vcloud.fixxpath(root, xpath)[source]

ElementTree wants namespaces in its xpaths, so here we add them.

libcloud.compute.drivers.vcloud.get_url_path(url)[source]
libcloud.compute.drivers.vcloud.urlparse(url, scheme='', allow_fragments=True)[source]

From vcloud api “The VirtualQuantity element defines the number of MB of memory. This should be either 512 or a multiple of 1024 (1 GB).”

libcloud.compute.drivers.vpsnet module

VPS.net driver

class libcloud.compute.drivers.vpsnet.VPSNetConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]

Bases: libcloud.common.base.ConnectionUserAndKey

Connection class for the VPS.net driver

add_default_headers(headers)[source]

Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers

Should return a dictionary.

allow_insecure = False
host = 'api.vps.net'
responseCls

alias of VPSNetResponse

class libcloud.compute.drivers.vpsnet.VPSNetNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

VPS.net node driver

Parameters:
  • key (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

api_name = 'vps_net'
connectionCls

alias of VPSNetConnection

create_node(name, image, size, ex_backups_enabled=False, ex_fqdn=None)[source]

Create a new VPS.net node

@inherits: NodeDriver.create_node

Parameters:
  • ex_backups_enabled (bool) – Enable automatic backups
  • ex_fqdn (str) – Fully Qualified domain of the node
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
list_images(location=None)[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 of NodeImage
list_locations()[source]

List data centers for a provider

Returns:list of node location objects
Return type:list of NodeLocation
list_nodes()[source]

List all nodes.

Returns:list of node objects
Return type:list of Node
list_sizes(location=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 of NodeSize
name = 'vps.net'
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
type = 'vpsnet'
website = 'http://vps.net/'
class libcloud.compute.drivers.vpsnet.VPSNetResponse(response, connection)[source]

Bases: libcloud.common.base.JsonResponse

Parameters:
  • response (httplib.HTTPResponse) – HTTP response object. (optional)
  • connection (Connection) – Parent connection object.
parse_body()[source]

Parse response body.

Override in a provider’s subclass.

Returns:Parsed body.
Return type:str
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 or False

libcloud.compute.drivers.vsphere module

VMware vSphere driver. Uses pyvmomi - https://github.com/vmware/pyvmomi Code inspired by https://github.com/vmware/pyvmomi-community-samples

Authors: Dimitris Moraitis, Alex Tsiliris, Markos Gogoulos

class libcloud.compute.drivers.vsphere.VSphereConnection(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]

Bases: libcloud.common.base.ConnectionKey

Initialize user_id and key; set secure to an int based on passed value.

add_default_headers(headers)[source]

VSphere needs an initial connection to a specific API endpoint to generate a session-token, which will be used for the purpose of authenticating for the rest of the session.

responseCls

alias of VSphereResponse

session_token = None
exception libcloud.compute.drivers.vsphere.VSphereException(code, message)[source]

Bases: Exception

class libcloud.compute.drivers.vsphere.VSphereNetwork(id, name, extra=None)[source]

Bases: object

Represents information about a VPC (Virtual Private Cloud) network

Note: This class is VSphere specific.

class libcloud.compute.drivers.vsphere.VSphereNodeDriver(host, username, password, port=443, ca_cert=None)[source]

Bases: libcloud.compute.base.NodeDriver

Initialize a connection by providing a hostname, username and password

NODE_STATE_MAP = {'poweredOff': stopped, 'poweredOn': running, 'suspended': suspended}
create_node(name, image, size, location=None, ex_cluster=None, ex_network=None, ex_datacenter=None, ex_folder=None, ex_resource_pool=None, ex_datastore_cluster=None, ex_datastore=None)[source]

Creates and returns node.

Parameters:ex_network (str) – Name of a “Network” to connect the VM to “,
destroy_node(node)[source]
ex_connect_network(vm, network_name)[source]
ex_create_snapshot(node, snapshot_name, description='', dump_memory=False, quiesce=False)[source]

Create node snapshot

ex_list_datastores()[source]
ex_list_folders()[source]
ex_list_networks()[source]

List networks

ex_list_snapshots(node)[source]

List node snapshots

ex_open_console(vm_uuid)[source]
ex_remove_snapshot(node, snapshot_name=None, remove_children=True)[source]

Remove a snapshot from node. If snapshot_name is not defined remove the last one.

ex_revert_to_snapshot(node, snapshot_name=None)[source]

Revert node to a specific snapshot. If snapshot_name is not defined revert to the last one.

find_by_uuid(node_uuid)[source]

Searches VMs for a given uuid returns pyVmomi.VmomiSupport.vim.VirtualMachine

find_custom_field_key(key_id)[source]

Return custom field key name, provided it’s id

get_obj(vimtype, name)[source]

Return an object by name, if name is None the first found object is returned

list_images(location=None, folder_ids=None)[source]

Lists VM templates as images. If folder is given then it will list images contained in that folder only.

list_locations(ex_show_hosts_in_drs=True)[source]

Lists locations

list_nodes(enhance=True, max_properties=20)[source]

List nodes, excluding templates

list_nodes_recursive(enhance=True)[source]

Lists nodes, excluding templates

list_sizes()[source]

Returns sizes

name = 'VMware vSphere'
reboot_node(node)[source]
start_node(node)[source]
stop_node(node)[source]
type = 'vsphere'
wait_for_task(task, timeout=1800, interval=10)[source]

wait for a vCenter task to finish

website = 'http://www.vmware.com/products/vsphere/'
class libcloud.compute.drivers.vsphere.VSphereResponse(response, connection)[source]

Bases: libcloud.common.base.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
class libcloud.compute.drivers.vsphere.VSphere_REST_NodeDriver(key, secret=None, secure=True, host=None, port=443, ca_cert=None)[source]

Bases: libcloud.compute.base.NodeDriver

NODE_STATE_MAP = {'powered_off': stopped, 'powered_on': running, 'suspended': suspended}
VALID_RESPONSE_CODES = [<HTTPStatus.OK: 200>, <HTTPStatus.ACCEPTED: 202>, <HTTPStatus.CREATED: 201>, <HTTPStatus.NO_CONTENT: 204>]
async_list_nodes()[source]

In this case filtering is not possible. Use this method when the cloud has a lot of vms and you want to return them all.

connectionCls

alias of VSphereConnection

create_node(name, image, size=None, location=None, ex_datastore=None, ex_disks=None, ex_folder=None, ex_network=None, ex_turned_on=True)[source]

Image can be either a vm template , a ovf template or just the guest OS.

ex_folder is necessary if the image is a vm-template, this method will attempt to put the VM in a random folder and a warning about it will be issued in case the value remains None.

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_add_nic(node, network)[source]

Creates a network adapter that will connect to the specified network for the given node. Returns a boolean indicating success or not.

ex_create_snapshot(node, snapshot_name, description='', dump_memory=False, quiesce=False)[source]

Create node snapshot

ex_list_clusters(ex_filter_folders=None, ex_filter_names=None, ex_filter_datacenters=None, ex_filter_clusters=None)[source]
ex_list_content_libraries()[source]
ex_list_content_library_items(library_id)[source]
ex_list_datacenters(ex_filter_folders=None, ex_filter_names=None, ex_filter_datacenters=None)[source]
ex_list_datastores(ex_filter_folders=None, ex_filter_names=None, ex_filter_datacenters=None, ex_filter_types=None, ex_filter_datastores=None)[source]
ex_list_folders()[source]
ex_list_hosts(ex_filter_folders=None, ex_filter_standalone=None, ex_filter_hosts=None, ex_filter_clusters=None, ex_filter_names=None, ex_filter_datacenters=None, ex_filter_connection_states=None)[source]
ex_list_networks()[source]
ex_list_snapshots(node)[source]

List node snapshots

ex_open_console(vm_id)[source]
ex_remove_snapshot(node, snapshot_name=None, remove_children=True)[source]

Remove a snapshot from node. If snapshot_name is not defined remove the last one.

ex_revert_to_snapshot(node, snapshot_name=None)[source]

Revert node to a specific snapshot. If snapshot_name is not defined revert to the last one.

ex_suspend_node(node)[source]
ex_update_capacity(node, capacity)[source]
ex_update_cpu(node, cores)[source]

Assuming 1 Core per socket :param cores: Integer or string indicating number of cores :type cores: int or str

ex_update_memory(node, ram)[source]
Parameters:ram (str or int) – The amount of ram in MB.
list_images(**kwargs)[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 of NodeImage
list_locations(ex_show_hosts_in_drs=True)[source]

Location in the general sense means any resource that allows for node creation. In vSphere’s case that usually is a host but if a cluster has rds enabled, a cluster can be assigned to create the VM, thus the clusters with rds enabled will be added to locations.

Parameters:ex_show_hosts_in_drs (boolean) – A DRS cluster schedules automatically on which host should be placed thus it may not be desired to show the hosts in a DRS enabled cluster. Set False to not show these hosts.
list_nodes(ex_filter_power_states=None, ex_filter_folders=None, ex_filter_names=None, ex_filter_hosts=None, ex_filter_clusters=None, ex_filter_vms=None, ex_filter_datacenters=None, ex_filter_resource_pools=None, max_properties=20)[source]

The ex parameters are search options and must be an array of strings, even ex_filter_power_states which can have at most two items but makes sense to keep only one (“POWERED_ON” or “POWERED_OFF”) Keep in mind that this method will return up to 1000 nodes so if your network has more, do use the provided filters and call it multiple times.

list_sizes()[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 of NodeSize
name = 'VMware vSphere'
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
session_token = None
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
stop_node(node)[source]

Stop a node

Parameters:node (Node) – The node to be stopped.
Returns:True if the stop was successful, otherwise False
Return type:bool
type = 'vsphere'
website = 'http://www.vmware.com/products/vsphere/'
libcloud.compute.drivers.vsphere.format_snapshots(snapshot_list)[source]
libcloud.compute.drivers.vsphere.recurse_snapshots(snapshot_list)[source]

libcloud.compute.drivers.vultr module

Vultr Driver

class libcloud.compute.drivers.vultr.SSHKey(id, name, pub_key)[source]

Bases: object

class libcloud.compute.drivers.vultr.VultrConnection(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]

Bases: libcloud.common.base.ConnectionKey

Connection class for the Vultr driver.

Initialize user_id and key; set secure to an int based on passed value.

add_default_headers(headers)[source]

Adds API-Key default header.

Returns:Updated headers.
Return type:dict
encode_data(data)[source]

Encode body data.

Override in a provider’s subclass.

get(url)[source]
host = 'api.vultr.com'
post(url, data)[source]
require_api_key()[source]

Check whether this call (method + action) must be authenticated.

Returns:True if API-Key header required, False otherwise.
Return type:bool
responseCls

alias of VultrResponse

unauthenticated_endpoints = {'/v1/app/list': ['GET'], '/v1/os/list': ['GET'], '/v1/plans/list': ['GET'], '/v1/plans/list_vc2': ['GET'], '/v1/plans/list_vdc2': ['GET'], '/v1/regions/availability': ['GET'], '/v1/regions/list': ['GET']}
class libcloud.compute.drivers.vultr.VultrNodeDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.base.NodeDriver

Parameters:
  • key (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

name = 'Vultr'
type = 'vultr'
website = 'https://www.vultr.com'
class libcloud.compute.drivers.vultr.VultrNodeDriverHelper[source]

Bases: object

VultrNode helper class.

handle_extra(extra_keys, data)[source]
class libcloud.compute.drivers.vultr.VultrNodeDriverV1(*args, **kwargs)[source]

Bases: libcloud.compute.drivers.vultr.VultrNodeDriver

VultrNode node driver.

EX_CREATE_ATTRIBUTES = ['ipxe_chain_url', 'label', 'userdata', 'reserved_ip_v4', 'hostname', 'tag', 'enable_ipv6', 'enable_private_network', 'auto_backups', 'notify_activate', 'ddos_protection', 'iso_id', 'script_id', 'snapshot_id', 'app_id']
EX_CREATE_ID_ATTRIBUTES = {'app_id': 'APPID', 'iso_id': 'ISOID', 'script_id': 'SCRIPTID', 'snapshot_id': 'SNAPSHOTID'}
EX_CREATE_YES_NO_ATTRIBUTES = ['enable_ipv6', 'enable_private_network', 'auto_backups', 'notify_activate', 'ddos_protection']
NODE_STATE_MAP = {'active': running, 'pending': pending}
connectionCls

alias of VultrConnection

create_key_pair(name, public_key='')[source]

Create a new SSH key. :param name: Name of the new SSH key :type name: str

Key public_key:Public part of the new SSH key
Returns:True on success
Return type:bool
create_node(name, size, image, location, ex_ssh_key_ids=None, ex_create_attr=None)[source]

Create a node

Parameters:
  • name (str) – Name for the new node
  • size (NodeSize) – Size of the new node
  • image (NodeImage) – Image for the new node
  • location (NodeLocation) – Location of the new node
  • ex_ssh_key_ids – IDs of the SSH keys to initialize
  • ex_create_attr (dict) – Extra attributes for node creation

The ex_create_attr parameter can include the following dictionary key and value pairs:

  • ipxe_chain_url: str for specifying URL to boot via IPXE
  • iso_id: str the ID of a specific ISO to mount, only meaningful with the Custom NodeImage
  • script_id: int ID of a startup script to execute on boot, only meaningful when the NodeImage is not Custom
  • ‘snapshot_id`: str Snapshot ID to restore for the initial installation, only meaningful with the Snapshot NodeImage
  • enable_ipv6: bool Whether an IPv6 subnet should be assigned
  • enable_private_network: bool Whether private networking support should be added
  • label: str Text label to be shown in the control panel
  • auto_backups: bool Whether automatic backups should be enabled
  • app_id: int App ID to launch if launching an application, only meaningful when the NodeImage is Application
  • userdata: str Base64 encoded cloud-init user-data
  • notify_activate: bool Whether an activation email should be sent when the server is ready
  • ddos_protection: bool Whether DDOS protection should be enabled
  • reserved_ip_v4: str IP address of the floating IP to use as the main IP of this server
  • hostname: str The hostname to assign to this server
  • tag: str The tag to assign to this server
Returns:The newly created node.
Return type:Node
delete_key_pair(key_pair)[source]

Delete an SSH key. :param key_pair: The SSH key to delete :type key_pair: SSHKey

Returns:True on success
Return type:bool
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
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 of NodeImage
list_key_pairs()[source]

List all the available SSH keys. :return: Available SSH keys. :rtype: list of SSHKey

list_locations()[source]

List data centers for a provider

Returns:list of node location objects
Return type:list of NodeLocation
list_nodes()[source]

List all nodes.

Returns:list of node objects
Return type:list of Node
list_sizes()[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 of NodeSize
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
class libcloud.compute.drivers.vultr.VultrNodeDriverV2(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Bases: libcloud.compute.drivers.vultr.VultrNodeDriver

Vultr API v2 NodeDriver.

Parameters:
  • key (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 = {'active': running, 'halted': stopped, 'pending': pending, 'rebooting': rebooting, 'resizing': reconfiguring}
SNAPSHOT_STATE_MAP = {'complete': available, 'pending': creating}
VOLUME_STATE_MAP = {'active': available, 'pending': creating}
attach_volume(node: libcloud.compute.base.Node, volume: libcloud.compute.base.StorageVolume, ex_live: bool = True) → bool[source]

Attaches volume to node.

Parameters:
  • node (Node) – Node to attach volume to.
  • volume (StorageVolume) – Volume to attach.
  • ex_live (bool) – Attach the volume without restarting the node.
Rytpe:

bool

connectionCls

alias of libcloud.common.vultr.VultrConnectionV2

create_node(name: str, size: libcloud.compute.base.NodeSize, location: libcloud.compute.base.NodeLocation, image: Optional[libcloud.compute.base.NodeImage] = None, ex_ssh_key_ids: Optional[List[str]] = None, ex_private_network_ids: Optional[List[str]] = None, ex_snapshot: Union[libcloud.common.vultr.VultrNodeSnapshot, str, None] = None, ex_enable_ipv6: bool = False, ex_backups: bool = False, ex_userdata: Optional[str] = None, ex_ddos_protection: bool = False, ex_enable_private_network: bool = False, ex_ipxe_chain_url: Optional[str] = None, ex_iso_id: Optional[str] = None, ex_script_id: Optional[str] = None, ex_image_id: Optional[str] = None, ex_activation_email: bool = False, ex_hostname: Optional[str] = None, ex_tag: Optional[str] = None, ex_firewall_group_id: Optional[str] = None, ex_reserved_ipv4: Optional[str] = None, ex_persistent_pxe: bool = False) → libcloud.compute.base.Node[source]

Create a new node.

Parameters:
  • name (str) – The new node’s name.
  • size – The size to use to create the node.
  • location – The location to provision the node.
  • image – The image to use to provision the node.
  • ex_ssh_key_ids (list of str) – List of SSH keys to install on this node.
  • ex_private_network_ids (list of str) – The network ids to attach to node. This parameter takes precedence over ex_enable_private_network (VPS only)
  • ex_snapshot – The snapshot to use when deploying the node. Mutually exclusive with image,
  • ex_enable_ipv6 (bool) – Whether to enable IPv6.
  • ex_backups (bool) – Enable automatic backups for the node. (VPS only)
  • ex_userdata (str) – String containing user data
  • ex_ddos_protection (bool) – Enable DDoS protection (VPS only)
  • ex_enable_private_network (bool) –

    Enable private networking. Mutually exclusive with

    ex_private_network_ids.

    (VPS only)

  • ex_ipxe_chain_url (str) – The URL location of the iPXE chainloader (VPS only)
  • ex_iso_id (str) – The ISO id to use when deploying this node. (VPS only)
  • ex_script_id (str) – The startup script id to use when deploying this node.
  • ex_image_id (str) – The Application image_id to use when deploying this node.
  • ex_activation_email (bool) – Notify by email after deployment.
  • ex_hostname (str) – The hostname to use when deploying this node.
  • ex_tag (str) – The user-supplied tag.
  • ex_firewall_group_id (str) – The Firewall Group id to attach to this node. (VPS only)
  • ex_reserved_ipv4 (str) – Id of the floating IP to use as the main IP of this node.
  • ex_persistent_pxe (bool) – Enable persistent PXE (Bare Metal only)
create_volume(size: int, name: str, location: Union[libcloud.compute.base.NodeLocation, str]) → libcloud.compute.base.StorageVolume[source]

Create a new volume.

Parameters:
  • size (int) – Size of the volume in gigabytes. Size may range between 10 and 10000.
  • name (str) – Name of the volume to be created.
  • location (NodeLocation or str) – Which data center to create the volume in.
Returns:

The newly created volume.

Return type:

StorageVolume

delete_key_pair(key_pair: libcloud.compute.base.KeyPair) → bool[source]

Delete existing key pair.

Parameters:key_pair (KeyPair) – The key pair object to delete.
Return type:bool
destroy_node(node: libcloud.compute.base.Node) → bool[source]

Destroy the given node.

Parameters:node – The node to be destroyed.
Return type:bool
destroy_volume(volume: libcloud.compute.base.StorageVolume) → bool[source]

Destroys a storage volume.

Parameters:volume (StorageVolume) – Volume to be destroyed
Return type:bool
detach_volume(volume: libcloud.compute.base.StorageVolume, ex_live: bool = True) → bool[source]

Detaches a volume from a node.

Parameters:
  • volume (StorageVolume) – Volume to be detached
  • ex_live (bool) – Detach the volume without restarting the node.
Return type:

bool

ex_create_network(cidr_block: str, location: Union[libcloud.compute.base.NodeLocation, str], description: Optional[str] = None) → libcloud.common.vultr.VultrNetwork[source]

Create a private network.

Parameters:
  • cidr_block (str) – The CIDR block assigned to the network.
  • location – The location to create the network.
  • description (str) – A description of the private network.
Return type:

class:VultrNetwork

ex_create_snapshot(node: libcloud.compute.base.Node, description: Optional[str] = None) → libcloud.common.vultr.VultrNodeSnapshot[source]

Create snapshot from a node.

Parameters:
  • node – Node to create the snapshot from.
  • description (str) – A description of the snapshot.
Return type:

class:VultrNodeSnapshot

ex_delete_snapshot(snapshot: libcloud.common.vultr.VultrNodeSnapshot) → bool[source]

Delete the given snapshot.

Parameters:snapshot – The snapshot to delete.
Return type:bool
ex_destroy_bare_metal_node(node: libcloud.compute.base.Node) → bool[source]

Destroy the given bare metal node.

Parameters:node – The bare metal node to be destroyed.
Return type:bool
ex_destroy_network(network: libcloud.common.vultr.VultrNetwork) → bool[source]

Delete a private network.

Parameters:network – The network to destroy.
Return type:bool
ex_get_network(network_id: str) → libcloud.common.vultr.VultrNetwork[source]

Retrieve a private network.

Parameters:network_id (str) – ID of the network to retrieve.
Return type:
class:VultrNetwork
ex_get_node(node_id: str) → libcloud.compute.base.Node[source]

Retrieve a node object.

Parameters:node_id – ID of the node to retrieve.
Return type:
class:Node
ex_get_snapshot(snapshot_id: str) → libcloud.common.vultr.VultrNodeSnapshot[source]

Retrieve a snapshot.

Parameters:snapshot_id (str) – ID of the snapshot to retrieve.
Return type:
class:VultrNodeSnapshot
ex_get_volume(volume_id: str) → libcloud.compute.base.StorageVolume[source]

Retrieve a single volume.

Parameters:volume_id (str) – The ID of the volume to fetch.
Rtype :class:StorageVolume
Returns:StorageVolume instance on success.
ex_list_available_sizes_for_location(location: libcloud.compute.base.NodeLocation) → List[str][source]

Get a list of available sizes for the given location.

Parameters:location – The location to get available sizes for.
Returns:A list of available size IDs for the given location.
Return type:list of str
ex_list_bare_metal_nodes() → List[libcloud.compute.base.Node][source]

List all bare metal nodes.

Returns:list of node objects
Return type:list of :class: Node
ex_list_bare_metal_sizes() → List[libcloud.compute.base.NodeSize][source]

List bare metal sizes.

Return type:list of :class: NodeSize
ex_list_networks() → List[libcloud.common.vultr.VultrNetwork][source]

List all private networks.

Return type:list of :class: VultrNetwork
ex_list_snapshots() → List[libcloud.common.vultr.VultrNodeSnapshot][source]

List node snapshots.

Return type:list of :class: VultrNodeSnapshot
ex_reboot_bare_metal_node(node: libcloud.compute.base.Node) → bool[source]

Reboot the given bare metal node.

Parameters:node – The bare metal node to be rebooted.
Return type:bool
ex_resize_node(node: libcloud.compute.base.Node, size: libcloud.compute.base.NodeSize) → bool[source]

Change size for the given node, only applicable for VPS nodes.

Parameters:
  • node – The node to be resized.
  • size – The new size.
ex_resize_volume(volume: libcloud.compute.base.StorageVolume, size: int) → bool[source]

Resize a volume.

Parameters:
  • volume (StorageVolume) – The volume to resize.
  • size (int) – The new volume size in GBs. Size may range between 10 and 10000.
Return type:

bool

ex_start_bare_metal_node(node: libcloud.compute.base.Node) → bool[source]

Start the given bare metal node.

Parameters:node – The bare metal node to be started.
Return type:bool
ex_stop_bare_metal_node(node: libcloud.compute.base.Node) → bool[source]

Stop the given bare metal node.

Parameters:node – The bare metal node to be stopped.
Return type:bool
ex_stop_nodes(nodes: List[libcloud.compute.base.Node]) → bool[source]

Stops all the nodes given.

: param nodes: A list of the nodes to stop. : type node: list of: class Node

: rtype: bool

get_key_pair(key_id: str) → libcloud.compute.base.KeyPair[source]

Retrieve a single key pair.

Parameters:key_id (str) – ID of the key pair to retrieve.
Return type:
class:KeyPair
import_key_pair_from_string(name: str, key_material: str) → libcloud.compute.base.KeyPair[source]

Import a new public key from string.

Parameters:
  • name (str) – Key pair name.
  • key_material (str) – Public key material.
Return type:

class:KeyPair

list_images() → List[libcloud.compute.base.NodeImage][source]

List available node images.

Return type:list of :class: NodeImage
list_key_pairs() → List[libcloud.compute.base.KeyPair][source]

List all the available SSH key pair objects.

Return type:list of KeyPair
list_locations() → List[libcloud.compute.base.NodeLocation][source]

List available node locations.

Return type:list of :class: NodeLocation
list_nodes(ex_list_bare_metals: bool = True) → List[libcloud.compute.base.Node][source]

List all nodes.

Parameters:ex_list_bare_metals (bool) – Whether to fetch bare metal nodes.
Returns:list of node objects
Return type:list of :class: Node
list_sizes(ex_list_bare_metals: bool = True) → List[libcloud.compute.base.NodeSize][source]

List available node sizes.

Parameters:ex_list_bare_metals (bool) – Whether to fetch bare metal sizes.
Return type:list of :class: NodeSize
list_volumes() → List[libcloud.compute.base.StorageVolume][source]

List storage volumes.

Return type:list of StorageVolume
reboot_node(node: libcloud.compute.base.Node) → bool[source]

Reboot the given node.

Parameters:node – The node to be rebooted.
Return type:bool
start_node(node: libcloud.compute.base.Node) → bool[source]

Start the given node.

Parameters:node – The node to be started.
Return type:bool
stop_node(node: libcloud.compute.base.Node) → bool[source]

Stop the given node.

Parameters:node – The node to be stopped.
Return type:bool
class libcloud.compute.drivers.vultr.VultrResponse(response, connection)[source]

Bases: libcloud.common.base.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
class libcloud.compute.drivers.vultr.rate_limited(sleep=0.5, retries=1)[source]

Bases: object

Decorator for retrying Vultr calls that are rate-limited.

Parameters:
  • sleep (int) – Seconds to sleep after being rate-limited.
  • retries (int) – Number of retries.

Module contents

Drivers for working with different providers