l.c.d.e.BaseEC2NodeDriver(NodeDriver) : class documentation

Part of libcloud.compute.drivers.ec2 View Source View In Hierarchy

Known subclasses: libcloud.compute.drivers.ec2.EC2NodeDriver, libcloud.compute.drivers.ec2.EucNodeDriver, libcloud.compute.drivers.ec2.NimbusNodeDriver

Base Amazon EC2 node driver.

Used for main EC2 and other derivate driver classes to inherit from it.
Method list_nodes List all nodes
Method list_sizes List sizes on a provider
Method list_images List all images
Method list_locations List data centers for a provider
Method create_volume Create a new volume.
Method destroy_volume Destroys a storage volume.
Method attach_volume Attaches volume to node.
Method detach_volume Detaches a volume from a node.
Method ex_create_keypair Creates a new keypair
Method ex_import_keypair imports a new public key
Method ex_describe_all_keypairs Describes all keypairs.
Method ex_describe_keypairs Describes a keypair by name
Method ex_list_security_groups List existing Security Groups.
Method ex_create_security_group Creates a new Security Group
Method ex_authorize_security_group Edit a Security Group to allow specific traffic.
Method ex_authorize_security_group_permissive Edit a Security Group to allow all traffic.
Method ex_list_availability_zones Return a list of L{ExEC2AvailabilityZone} objects for the current region.
Method ex_describe_tags Return a dictionary of tags for a resource (Node or StorageVolume).
Method ex_create_tags Create tags for a resource (Node or StorageVolume).
Method ex_delete_tags Delete tags from a resource.
Method ex_describe_all_addresses Return all the Elastic IP addresses for this account optionally, return only the allocated addresses
Method ex_associate_addresses Associate an IP address with a particular node.
Method ex_describe_addresses Return Elastic IP addresses for all the nodes in the provided list.
Method ex_describe_addresses_for_node Return a list of Elastic IP addresses associated with this node.
Method ex_modify_instance_attribute Modify node attributes. A list of valid attributes can be found at http://goo.gl/gxcj8
Method ex_change_node_size Change the node size. Note: Node must be turned of before changing the size.
Method create_node Create a new EC2 node
Method reboot_node Reboot a node.
Method ex_start_node Start the node by passing in the node object, does not work with instance store backed instances
Method ex_stop_node Stop the node by passing in the node object, does not work with instance store backed instances
Method destroy_node Destroy a node.
Method _pathlist Converts a key and an array of values into AWS query param format.
Method _get_boolean Undocumented
Method _get_state_boolean Checks for the instances's state
Method _get_terminate_boolean Undocumented
Method _to_nodes Undocumented
Method _to_node Undocumented
Method _to_images Undocumented
Method _to_image Undocumented
Method _to_volume Undocumented
Method _add_instance_filter Add instance filter to the provided params dictionary.

Inherited from NodeDriver:

Method __init__ @param key: API key or username to be used (required) @type key: C{str}
Method deploy_node Create a new node, and start deployment.
Method wait_until_running Block until the given nodes are fully booted and have an IP address assigned.
Method _wait_until_running Undocumented
Method _ssh_client_connect Try to connect to the remote SSH server. If a connection times out or is refused it is retried up to timeout number of seconds.
Method _run_deployment_script Run the deployment script on the provided node. At this point it is assumed that SSH connection has already been established.
Method _get_size_price Undocumented

Inherited from BaseDriver (via NodeDriver):

Method _ex_connection_class_kwargs Return extra connection keyword arguments which are passed to the Connection class constructor.
def _pathlist(self, key, arr): (source)
Converts a key and an array of values into AWS query param format.
def _get_boolean(self, element): (source)
Undocumented
def _get_state_boolean(self, element): (source)
Checks for the instances's state
def _get_terminate_boolean(self, element): (source)
Undocumented
def _to_nodes(self, object, xpath, groups=None): (source)
Undocumented
def _to_node(self, element, groups=None): (source)
Undocumented
def _to_images(self, object): (source)
Undocumented
def _to_image(self, element): (source)
Undocumented
def _to_volume(self, element, name): (source)
Undocumented
def list_nodes(self, ex_node_ids=None): (source)
List all nodes

Ex_node_ids parameter is used to filter the list of
nodes that should be returned. Only the nodes
with the corresponding node ids will be returned.

@param      ex_node_ids: List of C{node.id}
@type       ex_node_ids: C{list} of C{str}

@rtype: C{list} of L{Node}
def list_sizes(self, location=None): (source)
List sizes on a provider

