Update third party packages.

This commit is contained in:
Chris Church
2014-01-02 15:09:48 -05:00
parent 2b7af0a2ec
commit d8423a3342
573 changed files with 34282 additions and 10890 deletions

View File

@@ -37,6 +37,7 @@ RegionData = {
'ap-northeast-1': 'ec2.ap-northeast-1.amazonaws.com',
'ap-southeast-1': 'ec2.ap-southeast-1.amazonaws.com',
'ap-southeast-2': 'ec2.ap-southeast-2.amazonaws.com',
'cn-north-1': 'ec2.cn-north-1.amazonaws.com.cn',
}

View File

@@ -37,7 +37,7 @@ class Address(EC2Object):
"""
def __init__(self, connection=None, public_ip=None, instance_id=None):
EC2Object.__init__(self, connection)
super(Address, self).__init__(connection)
self.connection = connection
self.public_ip = public_ip
self.instance_id = instance_id

View File

@@ -55,6 +55,7 @@ RegionData = {
'ap-northeast-1': 'autoscaling.ap-northeast-1.amazonaws.com',
'ap-southeast-1': 'autoscaling.ap-southeast-1.amazonaws.com',
'ap-southeast-2': 'autoscaling.ap-southeast-2.amazonaws.com',
'cn-north-1': 'autoscaling.cn-north-1.amazonaws.com.cn',
}
@@ -114,7 +115,7 @@ class AutoScaleConnection(AWSQueryConnection):
self.DefaultRegionEndpoint,
AutoScaleConnection)
self.region = region
AWSQueryConnection.__init__(self, aws_access_key_id,
super(AutoScaleConnection, self).__init__(aws_access_key_id,
aws_secret_access_key,
is_secure, port, proxy, proxy_port,
proxy_user, proxy_pass,
@@ -163,7 +164,7 @@ class AutoScaleConnection(AWSQueryConnection):
# get availability zone information (required param)
zones = as_group.availability_zones
self.build_list_params(params, zones, 'AvailabilityZones')
if as_group.desired_capacity:
if as_group.desired_capacity is not None:
params['DesiredCapacity'] = as_group.desired_capacity
if as_group.vpc_zone_identifier:
params['VPCZoneIdentifier'] = as_group.vpc_zone_identifier
@@ -785,7 +786,7 @@ class AutoScaleConnection(AWSQueryConnection):
params = {'AutoScalingGroupName': group_name,
'DesiredCapacity': desired_capacity}
if honor_cooldown:
params['HonorCooldown'] = json.dumps('True')
params['HonorCooldown'] = 'true'
return self.get_status('SetDesiredCapacity', params)

View File

@@ -129,8 +129,8 @@ class AutoScalingGroup(object):
:param health_check_type: The service you want the health status from,
Amazon EC2 or Elastic Load Balancer.
:type launch_config_name: str or LaunchConfiguration
:param launch_config_name: Name of launch configuration (required).
:type launch_config: str or LaunchConfiguration
:param launch_config: Name of launch configuration (required).
:type load_balancers: list
:param load_balancers: List of load balancers.

View File

@@ -14,21 +14,21 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
"""
Represents an EC2 Bundle Task
Represents an EC2 Bundle Task
"""
from boto.ec2.ec2object import EC2Object
class BundleInstanceTask(EC2Object):
def __init__(self, connection=None):
EC2Object.__init__(self, connection)
super(BundleInstanceTask, self).__init__(connection)
self.id = None
self.instance_id = None
self.progress = None
@@ -38,7 +38,7 @@ class BundleInstanceTask(EC2Object):
self.prefix = None
self.upload_policy = None
self.upload_policy_signature = None
self.update_time = None
self.update_time = None
self.code = None
self.message = None

View File

@@ -41,6 +41,7 @@ RegionData = {
'ap-northeast-1': 'monitoring.ap-northeast-1.amazonaws.com',
'ap-southeast-1': 'monitoring.ap-southeast-1.amazonaws.com',
'ap-southeast-2': 'monitoring.ap-southeast-2.amazonaws.com',
'cn-north-1': 'monitoring.cn-north-1.amazonaws.com.cn',
}
@@ -107,7 +108,7 @@ class CloudWatchConnection(AWSQueryConnection):
if self.region.name == 'eu-west-1':
validate_certs = False
AWSQueryConnection.__init__(self, aws_access_key_id,
super(CloudWatchConnection, self).__init__(aws_access_key_id,
aws_secret_access_key,
is_secure, port, proxy, proxy_port,
proxy_user, proxy_pass,
@@ -117,7 +118,7 @@ class CloudWatchConnection(AWSQueryConnection):
validate_certs=validate_certs)
def _required_auth_capability(self):
return ['ec2']
return ['hmac-v4']
def build_dimension_param(self, dimension, params):
prefix = 'Dimensions.member'

View File

@@ -77,13 +77,6 @@ class Metric(object):
:param statistics: A list of statistics names Valid values:
Average | Sum | SampleCount | Maximum | Minimum
:type dimensions: dict
:param dimensions: A dictionary of dimension key/values where
the key is the dimension name and the value
is either a scalar value or an iterator
of values to be associated with that
dimension.
:type unit: string
:param unit: The unit for the metric. Value values are:
Seconds | Microseconds | Milliseconds | Bytes | Kilobytes |

View File

@@ -31,6 +31,7 @@ from datetime import datetime
from datetime import timedelta
import boto
from boto.auth import detect_potential_sigv4
from boto.connection import AWSQueryConnection
from boto.resultset import ResultSet
from boto.ec2.image import Image, ImageAttribute, CopyImage
@@ -62,6 +63,7 @@ from boto.ec2.instancestatus import InstanceStatusSet
from boto.ec2.volumestatus import VolumeStatusSet
from boto.ec2.networkinterface import NetworkInterface
from boto.ec2.attributes import AccountAttribute, VPCAttribute
from boto.ec2.blockdevicemapping import BlockDeviceMapping, BlockDeviceType
from boto.exception import EC2ResponseError
#boto.set_stream_logger('ec2')
@@ -69,7 +71,7 @@ from boto.exception import EC2ResponseError
class EC2Connection(AWSQueryConnection):
APIVersion = boto.config.get('Boto', 'ec2_version', '2013-10-01')
APIVersion = boto.config.get('Boto', 'ec2_version', '2013-10-15')
DefaultRegionName = boto.config.get('Boto', 'ec2_region_name', 'us-east-1')
DefaultRegionEndpoint = boto.config.get('Boto', 'ec2_region_endpoint',
'ec2.us-east-1.amazonaws.com')
@@ -89,7 +91,7 @@ class EC2Connection(AWSQueryConnection):
region = RegionInfo(self, self.DefaultRegionName,
self.DefaultRegionEndpoint)
self.region = region
AWSQueryConnection.__init__(self, aws_access_key_id,
super(EC2Connection, self).__init__(aws_access_key_id,
aws_secret_access_key,
is_secure, port, proxy, proxy_port,
proxy_user, proxy_pass,
@@ -100,6 +102,7 @@ class EC2Connection(AWSQueryConnection):
if api_version:
self.APIVersion = api_version
@detect_potential_sigv4
def _required_auth_capability(self):
return ['ec2']
@@ -260,7 +263,9 @@ class EC2Connection(AWSQueryConnection):
def register_image(self, name=None, description=None, image_location=None,
architecture=None, kernel_id=None, ramdisk_id=None,
root_device_name=None, block_device_map=None,
dry_run=False, virtualization_type=None):
dry_run=False, virtualization_type=None,
sriov_net_support=None,
snapshot_id=None):
"""
Register an image.
@@ -299,6 +304,16 @@ class EC2Connection(AWSQueryConnection):
* paravirtual
* hvm
:type sriov_net_support: string
:param sriov_net_support: Advanced networking support.
Valid choices are:
* simple
:type snapshot_id: string
:param snapshot_id: A snapshot ID for the snapshot to be used
as root device for the image. Mutually exclusive with
block_device_map, requires root_device_name
:rtype: string
:return: The new image id
"""
@@ -317,12 +332,19 @@ class EC2Connection(AWSQueryConnection):
params['ImageLocation'] = image_location
if root_device_name:
params['RootDeviceName'] = root_device_name
if snapshot_id:
root_vol = BlockDeviceType(snapshot_id=snapshot_id)
block_device_map = BlockDeviceMapping()
block_device_map[root_device_name] = root_vol
if block_device_map:
block_device_map.ec2_build_list_params(params)
if dry_run:
params['DryRun'] = 'true'
if virtualization_type:
params['VirtualizationType'] = virtualization_type
if sriov_net_support:
params['SriovNetSupport'] = sriov_net_support
rs = self.get_object('RegisterImage', params, ResultSet, verb='POST')
image_id = getattr(rs, 'imageId', None)
@@ -510,7 +532,8 @@ class EC2Connection(AWSQueryConnection):
# Instance methods
def get_all_instances(self, instance_ids=None, filters=None, dry_run=False):
def get_all_instances(self, instance_ids=None, filters=None, dry_run=False,
max_results=None):
"""
Retrieve all the instance reservations associated with your account.
@@ -535,6 +558,10 @@ class EC2Connection(AWSQueryConnection):
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run.
:type max_results: int
:param max_results: The maximum number of paginated instance
items per response.
:rtype: list
:return: A list of :class:`boto.ec2.instance.Reservation`
@@ -543,10 +570,11 @@ class EC2Connection(AWSQueryConnection):
'replaced with get_all_reservations.'),
PendingDeprecationWarning)
return self.get_all_reservations(instance_ids=instance_ids,
filters=filters, dry_run=dry_run)
filters=filters, dry_run=dry_run,
max_results=max_results)
def get_only_instances(self, instance_ids=None, filters=None,
dry_run=False):
dry_run=False, max_results=None):
# A future release should rename this method to get_all_instances
# and make get_only_instances an alias for that.
"""
@@ -566,17 +594,22 @@ class EC2Connection(AWSQueryConnection):
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run.
:type max_results: int
:param max_results: The maximum number of paginated instance
items per response.
:rtype: list
:return: A list of :class:`boto.ec2.instance.Instance`
"""
reservations = self.get_all_reservations(instance_ids=instance_ids,
filters=filters,
dry_run=dry_run)
dry_run=dry_run,
max_results=max_results)
return [instance for reservation in reservations
for instance in reservation.instances]
def get_all_reservations(self, instance_ids=None, filters=None,
dry_run=False):
dry_run=False, max_results=None):
"""
Retrieve all the instance reservations associated with your account.
@@ -594,6 +627,10 @@ class EC2Connection(AWSQueryConnection):
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run.
:type max_results: int
:param max_results: The maximum number of paginated instance
items per response.
:rtype: list
:return: A list of :class:`boto.ec2.instance.Reservation`
"""
@@ -612,6 +649,8 @@ class EC2Connection(AWSQueryConnection):
self.build_filter_params(params, filters)
if dry_run:
params['DryRun'] = 'true'
if max_results is not None:
params['MaxResults'] = max_results
return self.get_list('DescribeInstances', params,
[('item', Reservation)], verb='POST')
@@ -723,6 +762,16 @@ class EC2Connection(AWSQueryConnection):
* cc1.4xlarge
* cg1.4xlarge
* cc2.8xlarge
* g2.2xlarge
* c3.large
* c3.xlarge
* c3.2xlarge
* c3.4xlarge
* c3.8xlarge
* i2.xlarge
* i2.2xlarge
* i2.4xlarge
* i2.8xlarge
:type placement: string
:param placement: The Availability Zone to launch the instance into.
@@ -1028,6 +1077,7 @@ class EC2Connection(AWSQueryConnection):
* sourceDestCheck
* groupSet
* ebsOptimized
* sriovNetSupport
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run.
@@ -1137,6 +1187,7 @@ class EC2Connection(AWSQueryConnection):
* sourceDestCheck - Boolean (true)
* groupSet - Set of Security Groups or IDs
* ebsOptimized - Boolean (false)
* sriovNetSupport - String - ie: 'simple'
:type value: string
:param value: The new value for the attribute
@@ -1249,7 +1300,8 @@ class EC2Connection(AWSQueryConnection):
def get_spot_price_history(self, start_time=None, end_time=None,
instance_type=None, product_description=None,
availability_zone=None, dry_run=False):
availability_zone=None, dry_run=False,
max_results=None):
"""
Retrieve the recent history of spot instances pricing.
@@ -1283,6 +1335,10 @@ class EC2Connection(AWSQueryConnection):
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run.
:type max_results: int
:param max_results: The maximum number of paginated items
per response.
:rtype: list
:return: A list tuples containing price and timestamp.
"""
@@ -1299,6 +1355,8 @@ class EC2Connection(AWSQueryConnection):
params['AvailabilityZone'] = availability_zone
if dry_run:
params['DryRun'] = 'true'
if max_results is not None:
params['MaxResults'] = max_results
return self.get_list('DescribeSpotPriceHistory', params,
[('item', SpotPriceHistory)], verb='POST')
@@ -1361,16 +1419,34 @@ class EC2Connection(AWSQueryConnection):
:type instance_type: string
:param instance_type: The type of instance to run:
* t1.micro
* m1.small
* m1.medium
* m1.large
* m1.xlarge
* m3.xlarge
* m3.2xlarge
* c1.medium
* c1.xlarge
* m2.xlarge
* m2.2xlarge
* m2.4xlarge
* cr1.8xlarge
* hi1.4xlarge
* hs1.8xlarge
* cc1.4xlarge
* t1.micro
* cg1.4xlarge
* cc2.8xlarge
* g2.2xlarge
* c3.large
* c3.xlarge
* c3.2xlarge
* c3.4xlarge
* c3.8xlarge
* i2.xlarge
* i2.2xlarge
* i2.4xlarge
* i2.8xlarge
:type placement: string
:param placement: The availability zone in which to launch
@@ -2672,7 +2748,7 @@ class EC2Connection(AWSQueryConnection):
def import_key_pair(self, key_name, public_key_material, dry_run=False):
"""
mports the public key from an RSA key pair that you created
imports the public key from an RSA key pair that you created
with a third-party tool.
Supported formats:
@@ -3931,7 +4007,7 @@ class EC2Connection(AWSQueryConnection):
params['Tag.%d.Value'%i] = value
i += 1
def get_all_tags(self, filters=None, dry_run=False):
def get_all_tags(self, filters=None, dry_run=False, max_results=None):
"""
Retrieve all the metadata tags associated with your account.
@@ -3948,6 +4024,10 @@ class EC2Connection(AWSQueryConnection):
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run.
:type max_results: int
:param max_results: The maximum number of paginated instance
items per response.
:rtype: list
:return: A list of :class:`boto.ec2.tag.Tag` objects
"""
@@ -3956,6 +4036,8 @@ class EC2Connection(AWSQueryConnection):
self.build_filter_params(params, filters)
if dry_run:
params['DryRun'] = 'true'
if max_results is not None:
params['MaxResults'] = max_results
return self.get_list('DescribeTags', params,
[('item', Tag)], verb='POST')

View File

@@ -53,7 +53,7 @@ class TaggedEC2Object(EC2Object):
"""
def __init__(self, connection=None):
EC2Object.__init__(self, connection)
super(TaggedEC2Object, self).__init__(connection)
self.tags = TagSet()
def startElement(self, name, attrs, connection):

