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:
- Abiquo 3.4 (http://wiki.abiquo.com/display/ABI34/The+Abiquo+API)
-
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 ProviderInitializes 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
¶
-
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:
- Create a group if it does not exist.
- Register a new node in the group.
- Deploy the node and boot it.
- 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 destroyedReturns: 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: - group (
-
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 theNodeGroup
, 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 runReturns: 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
ofNodeImage
-
list_locations
()[source]¶ Return list of locations where the user has access to.
Returns: the list of NodeLocation
available for the current userReturn type: list
ofNodeLocation
-
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
ofNode
-
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
ofNodeSizes
-
name
= 'Abiquo'¶
-
reboot_node
(node)[source]¶ Reboot a node.
Parameters: node ( Node
) – The node to be rebootedReturns: True if the reboot was successful, otherwise False Return type: bool
-
timeout
= 2000¶
-
type
= 'abiquo'¶
-
website
= 'http://www.abiquo.com/'¶
- user_id (
-
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.
AzureHTTPResponse
(status, message, headers, body)[source]¶ Bases:
object
-
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
- node (
-
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
- size (
-
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
- volume (
-
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.
- ex_cloud_service_name (
-
destroy_volume
()[source]¶ Destroys a storage volume.
Parameters: volume ( StorageVolume
) – Volume to be destroyedReturn type: bool
-
detach_volume
()[source]¶ Detaches a volume from a node.
Parameters: volume ( StorageVolume
) – Volume to be detachedReturn type: bool
-
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
- name (
-
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
- name (
-
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_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_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 nameReturn type: list
ofNode
-
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
ofStorageVolume
-
name
= 'Azure Virtual machines'¶
-
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
- ex_cloud_service_name (
-
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]¶
-
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
change_deployment_to_xml
(configuration, treat_warnings_as_error, mode, extended_properties)[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
doc_from_xml
(document_element_name, inner_xml=None)[source]¶ Wraps the specified xml in an xml root element with default azure namespaces
-
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
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
-
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.
ConfigurationSetInputEndpoint
(name='', protocol='', port='', local_port='', load_balanced_endpoint_set_name='', enable_direct_server_return=False)[source]¶
-
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.
Deployments
[source]¶ Bases:
libcloud.compute.drivers.azure.WindowsAzureDataTypedList
-
list_type
¶ alias of
Deployment
-
-
class
libcloud.compute.drivers.azure.
Disks
[source]¶ Bases:
libcloud.compute.drivers.azure.WindowsAzureDataTypedList
-
class
libcloud.compute.drivers.azure.
HostedService
[source]¶ Bases:
libcloud.compute.drivers.azure.WindowsAzureData
,libcloud.utils.misc.ReprMixin
-
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
-
class
libcloud.compute.drivers.azure.
InputEndpoints
[source]¶ Bases:
libcloud.compute.drivers.azure.WindowsAzureDataTypedList
-
list_type
¶ alias of
InputEndpoint
-
-
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]¶
-
class
libcloud.compute.drivers.azure.
Locations
[source]¶ Bases:
libcloud.compute.drivers.azure.WindowsAzureDataTypedList
-
class
libcloud.compute.drivers.azure.
OSVirtualHardDisk
(source_image_name=None, media_link=None, host_caching=None, disk_label=None, disk_name=None)[source]¶
-
class
libcloud.compute.drivers.azure.
OperatingSystemFamilies
[source]¶ Bases:
libcloud.compute.drivers.azure.WindowsAzureDataTypedList
-
list_type
¶ alias of
OperatingSystemFamily
-
-
class
libcloud.compute.drivers.azure.
OperatingSystems
[source]¶ Bases:
libcloud.compute.drivers.azure.WindowsAzureDataTypedList
-
list_type
¶ alias of
OperatingSystem
-
-
class
libcloud.compute.drivers.azure.
PublicKeys
[source]¶ Bases:
libcloud.compute.drivers.azure.WindowsAzureDataTypedList
-
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
-
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.
SubscriptionCertificates
[source]¶ Bases:
libcloud.compute.drivers.azure.WindowsAzureDataTypedList
-
list_type
¶ alias of
SubscriptionCertificate
-
-
class
libcloud.compute.drivers.azure.
VMImages
[source]¶ Bases:
libcloud.compute.drivers.azure.WindowsAzureDataTypedList
-
class
libcloud.compute.drivers.azure.
VirtualIPs
[source]¶ Bases:
libcloud.compute.drivers.azure.WindowsAzureDataTypedList
-
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¶
-
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
- node (
-
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 forcreated_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 forcreate_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
orAzureVhdImage
orAzureComputeGalleryImage
) – 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
orNodeAuthPassword
) – 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: - name (
-
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
ofstr
) – 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
- size (
-
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
- volume (:class`StorageVolume`) – Instance of
-
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
- 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.
- resource_group (
-
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
- node (
-
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
- name (
-
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
- name (
-
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
- name (
Update tags on any resource supporting tags.
Parameters: - resource (
str
or Azure object with anid
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
- resource (
-
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
- name (
-
ex_delete_public_ip
(public_ip)[source]¶ Delete a public ip address resource.
Parameters: public_ip (.AzureIPAddress) – Public ip address resource to delete
-
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
- currency (
-
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
- resource_group (
-
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
ofAzureNetworkSecurityGroup
-
ex_list_networks
()[source]¶ List virtual networks.
Returns: A list of virtual networks. Return type: list
ofAzureNetwork
-
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
ofAzureNic
-
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
ofAzureIPAddress
-
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
ofAzureResourceGroup
-
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
ofAzureSubnet
-
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.
- 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
ofstr
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
ofNodeLocation
- node (:class:
-
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.
- node (
-
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: - network_interface (
-
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
: orAzureVhdImage
: :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
ofAzureImage
- ex_offer (
-
list_locations
()[source]¶ List data centers available with the current subscription.
Returns: list of node location objects Return type: list
ofNodeLocation
-
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
ofNode
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.
- ex_resource_group (
-
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
ofNodeSize
-
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
ofVolumeSnapshot
-
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 rebootedReturns: True if the reboot was successful, otherwise False Return type: bool
-
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
- node (
-
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
¶
-
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
orlist
ofstr
) – Name or list of server group ids to add server to
- ex_userdata (
-
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 destroyedReturns: 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 hostnameReturn 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
ofdict
-
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
- cloud_ip_id (
-
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
- cloud_ip_id (
-
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
ofNodeImage
-
list_locations
()[source]¶ List data centers for a provider
Returns: list of node location objects Return type: list
ofNodeLocation
-
list_sizes
()[source]¶ List sizes on a provider
Parameters: location ( NodeLocation
) – The location at which to list sizesReturns: list of node size objects Return type: list
ofNodeSize
-
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
ofstr
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 creationReturns: The newly created node. Return type: Node
- ssh_keys:
-
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
-
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
.
-
name
= 'Cloudscale'¶
-
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
orFalse
-
valid_response_codes
= [<HTTPStatus.OK: 200>, <HTTPStatus.ACCEPTED: 202>, <HTTPStatus.CREATED: 201>, <HTTPStatus.NO_CONTENT: 204>]¶
- response (
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/'¶
- key (
-
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.
- name (
-
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 usedReturn 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 usedReturn 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 usedReturn type: bool
-
ex_set_node_configuration
(node, **kwargs)[source]¶ Update a node configuration. Changing most of the parameters requires node to be stopped.
Parameters: - node (
libcloud.compute.base.Node
) – Node which should be used - kwargs (
dict
) – keyword arguments
Return type: bool
- node (
-
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 usedReturn type: bool
-
ex_static_ip_destroy
(ip_address)[source]¶ Destroy a static IP address.
Parameters: ip_address ( str
) – IP address which should be usedReturn type: bool
-
ex_static_ip_list
()[source]¶ Return a list of available static IP addresses.
Return type: list
ofstr
-
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_sizes
(location=None)[source]¶ List sizes on a provider
Parameters: location ( NodeLocation
) – The location at which to list sizesReturns: list of node size objects Return type: list
ofNodeSize
-
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 usedReturn 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
- node (
-
connectionCls
¶ alias of
CloudSigma_2_0_Connection
-
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.
Installation CD:
- Create a server and attach installation cd
- Start a server
Pre-installed image:
- Clone provided library drive so we can use it
- Resize cloned drive to the desired size
- Create a server and attach cloned drive
- 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
ofstr
) – 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
- size (
-
delete_key_pair
(key_pair)[source]¶ Delete an existing key pair.
Parameters: key_pair ( KeyPair
) – Key pair objectReturn 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 destroyedReturn type: bool
-
detach_volume
(node, volume)[source]¶ Detaches a volume from a node.
Parameters: volume ( StorageVolume
) – Volume to be detachedReturn type: bool
-
ex_attach_drive
(node, drive)[source]¶ Attach drive to node
Parameters: - node (
libcloud.compute.base.Node
) – Node to attach the drive to. - drive (
CloudSigmaDrive
) – Drive to attach.
Returns: True
on success,False
otherwise.Return type: bool
- node (
-
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: - policy (
-
ex_clone_drive
(drive, name=None, ex_avoid=None)[source]¶ Clone a library or a standard drive.
Parameters: - drive (
libcloud.compute.base.NodeImage
orCloudSigmaDrive
) – 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: - drive (
-
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: - name (
-
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: - name (
-
ex_create_firewall_policy
(name, rules=None)[source]¶ Create a firewall policy.
Parameters: - name (
str
) – Policy name. - rules (
list
ofdict
) – List of firewall policy rules to associate with this policy. (optional)
Returns: Created firewall policy object.
Return type: - name (
-
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.
- amount (
-
ex_create_tag
(name, resource_uuids=None)[source]¶ Create a tag.
Parameters: - name (
str
) – Tag name. - resource_uuids (
list
ofstr
) – Optional list of resource UUIDs to assign this tag go.
Returns: Created tag object.
Return type: - name (
-
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_edit_node
(node, params)[source]¶ Edit a node.
Parameters: - node (
libcloud.compute.base.Node
) – Node to edit. - params (
dict
) – Node parameters to update.
:return Edited node. :rtype:
libcloud.compute.base.Node
- 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_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
ofCloudSigmaTag
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
oflist
-
ex_list_firewall_policies
()[source]¶ List firewall policies.
Return type: list
ofCloudSigmaFirewallPolicy
-
ex_list_library_drives
()[source]¶ Return a list of all the available library drives (pre-installed and installation CDs).
Return type: list
ofCloudSigmaDrive
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
oflist
-
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
- status (
List all the available tags.
Return type: list
ofCloudSigmaTag
objects
-
ex_list_user_drives
()[source]¶ Return a list of all the available user’s drives.
Return type: list
ofCloudSigmaDrive
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:
-
ex_tag_resource
(resource, tag)[source]¶ Associate tag with the provided resource.
Parameters: - resource (
libcloud.compute.base.Node
orCloudSigmaDrive
) – Resource to associate a tag with. - tag (
CloudSigmaTag
) – Tag to associate with the resources.
Returns: Updated tag object.
Return type: - resource (
-
ex_tag_resources
(resources, tag)[source]¶ Associate tag with the provided resources.
Parameters: - resources (
list
oflibcloud.compute.base.Node
orCloudSigmaDrive
) – Resources to associate a tag with. - tag (
CloudSigmaTag
) – Tag to associate with the resources.
Returns: Updated tag object.
Return type: - resources (
-
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- name (
-
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
ofKeyPair
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_volumes
()[source]¶ List storage volumes.
Return type: list
ofStorageVolume
-
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)
- node (
-
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
orNone
) – Point at which the error occurred. Can be None.
- http_code (
-
class
libcloud.compute.drivers.cloudsigma.
CloudSigmaNodeSize
(id, name, cpu, ram, disk, bandwidth, price, driver, extra=None)[source]¶
-
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).
- id (
-
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.
- id (
-
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.
- id (
-
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
ofCloudSigmaFirewallPolicyRule
objects) – Rules associated with this policy.
- id (
-
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.
- action (
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
- id (
-
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:
-
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 groupReturn 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:
-
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:
-
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:
-
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:
-
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:
-
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_create_ip_forwarding_rule
(address, protocol, start_port, end_port=None)[source]¶ Add a NAT/firewall forwarding rule for a port or ports.
- id (
-
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: 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: - name (
-
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
ofCloudStackNetwork
) – 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
ofstr
) – 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
ofCloudStackAffinityGroup
) – List of affinity groups to assign to the node
Return type: - networks (
-
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 ofStorageVolume
- name (str) – The name of the snapshot is disregarded by CloudStack drivers
Return type: VolumeSnapshot
- volume (
-
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
- key_pair (
-
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_snapshot
(snapshot)[source]¶ Destroys a snapshot.
Parameters: snapshot ( VolumeSnapshot
) – The snapshot to deleteReturn 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: - vpc_id (
-
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
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
- securitygroupname (
-
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
- node (
-
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: - name (
-
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: - network_id (
-
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: - address (
-
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
- node (
-
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
- name (
-
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: - display_text (
-
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: - protocol (
-
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: - name (
-
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: - address (
-
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
- name (
-
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
- snapshot – Instance of
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
- resource_ids (
-
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:
-
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 - vpn_customer_gateway (
-
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 - cidr_list (
-
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 usedReturn type: bool
-
ex_delete_firewall_rule
(firewall_rule)[source]¶ Remove a Firewall Rule.
Parameters: firewall_rule ( CloudStackFirewallRule
) – Firewall rule which should be usedReturn 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
- node (
-
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
- keypair (
-
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: - node (
CloudStackNode
) – Node used in the rule - rule (
CloudStackPortForwardingRule
) – Forwarding rule which should be used
Return type: bool
- node (
-
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
- domainid (
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
- resource_ids (
-
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: - node_id (
-
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: - volume_id (
-
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
- name (
-
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
- name (
-
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
ofCloudStackAffinityGroupTypes
-
ex_list_affinity_groups
()[source]¶ List Affinity Groups
:rtype
list
ofCloudStackAffinityGroup
-
ex_list_disk_offerings
()[source]¶ Fetch a list of all available disk offerings.
Return type: list
ofCloudStackDiskOffering
-
ex_list_egress_firewall_rules
()[source]¶ Lists all egress Firewall Rules
Return type: list
ofCloudStackEgressFirewallRule
-
ex_list_firewall_rules
()[source]¶ Lists all Firewall Rules
Return type: list
ofCloudStackFirewallRule
-
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
ofCloudStackIPForwardingRule
- account (
-
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
ofdict
- projectid (
-
ex_list_network_acl
()[source]¶ Lists all network ACL items
Return type: list
ofCloudStackNetworkACL
-
ex_list_network_acllists
()[source]¶ Lists all network ACLs
Return type: list
ofCloudStackNetworkACLList
-
ex_list_network_offerings
()[source]¶ List the available network offerings
:rtype
list
ofCloudStackNetworkOffering
-
ex_list_networks
(project=None)[source]¶ List the available networks
Parameters: project ( CloudStackProject
) – Optional project the networks belongs to.:rtype
list
ofCloudStackNetwork
-
ex_list_nics
(node)[source]¶ List the available networks
Parameters: vm (:class:`CloudStackNode) – Node Object :rtype
list
ofCloudStackNic
-
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
ofCloudStackPortForwardingRule
- account (
-
ex_list_projects
()[source]¶ List the available projects
:rtype
list
ofCloudStackProject
-
ex_list_public_ips
()[source]¶ Lists all Public IP Addresses.
Return type: list
ofCloudStackAddress
-
ex_list_routers
(vpc_id=None)[source]¶ List routers
:rtype
list
ofCloudStackRouter
-
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
- domainid (
-
ex_list_vpc_offerings
()[source]¶ List the available vpc offerings
:rtype
list
ofCloudStackVPCOffering
-
ex_list_vpcs
(project=None)[source]¶ List the available VPCs
Parameters: project ( CloudStackProject
) – Optional project under which VPCs are present.:rtype
list
ofCloudStackVPC
-
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
ofCloudStackVpnConnection
- account (
-
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
ofCloudStackVpnCustomerGateway
- account (
-
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
ofCloudStackVpnGateway
- account (
-
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
- name (
-
ex_release_public_ip
(address)[source]¶ Release a public IP.
Parameters: address ( CloudStackAddress
) – CloudStackAddress which should be usedReturn 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: - acl_id (
-
ex_restore
(node, template=None)[source]¶ Restore virtual machine
Parameters: - node (
CloudStackNode
) – Node to restore - template (
NodeImage
) – Optional new template
:rtype
str
- node (
-
ex_revoke_security_group_ingress
(rule_id)[source]¶ Revoke/delete an ingress security rule
Parameters: id ( str
) – The ID of the ingress security ruleReturn 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
- id (
-
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: - node (
CloudStackNode
) – Node to update. - affinity_group_list (
list
ofCloudStackAffinityGroup
) – List of CloudStackAffinityGroup to associate
:rtype
CloudStackNode
- node (
-
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: - name (
-
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
ofNodeImage
-
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
oflibcloud.compute.base.KeyPair
- projectid (
-
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
ofCloudStackNode
- project (
-
list_volumes
(node=None)[source]¶ List all volumes
Parameters: node ( CloudStackNode
) – Only return volumes for the provided node.Return type: list
ofStorageVolume
-
name
= 'CloudStack'¶
-
reboot_node
(node)[source]¶ @inherits:
NodeDriver.reboot_node
:type node:CloudStackNode
Return type: bool
-
type
= 'cloudstack'¶
-
website
= 'http://cloudstack.org/'¶
- host (
-
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: - node (
-
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.
-
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.
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 versionv1
. (deprecated) - api_version (
str
) – Specifies the API version to use. Defaults to usingv2
, 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'¶
- key (
-
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
- node (
-
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
- node (
-
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)
- name (
-
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
ofstr
tags - user_data:
str
for cloud-config data - ssh_keys:
list
ofint
key ids orstr
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
ofint
key ids orstr
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
- backups:
-
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
- size (
-
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 deletedReturn 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 destroyedReturns: 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 destroyedReturn type: bool
-
detach_volume
(volume)[source]¶ Detaches a volume from a node.
Parameters: volume ( StorageVolume
) – Volume to be detachedReturn type: bool
-
ex_attach_floating_ip_to_node
(node, ip)[source]¶ Attach the floating IP to the node
Parameters: - node (
Node
) – node - ip (
str
orDigitalOcean_v2_FloatingIpAddress
) – floating IP to attach
Return type: bool
- node (
-
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 removeReturn 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
- node (
-
ex_get_floating_ip
(ip)[source]¶ Get specified floating IP
Parameters: ip ( str
) – floating IP to getReturn 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 usedReturn type: Node
-
ex_list_floating_ips
()[source]¶ List floating IPs
Return type: list
ofDigitalOcean_v2_FloatingIpAddress
-
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_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
- node (
-
get_image
(image_id)[source]¶ Get an image based on an image_id
@inherits:
NodeDriver.get_image
Parameters: image_id ( int
) – Image identifierReturns: 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
ofNodeImage
-
list_key_pairs
()[source]¶ List all the available SSH keys.
Returns: Available SSH keys. Return type: list
ofKeyPair
-
list_locations
(ex_available=True)[source]¶ List locations
Parameters: ex_available – Only return locations which are available.
-
list_sizes
(location=None)[source]¶ List sizes on a provider
Parameters: location ( NodeLocation
) – The location at which to list sizesReturns: list of node size objects Return type: list
ofNodeSize
-
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
ofStorageVolume
-
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
orstr
) – (required) OS Image to boot on node. - auth (
NodeAuthPassword
orstr
orNone
) – 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
orstr
) – (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’ orstr
) – (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
- name (
-
destroy_node
(node)[source]¶ Deletes a node, node must be stopped before deletion
Parameters: node ( Node
) – The node to deleteReturn type: bool
-
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
- node (
-
ex_apply_tag_to_asset
(asset, tag_key, value=None)[source]¶ Apply a tag to a Dimension Data Asset
Parameters: - asset (
Node
orNodeImage
orDimensionDataNewtorkDomain
orDimensionDataVlan
orDimensionDataPublicIpBlock
) – The asset to apply a tag to. (required) - tag_key (
DimensionDataTagKey
orstr
) – 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 theDimensionDataTagKey
requires it
Return type: bool
- asset (
-
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
- node (
-
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
oflist
- start_date (
-
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
orstr
) – Filters the node list to nodes that are located in this location
Return type: list
oflist
- start_date (
-
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
- nic_id (:
-
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
- node (
-
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
- node (
-
ex_clean_failed_deployment
(node)[source]¶ Removes a node that has failed to deploy
Parameters: node ( Node
orstr
) – 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
- node (
-
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
ofNode
orlist
ofstr
) – The list of nodes to create a rule forReturn type: bool
-
ex_create_firewall_rule
(network_domain, rule, position, position_relative_to_rule=None)[source]¶ Creates a firewall rule
Parameters: - network_domain (
DimensionDataNetworkDomain
orstr
) – 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
orstr
) – The rule or rule name in which to decide positioning by
Return type: bool
- network_domain (
-
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
ofDimensionDataIpAddressList
- ex_network_domain (
-
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
- network_domain (
-
ex_create_network
(location, name, description=None)[source]¶ Create a new network in an MCP 1.0 location
Parameters: - location (
NodeLocation
orstr
) – 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
- location (
-
ex_create_network_domain
(location, name, service_plan, description=None)[source]¶ Deploy a new network domain to a data center
Parameters: - location (
NodeLocation
orstr
) – 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
- location (
-
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
orstr
) – (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
orstr
) – (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’ orstr
) – (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
- name (
-
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_network_domain (:
-
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
- name (
-
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
- network_domain (
-
ex_delete_anti_affinity_rule
(anti_affinity_rule)[source]¶ Remove anti affinity rule
Parameters: anti_affinity_rule ( DimensionDataAntiAffinityRule
orstr
) – The anti affinity rule to deleteReturn type: bool
-
ex_delete_firewall_rule
(rule)[source]¶ Delete a firewall rule
Parameters: rule ( DimensionDataFirewallRule
) – The rule to deleteReturn 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 deleteReturn type: bool
-
ex_delete_network
(network)[source]¶ Delete a network from an MCP 1 data center
Parameters: network ( DimensionDataNetwork
) – The network to deleteReturn type: bool
-
ex_delete_network_domain
(network_domain)[source]¶ Delete a network domain
Parameters: network_domain ( DimensionDataNetworkDomain
) – The network domain to deleteReturn 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 deletedReturn type: bool
-
ex_delete_vlan
(vlan)[source]¶ Deletes an existing VLAN
Parameters: vlan ( DimensionDataNetworkDomain
) – The VLAN to deleteReturn 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 removeReturn 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
oflist
- start_date (
-
ex_disable_monitoring
(node)[source]¶ Disables cloud monitoring for a node
Parameters: node ( Node
) – The node to stop monitoringReturn 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
orstr
) – (optional) The rule or rule name in which to decide the relative rule for positioning.
Return type: bool
- rule (
-
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’ orstr
) – Child IP Address List or id to be included in this IP Address List
Returns: a list of DimensionDataIpAddressList objects
Return type: list
ofDimensionDataIpAddressList
- ex_ip_address_list (:class:’DimensionDataIpAddressList’
or
-
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
ofDimensionDataPortList
- ex_portlist (:
-
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
- node (
-
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
- nic_id_1 (:
-
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 updateReturns: 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 imageReturn 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 imageReturn type: NodeImage
-
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 imageReturn 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
ofDimensionDataIpAddressList
- ex_network_domain (
-
ex_get_location_by_id
(id)[source]¶ Get location by ID.
Parameters: id ( str
) – ID of the node location which should be usedReturn 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
- network_domain (
-
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 domainReturn type: DimensionDataNetworkDomain
-
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 IDReturns: DimensionDataPortList object Return type: DimensionDataPort
-
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 VLANReturns: 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
orstr
) – The network to list anti affinity rules for One of network, network_domain, or node is required - network_domain (
DimensionDataNetworkDomain
orstr
) – The network domain to list anti affinity rules One of network, network_domain, or node is required - node (
Node
orstr
) – 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
ofDimensionDataAntiAffinityRule
- network (
-
ex_list_customer_images
(location=None)[source]¶ Return a list of customer imported images
Parameters: location ( NodeLocation
orstr
) – The target locationReturn type: list
ofNodeImage
-
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 IDReturns: a list of DimensionDataIpAddressList objects Return type: list
ofDimensionDataIpAddressList
-
ex_list_nat_rules
(network_domain)[source]¶ Get NAT rules for the network domain
Parameters: network_domain ( DimensionDataNetworkDomain
) – The network domain the rules belongs toReturn type: list
ofDimensionDataNatRule
-
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
orstr
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
ofDimensionDataNetwork
- name (
-
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
orstr
) – The target locationReturns: a list of DimensionDataNetwork objects Return type: list
ofDimensionDataNetwork
-
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
orstr
) – 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
orstr
) – Filters the node list to nodes that are in this VLAN - image (
NodeImage
orstr
) – 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
orstr
) – Filters the node list to nodes in this network - network_domain (
DimensionDataNetworkDomain
orstr
) – Filters the node list to nodes in this network domain
Returns: a list of Node objects
Return type: generator
of list ofNode
- location (
-
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 IDReturns: a list of DimensionDataPortList objects Return type: list
ofDimensionDataPortList
-
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
ofDimensionDataTagKey
- id (
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
orstr
) – 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
ofDimensionDataTag
- asset_id (
-
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
orstr
) – 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
ofDimensionDataVlan
- location (
-
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
orstr
) – 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
- tag_key (
-
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 usedReturn 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
- node (
-
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
- node (
-
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
- node (
-
ex_remove_tag_from_asset
(asset, tag_key)[source]¶ Remove a tag from an asset
Parameters: - asset (
Node
orNodeImage
orDimensionDataNewtorkDomain
orDimensionDataVlan
orDimensionDataPublicIpBlock
) – The asset to remove a tag from. (required) - tag_key (
DimensionDataTagKey
orstr
) – The tag key you want to remove (required)
Return type: bool
- asset (
-
ex_remove_tag_key
(tag_key)[source]¶ Modify a specific tag key
Parameters: tag_key ( DimensionDataTagKey
orstr
) – 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
- network (
-
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 usedReturn 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
- rule (
-
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
oflist
- start_date (
-
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
oflist
- start_date (
-
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
- node (
-
ex_update_network_domain
(network_domain)[source]¶ Update the properties of a network domain
Parameters: network_domain ( DimensionDataNetworkDomain
) – The network domain with updated propertiesReturns: 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
- node (
-
ex_update_vlan
(vlan)[source]¶ Updates the properties of the given VLAN Only name and description are updated
Parameters: vlan ( DimensionDataNetworkDomain
) – The VLAN to updateReturns: 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 usedReturn 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
orlist
) – 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
- state (
-
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
- ovf_package_name (
-
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
orstr
) – Filters the node list to nodes that are located in this locationReturns: List of images available Return type: list
ofNodeImage
-
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 idReturns: List of locations Return type: list
ofNodeLocation
-
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
orstr
) – The locationReturns: a list of DimensionDataNetwork objects Return type: list
ofDimensionDataNetwork
-
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
orstr
) – 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
orstr
) – Filters the node list to nodes that are in this VLAN - ex_image (
NodeImage
orstr
) – 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
orstr
) – Filters the node list to nodes in this network - ex_network_domain (
DimensionDataNetworkDomain
orstr
) – Filters the node list to nodes in this network domain
Returns: a list of Node objects
Return type: list
ofNode
- ex_location (
-
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 rebootReturn type: bool
-
selected_region
= None¶
-
start_node
(node)[source]¶ Powers on an existing deployed server
Parameters: node ( Node
) – Node which should be usedReturn 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 usedReturn 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.
-
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
) – CredentialsReturn 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
-
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- name (
-
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
-
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
- node (
-
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
- source_region (
-
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
ofdict
) – 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
- node – Instance of
-
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
ofdict
) –list
ofdict
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.
- ex_keyname (
-
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
- size (
-
create_volume_snapshot
(volume, name=None, ex_metadata=None)[source]¶ Create snapshot from volume
Parameters: - volume (
StorageVolume
) – Instance ofStorageVolume
- name (
str
) – Name of snapshot (optional) - ex_metadata (
dict
) – The Key/Value metadata to associate with a snapshot (optional)
Return type: VolumeSnapshot
- volume (
-
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 destroyedReturns: 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 destroyedReturn type: bool
-
destroy_volume_snapshot
(snapshot)[source]¶ Destroys a snapshot.
Parameters: snapshot ( VolumeSnapshot
) – The snapshot to deleteReturn type: bool
-
detach_volume
(volume, ex_force=False)[source]¶ Detaches a volume from a node.
Parameters: volume ( StorageVolume
) – Volume to be detachedReturn 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
orstr
- node (
- key (