@keyword location: The location at which to list sizes
@type location: L{NodeLocation}

@return: list of node size objects
@rtype: C{list} of L{NodeSize}
def list_images(self, location=None, ex_image_ids=None): (source)
List all images

Ex_image_ids parameter is used to filter the list of
images that should be returned. Only the images
with the corresponding image ids will be returned.

@param      ex_image_ids: List of C{NodeImage.id}
@type       ex_image_ids: C{list} of C{str}

@rtype: C{list} of L{NodeImage}
def list_locations(self): (source)
List data centers for a provider

@return: list of node location objects
@rtype: C{list} of L{NodeLocation}
def create_volume(self, size, name, location=None, snapshot=None): (source)
Create a new volume.

@param      size: Size of volume in gigabytes (required)
@type       size: C{int}

@keyword    name: Name of the volume to be created
@type       name: C{str}

@keyword    location: Which data center to create a volume in. If
                       empty, undefined behavoir will be selected.
                       (optional)
@type       location: L{NodeLocation}

@keyword    snapshot:  Name of snapshot from which to create the new
                       volume.  (optional)
@type       snapshot:  C{str}

@return: The newly created volume.
@rtype: L{StorageVolume}
def destroy_volume(self, volume): (source)
Destroys a storage volume.

@param      volume: Volume to be destroyed
@type       volume: L{StorageVolume}

@rtype: C{bool}
def attach_volume(self, node, volume, device): (source)
Attaches volume to node.

@param      node: Node to attach volume to
@type       node: L{Node}

@param      volume: Volume to attach
@type       volume: L{StorageVolume}

@param      device: Where the device is exposed,
                    e.g. '/dev/sdb (optional)
@type       device: C{str}

@rtype: C{bool}
def detach_volume(self, volume): (source)
Detaches a volume from a node.

@param      volume: Volume to be detached
@type       volume: L{StorageVolume}

@rtype: C{bool}
def ex_create_keypair(self, name): (source)
Creates a new keypair

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

@param      name: The name of the keypair to Create. This must be
    unique, otherwise an InvalidKeyPair.Duplicate exception is raised.
@type       name: C{str}

@rtype: C{dict}
def ex_import_keypair(self, name, keyfile): (source)
imports a new public key

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

@param      name: The name of the public key to import. This must be
 unique, otherwise an InvalidKeyPair.Duplicate exception is raised.
@type       name: C{str}

@param     keyfile: The filename with path of the public key to import.
@type      keyfile: C{str}

@rtype: C{dict}
def ex_describe_all_keypairs(self): (source)
Describes all keypairs.

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

@rtype: C{list} of C{str}
def ex_describe_keypairs(self, name): (source)
Describes a keypair by name

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

@param      name: The name of the keypair to describe.
@type       name: C{str}

@rtype: C{dict}
def ex_list_security_groups(self): (source)
List existing Security Groups.

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

@rtype: C{list} of C{str}
def ex_create_security_group(self, name, description): (source)
Creates a new Security Group

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

@param      name: The name of the security group to Create.
                  This must be unique.
@type       name: C{str}

@param      description: Human readable description of a Security
Group.
@type       description: C{str}

@rtype: C{str}
def ex_authorize_security_group(self, name, from_port, to_port, cidr_ip, protocol='tcp'): (source)
Edit a Security Group to allow specific traffic.

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

@param      name: The name of the security group to edit
@type       name: C{str}

@param      from_port: The beginning of the port range to open
@type       from_port: C{str}

@param      to_port: The end of the port range to open
@type       to_port: C{str}

@param      cidr_ip: The ip to allow traffic for.
@type       cidr_ip: C{str}

@param      protocol: tcp/udp/icmp
@type       protocol: C{str}

@rtype: C{bool}
def ex_authorize_security_group_permissive(self, name): (source)
Edit a Security Group to allow all traffic.

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

@param      name: The name of the security group to edit
@type       name: C{str}

@rtype: C{list} of C{str}
def ex_list_availability_zones(self, only_available=True): (source)
Return a list of L{ExEC2AvailabilityZone} objects for the
current region.

Note: This is an extension method and is only available for EC2
driver.

@keyword  only_available: If true, return only availability zones
                          with state 'available'
@type     only_available: C{str}

@rtype: C{list} of L{ExEC2AvailabilityZone}
def ex_describe_tags(self, resource): (source)
Return a dictionary of tags for a resource (Node or StorageVolume).

@param  resource: resource which should be used
@type   resource: L{Node} or L{StorageVolume}