View File

@@ -44,6 +44,7 @@ RegionData = {
'ap-northeast-1': 'elasticloadbalancing.ap-northeast-1.amazonaws.com',
'ap-southeast-1': 'elasticloadbalancing.ap-southeast-1.amazonaws.com',
'ap-southeast-2': 'elasticloadbalancing.ap-southeast-2.amazonaws.com',
'cn-north-1': 'elasticloadbalancing.cn-north-1.amazonaws.com.cn',
}
@@ -102,7 +103,7 @@ class ELBConnection(AWSQueryConnection):
region = RegionInfo(self, self.DefaultRegionName,
self.DefaultRegionEndpoint)
self.region = region
AWSQueryConnection.__init__(self, aws_access_key_id,
super(ELBConnection, self).__init__(aws_access_key_id,
aws_secret_access_key,
is_secure, port, proxy, proxy_port,
proxy_user, proxy_pass,
@@ -159,7 +160,7 @@ class ELBConnection(AWSQueryConnection):
[SSLCertificateId]) where LoadBalancerPortNumber and
InstancePortNumber are integer values between 1 and 65535,
Protocol is a string containing either 'TCP', 'SSL', HTTP', or
'HTTPS'; SSLCertificateID is the ARN of a AWS AIM
'HTTPS'; SSLCertificateID is the ARN of a AWS IAM
certificate, and must be specified when doing HTTPS.
:type subnets: list of strings
@@ -264,7 +265,7 @@ class ELBConnection(AWSQueryConnection):
[SSLCertificateId]) where LoadBalancerPortNumber and
InstancePortNumber are integer values between 1 and 65535,
Protocol is a string containing either 'TCP', 'SSL', HTTP', or
'HTTPS'; SSLCertificateID is the ARN of a AWS AIM
'HTTPS'; SSLCertificateID is the ARN of a AWS IAM
certificate, and must be specified when doing HTTPS.
:type complex_listeners: List of tuples
@@ -390,6 +391,76 @@ class ELBConnection(AWSQueryConnection):
params, LoadBalancerZones)
return obj.zones
def modify_lb_attribute(self, load_balancer_name, attribute, value):
"""Changes an attribute of a Load Balancer
:type load_balancer_name: string
:param load_balancer_name: The name of the Load Balancer
:type attribute: string
:param attribute: The attribute you wish to change.
* crossZoneLoadBalancing - Boolean (true)
:type value: string
:param value: The new value for the attribute
:rtype: bool
:return: Whether the operation succeeded or not
"""
bool_reqs = ('crosszoneloadbalancing',)
if attribute.lower() in bool_reqs:
if isinstance(value, bool):
if value:
value = 'true'
else:
value = 'false'
params = {'LoadBalancerName': load_balancer_name}
if attribute.lower() == 'crosszoneloadbalancing':
params['LoadBalancerAttributes.CrossZoneLoadBalancing.Enabled'
] = value
else:
raise ValueError('InvalidAttribute', attribute)
return self.get_status('ModifyLoadBalancerAttributes', params,
verb='GET')
def get_all_lb_attributes(self, load_balancer_name):
"""Gets all Attributes of a Load Balancer
:type load_balancer_name: string
:param load_balancer_name: The name of the Load Balancer
:rtype: boto.ec2.elb.attribute.LbAttributes
:return: The attribute object of the ELB.
"""
from boto.ec2.elb.attributes import LbAttributes
params = {'LoadBalancerName': load_balancer_name}
return self.get_object('DescribeLoadBalancerAttributes',
params, LbAttributes)
def get_lb_attribute(self, load_balancer_name, attribute):
"""Gets an attribute of a Load Balancer
This will make an EC2 call for each method call.
:type load_balancer_name: string
:param load_balancer_name: The name of the Load Balancer
:type attribute: string
:param attribute: The attribute you wish to see.
* crossZoneLoadBalancing - Boolean
:rtype: Attribute dependent
:return: The new value for the attribute
"""
attributes = self.get_all_lb_attributes(load_balancer_name)
if attribute.lower() == 'crosszoneloadbalancing':
return attributes.cross_zone_load_balancing.enabled
return None
def register_instances(self, load_balancer_name, instances):
"""
Add new Instances to an existing Load Balancer.

View File

@@ -0,0 +1,61 @@
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
# tribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the fol-
# lowing conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# Created by Chris Huegle for TellApart, Inc.
class CrossZoneLoadBalancingAttribute(object):
"""
Represents the CrossZoneLoadBalancing segement of ELB Attributes.
"""
def __init__(self, connection=None):
self.enabled = None
def __repr__(self):
return 'CrossZoneLoadBalancingAttribute(%s)' % (
self.enabled)
def startElement(self, name, attrs, connection):
pass
def endElement(self, name, value, connection):
if name == 'Enabled':
if value.lower() == 'true':
self.enabled = True
else:
self.enabled = False
class LbAttributes(object):
"""
Represents the Attributes of an Elastic Load Balancer.
"""
def __init__(self, connection=None):
self.connection = connection
self.cross_zone_load_balancing = CrossZoneLoadBalancingAttribute(
self.connection)
def __repr__(self):
return 'LbAttributes(%s)' % (
repr(self.cross_zone_load_balancing))
def startElement(self, name, attrs, connection):
if name == 'CrossZoneLoadBalancing':
return self.cross_zone_load_balancing
def endElement(self, name, value, connection):
pass

View File

@@ -122,6 +122,7 @@ class LoadBalancer(object):
self.vpc_id = None
self.scheme = None
self.backends = None
self._attributes = None
def __repr__(self):
return 'LoadBalancer:%s' % self.name
@@ -203,6 +204,58 @@ class LoadBalancer(object):
new_zones = self.connection.disable_availability_zones(self.name, zones)
self.availability_zones = new_zones
def get_attributes(self, force=False):
"""
Gets the LbAttributes. The Attributes will be cached.
:type force: bool
:param force: Ignore cache value and reload.
:rtype: boto.ec2.elb.attributes.LbAttributes
:return: The LbAttribues object
"""
if not self._attributes or force:
self._attributes = self.connection.get_all_lb_attributes(self.name)
return self._attributes
def is_cross_zone_load_balancing(self, force=False):
"""
Identifies if the ELB is current configured to do CrossZone Balancing.
:type force: bool
:param force: Ignore cache value and reload.
:rtype: bool
:return: True if balancing is enabled, False if not.
"""
return self.get_attributes(force).cross_zone_load_balancing.enabled
def enable_cross_zone_load_balancing(self):
"""
Turns on CrossZone Load Balancing for this ELB.
:rtype: bool
:return: True if successful, False if not.
"""
success = self.connection.modify_lb_attribute(
self.name, 'crossZoneLoadBalancing', True)
if success and self._attributes:
self._attributes.cross_zone_load_balancing.enabled = True
return success
def disable_cross_zone_load_balancing(self):
"""
Turns off CrossZone Load Balancing for this ELB.
:rtype: bool
:return: True if successful, False if not.
"""
success = self.connection.modify_lb_attribute(
self.name, 'crossZoneLoadBalancing', False)
if success and self._attributes:
self._attributes.cross_zone_load_balancing.enabled = False
return success
def register_instances(self, instances):
"""
Adds instances to this load balancer. All instances must be in the same

View File

@@ -15,13 +15,12 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
class Group:
class Group(object):
def __init__(self, parent=None):
self.id = None
self.name = None
@@ -36,4 +35,4 @@ class Group:
self.name = value
else:
setattr(self, name, value)

View File

@@ -23,8 +23,8 @@
from boto.ec2.ec2object import EC2Object, TaggedEC2Object
from boto.ec2.blockdevicemapping import BlockDeviceMapping
class ProductCodes(list):
class ProductCodes(list):
def startElement(self, name, attrs, connection):
pass
@@ -32,8 +32,8 @@ class ProductCodes(list):
if name == 'productCode':
self.append(value)
class BillingProducts(list):
class BillingProducts(list):
def startElement(self, name, attrs, connection):
pass
@@ -47,7 +47,7 @@ class Image(TaggedEC2Object):
"""
def __init__(self, connection=None):
TaggedEC2Object.__init__(self, connection)
super(Image, self).__init__(connection)
self.id = None
self.location = None
self.state = None
@@ -70,12 +70,13 @@ class Image(TaggedEC2Object):
self.virtualization_type = None
self.hypervisor = None
self.instance_lifecycle = None
self.sriov_net_support = None
def __repr__(self):
return 'Image:%s' % self.id
def startElement(self, name, attrs, connection):
retval = TaggedEC2Object.startElement(self, name, attrs, connection)
retval = super(Image, self).startElement(name, attrs, connection)
if retval is not None:
return retval
if name == 'blockDeviceMapping':
@@ -136,6 +137,8 @@ class Image(TaggedEC2Object):
self.hypervisor = value
elif name == 'instanceLifecycle':
self.instance_lifecycle = value
elif name == 'sriovNetSupport':
self.sriov_net_support = value
else:
setattr(self, name, value)
@@ -218,6 +221,16 @@ class Image(TaggedEC2Object):
* cc1.4xlarge
* cg1.4xlarge
* cc2.8xlarge
* g2.2xlarge
* c3.large
* c3.xlarge
* c3.2xlarge
* c3.4xlarge
* c3.8xlarge
* i2.xlarge
* i2.2xlarge
* i2.4xlarge
* i2.8xlarge
:type placement: string
:param placement: The Availability Zone to launch the instance into.
@@ -365,8 +378,8 @@ class Image(TaggedEC2Object):
)
return img_attrs.ramdisk
class ImageAttribute:
class ImageAttribute(object):
def __init__(self, parent=None):
self.name = None
self.kernel = None

View File

@@ -122,7 +122,7 @@ class Reservation(EC2Object):
Reservation.
"""
def __init__(self, connection=None):
EC2Object.__init__(self, connection)
super(Reservation, self).__init__(connection)
self.id = None
self.owner_id = None
self.groups = []
@@ -211,7 +211,7 @@ class Instance(TaggedEC2Object):
"""
def __init__(self, connection=None):
TaggedEC2Object.__init__(self, connection)
super(Instance, self).__init__(connection)
self.id = None
self.dns_name = None
self.public_dns_name = None
@@ -288,7 +288,7 @@ class Instance(TaggedEC2Object):
return self._placement.tenancy
def startElement(self, name, attrs, connection):
retval = TaggedEC2Object.startElement(self, name, attrs, connection)
retval = super(Instance, self).startElement(name, attrs, connection)
if retval is not None:
return retval
if name == 'monitoring':
@@ -606,8 +606,7 @@ class Instance(TaggedEC2Object):
)
class ConsoleOutput:
class ConsoleOutput(object):
def __init__(self, parent=None):
self.parent = parent
self.instance_id = None
@@ -629,7 +628,6 @@ class ConsoleOutput:
class InstanceAttribute(dict):
ValidValues = ['instanceType', 'kernel', 'ramdisk', 'userData',
'disableApiTermination',
'instanceInitiatedShutdownBehavior',
@@ -668,7 +666,6 @@ class InstanceAttribute(dict):
class SubParse(dict):
def __init__(self, section, parent=None):
dict.__init__(self)
self.section = section

View File

@@ -30,7 +30,7 @@ from boto.exception import BotoClientError
class KeyPair(EC2Object):
def __init__(self, connection=None):
EC2Object.__init__(self, connection)
super(KeyPair, self).__init__(connection)
self.name = None
self.fingerprint = None
self.material = None

View File

@@ -44,7 +44,7 @@ class GroupList(list):
class LaunchSpecification(EC2Object):
def __init__(self, connection=None):
EC2Object.__init__(self, connection)
super(LaunchSpecification, self).__init__(connection)
self.key_name = None
self.instance_type = None
self.image_id = None

View File

@@ -99,7 +99,7 @@ class NetworkInterface(TaggedEC2Object):
"""
def __init__(self, connection=None):
TaggedEC2Object.__init__(self, connection)
super(NetworkInterface, self).__init__(connection)
self.id = None
self.subnet_id = None
self.vpc_id = None
@@ -119,7 +119,8 @@ class NetworkInterface(TaggedEC2Object):
return 'NetworkInterface:%s' % self.id
def startElement(self, name, attrs, connection):
retval = TaggedEC2Object.startElement(self, name, attrs, connection)
retval = super(NetworkInterface, self).startElement(name, attrs,
connection)
if retval is not None:
return retval
if name == 'groupSet':