@return: dict Node tags
@rtype: C{dict}
def ex_create_tags(self, resource, tags): (source)
Create tags for a resource (Node or StorageVolume).

@param resource: Resource to be tagged
@type resource: L{Node} or L{StorageVolume}

@param tags: A dictionary or other mapping of strings to strings,
             associating tag names with tag values.
@type tags: C{dict}

@rtype: C{bool}
def ex_delete_tags(self, resource, tags): (source)
Delete tags from a resource.

@param resource: Resource to be tagged
@type resource: L{Node} or L{StorageVolume}

@param tags: A dictionary or other mapping of strings to strings,
             specifying the tag names and tag values to be deleted.
@type tags: C{dict}

@rtype: C{bool}
def _add_instance_filter(self, params, node): (source)
Add instance filter to the provided params dictionary.
def ex_describe_all_addresses(self, only_allocated=False): (source)
Return all the Elastic IP addresses for this account
optionally, return only the allocated addresses

@param    only_allocated: If true, return only those addresses
                          that are associated with an instance
@type     only_allocated: C{str}

@return:   list list of elastic ips for this particular account.
@rtype: C{list} of C{str}
def ex_associate_addresses(self, node, elastic_ip_address): (source)
Associate an IP address with a particular node.

@param      node: Node instance
@type       node: L{Node}

@param      elastic_ip_address: IP address which should be used
@type       elastic_ip_address: C{str}

@rtype: C{bool}
def ex_describe_addresses(self, nodes): (source)
Return Elastic IP addresses for all the nodes in the provided list.

@param      nodes: List of C{Node} instances
@type       nodes: C{list} of L{Node}

@return: Dictionary where a key is a node ID and the value is a
    list with the Elastic IP addresses associated with this node.
@rtype: C{dict}
def ex_describe_addresses_for_node(self, node): (source)
Return a list of Elastic IP addresses associated with this node.

@param      node: Node instance
@type       node: L{Node}

@return: list Elastic IP addresses attached to this node.
@rtype: C{list} of C{str}
def ex_modify_instance_attribute(self, node, attributes): (source)
Modify node attributes.
A list of valid attributes can be found at http://goo.gl/gxcj8

@param      node: Node instance
@type       node: L{Node}

@param      attributes: Dictionary with node attributes
@type       attributes: C{dict}

@return: True on success, False otherwise.
@rtype: C{bool}
def ex_change_node_size(self, node, new_size): (source)
Change the node size.
Note: Node must be turned of before changing the size.

@param      node: Node instance
@type       node: L{Node}

@param      new_size: NodeSize intance
@type       new_size: L{NodeSize}

@return: True on success, False otherwise.
@rtype: C{bool}
def create_node(self, **kwargs): (source)
Create a new EC2 node

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

@inherits: L{NodeDriver.create_node}

@keyword    ex_mincount: Minimum number of instances to launch
@type       ex_mincount: C{int}

@keyword    ex_maxcount: Maximum number of instances to launch
@type       ex_maxcount: C{int}

@keyword    ex_securitygroup: Name of security group
@type       ex_securitygroup: C{str}

@keyword    ex_keyname: The name of the key pair
@type       ex_keyname: C{str}

@keyword    ex_userdata: User data
@type       ex_userdata: C{str}

@keyword    ex_clienttoken: Unique identifier to ensure idempotency
@type       ex_clienttoken: C{str}

@keyword    ex_blockdevicemappings: C{list} of C{dict} block device
            mappings. Example:
            [{'DeviceName': '/dev/sdb', 'VirtualName': 'ephemeral0'}]
@type       ex_blockdevicemappings: C{list} of C{dict}
def reboot_node(self, node): (source)
Reboot a node.

@param node: The node to be rebooted
@type node: L{Node}

@return: True if the reboot was successful, otherwise False
@rtype: C{bool}
def ex_start_node(self, node): (source)
Start the node by passing in the node object, does not work with
instance store backed instances

@param      node: Node which should be used
@type       node: L{Node}

@rtype: C{bool}
def ex_stop_node(self, node): (source)
Stop the node by passing in the node object, does not work with
instance store backed instances

@param      node: Node which should be used
@type       node: L{Node}

@rtype: C{bool}
def destroy_node(self, node): (source)
Destroy a node.

Depending upon the provider, this may destroy all data associated with
the node, including backups.

@param node: The node to be destroyed
@type node: L{Node}

@return: True if the destroy was successful, otherwise False
@rtype: C{bool}
API Documentation for libcloud, generated by pydoctor at 2013-03-28 10:45:49.