View File

@@ -27,7 +27,7 @@ from boto.exception import BotoClientError
class PlacementGroup(EC2Object):
def __init__(self, connection=None, name=None, strategy=None, state=None):
EC2Object.__init__(self, connection)
super(PlacementGroup, self).__init__(connection)
self.name = name
self.strategy = strategy
self.state = state

View File

@@ -16,7 +16,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -27,8 +27,8 @@ class EC2RegionInfo(RegionInfo):
"""
Represents an EC2 Region
"""
def __init__(self, connection=None, name=None, endpoint=None):
from boto.ec2.connection import EC2Connection
RegionInfo.__init__(self, connection, name, endpoint,
super(EC2RegionInfo, self).__init__(connection, name, endpoint,
EC2Connection)

View File

@@ -31,7 +31,7 @@ class ReservedInstancesOffering(EC2Object):
usage_price=None, description=None, instance_tenancy=None,
currency_code=None, offering_type=None,
recurring_charges=None, pricing_details=None):
EC2Object.__init__(self, connection)
super(ReservedInstancesOffering, self).__init__(connection)
self.id = id
self.instance_type = instance_type
self.availability_zone = availability_zone
@@ -128,9 +128,10 @@ class ReservedInstance(ReservedInstancesOffering):
availability_zone=None, duration=None, fixed_price=None,
usage_price=None, description=None,
instance_count=None, state=None):
ReservedInstancesOffering.__init__(self, connection, id, instance_type,
availability_zone, duration, fixed_price,
usage_price, description)
super(ReservedInstance, self).__init__(connection, id, instance_type,
availability_zone, duration,
fixed_price, usage_price,
description)
self.instance_count = instance_count
self.state = state
self.start = None
@@ -148,7 +149,7 @@ class ReservedInstance(ReservedInstancesOffering):
elif name == 'start':
self.start = value
else:
ReservedInstancesOffering.endElement(self, name, value, connection)
super(ReservedInstance, self).endElement(name, value, connection)
class ReservedInstanceListing(EC2Object):

View File

@@ -31,7 +31,7 @@ class SecurityGroup(TaggedEC2Object):
def __init__(self, connection=None, owner_id=None,
name=None, description=None, id=None):
TaggedEC2Object.__init__(self, connection)
super(SecurityGroup, self).__init__(connection)
self.id = id
self.owner_id = owner_id
self.name = name
@@ -44,7 +44,8 @@ class SecurityGroup(TaggedEC2Object):
return 'SecurityGroup:%s' % self.name
def startElement(self, name, attrs, connection):
retval = TaggedEC2Object.startElement(self, name, attrs, connection)
retval = super(SecurityGroup, self).startElement(name, attrs,
connection)
if retval is not None:
return retval
if name == 'ipPermissions':

View File

@@ -26,12 +26,12 @@ Represents an EC2 Elastic Block Store Snapshot
from boto.ec2.ec2object import TaggedEC2Object
from boto.ec2.zone import Zone
class Snapshot(TaggedEC2Object):
class Snapshot(TaggedEC2Object):
AttrName = 'createVolumePermission'
def __init__(self, connection=None):
TaggedEC2Object.__init__(self, connection)
super(Snapshot, self).__init__(connection)
self.id = None
self.volume_id = None
self.status = None
@@ -156,8 +156,7 @@ class Snapshot(TaggedEC2Object):
)
class SnapshotAttribute:
class SnapshotAttribute(object):
def __init__(self, parent=None):
self.snapshot_id = None
self.attrs = {}

View File

@@ -29,7 +29,7 @@ class SpotDatafeedSubscription(EC2Object):
def __init__(self, connection=None, owner_id=None,
bucket=None, prefix=None, state=None,fault=None):
EC2Object.__init__(self, connection)
super(SpotDatafeedSubscription, self).__init__(connection)
self.owner_id = owner_id
self.bucket = bucket
self.prefix = prefix

View File

@@ -120,7 +120,7 @@ class SpotInstanceRequest(TaggedEC2Object):
"""
def __init__(self, connection=None):
TaggedEC2Object.__init__(self, connection)
super(SpotInstanceRequest, self).__init__(connection)
self.id = None
self.price = None
self.type = None
@@ -141,7 +141,8 @@ class SpotInstanceRequest(TaggedEC2Object):
return 'SpotInstanceRequest:%s' % self.id
def startElement(self, name, attrs, connection):
retval = TaggedEC2Object.startElement(self, name, attrs, connection)
retval = super(SpotInstanceRequest, self).startElement(name, attrs,
connection)
if retval is not None:
return retval
if name == 'launchSpecification':

View File

@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -26,9 +26,9 @@ Represents an EC2 Spot Instance Request
from boto.ec2.ec2object import EC2Object
class SpotPriceHistory(EC2Object):
def __init__(self, connection=None):
EC2Object.__init__(self, connection)
super(SpotPriceHistory, self).__init__(connection)
self.price = 0.0
self.instance_type = None
self.product_description = None

View File

@@ -35,7 +35,7 @@ class VmType(EC2Object):
def __init__(self, connection=None, name=None, cores=None,
memory=None, disk=None):
EC2Object.__init__(self, connection)
super(VmType, self).__init__(connection)
self.connection = connection
self.name = name
self.cores = cores

View File

@@ -47,7 +47,7 @@ class Volume(TaggedEC2Object):
"""
def __init__(self, connection=None):
TaggedEC2Object.__init__(self, connection)
super(Volume, self).__init__(connection)
self.id = None
self.create_time = None
self.status = None
@@ -62,7 +62,7 @@ class Volume(TaggedEC2Object):
return 'Volume:%s' % self.id
def startElement(self, name, attrs, connection):
retval = TaggedEC2Object.startElement(self, name, attrs, connection)
retval = super(Volume, self).startElement(name, attrs, connection)
if retval is not None:
return retval
if name == 'attachmentSet':
@@ -260,7 +260,6 @@ class AttachmentSet(object):
:ivar attach_time: Attached since
:ivar device: The device the instance has mapped
"""
def __init__(self):
self.id = None
self.instance_id = None
@@ -289,8 +288,7 @@ class AttachmentSet(object):
setattr(self, name, value)
class VolumeAttribute:
class VolumeAttribute(object):
def __init__(self, parent=None):
self.id = None
self._key_name = None

View File

@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -38,7 +38,7 @@ class MessageSet(list):
self.append(value)
else:
setattr(self, name, value)
class Zone(EC2Object):
"""
Represents an Availability Zone.
@@ -48,9 +48,9 @@ class Zone(EC2Object):
:ivar region_name: The name of the region the zone is associated with.
:ivar messages: A list of messages related to the zone.
"""
def __init__(self, connection=None):
EC2Object.__init__(self, connection)
super(Zone, self).__init__(connection)
self.name = None
self.state = None
self.region_name = None
@@ -64,7 +64,7 @@ class Zone(EC2Object):
self.messages = MessageSet()
return self.messages
return None
def endElement(self, name, value, connection):
if name == 'zoneName':
self.name = value