mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 00:37:37 -02:30
Updated all vendored third-party packages.
This commit is contained in:
@@ -241,6 +241,10 @@ class AutoScaleConnection(AWSQueryConnection):
|
||||
params['EbsOptimized'] = 'true'
|
||||
else:
|
||||
params['EbsOptimized'] = 'false'
|
||||
if launch_config.associate_public_ip_address is True:
|
||||
params['AssociatePublicIpAddress'] = 'true'
|
||||
elif launch_config.associate_public_ip_address is False:
|
||||
params['AssociatePublicIpAddress'] = 'false'
|
||||
return self.get_object('CreateLaunchConfiguration', params,
|
||||
Request, verb='POST')
|
||||
|
||||
@@ -492,15 +496,19 @@ class AutoScaleConnection(AWSQueryConnection):
|
||||
If no group name or list of policy names are provided, all
|
||||
available policies are returned.
|
||||
|
||||
:type as_name: str
|
||||
:param as_name: The name of the
|
||||
:type as_group: str
|
||||
:param as_group: The name of the
|
||||
:class:`boto.ec2.autoscale.group.AutoScalingGroup` to filter for.
|
||||
|
||||
:type names: list
|
||||
:param names: List of policy names which should be searched for.
|
||||
:type policy_names: list
|
||||
:param policy_names: List of policy names which should be searched for.
|
||||
|
||||
:type max_records: int
|
||||
:param max_records: Maximum amount of groups to return.
|
||||
|
||||
:type next_token: str
|
||||
:param next_token: If you have more results than can be returned
|
||||
at once, pass in this parameter to page through all results.
|
||||
"""
|
||||
params = {}
|
||||
if as_group:
|
||||
@@ -681,9 +689,9 @@ class AutoScaleConnection(AWSQueryConnection):
|
||||
Configures an Auto Scaling group to send notifications when
|
||||
specified events take place.
|
||||
|
||||
:type as_group: str or
|
||||
:type autoscale_group: str or
|
||||
:class:`boto.ec2.autoscale.group.AutoScalingGroup` object
|
||||
:param as_group: The Auto Scaling group to put notification
|
||||
:param autoscale_group: The Auto Scaling group to put notification
|
||||
configuration on.
|
||||
|
||||
:type topic: str
|
||||
@@ -692,7 +700,12 @@ class AutoScaleConnection(AWSQueryConnection):
|
||||
|
||||
:type notification_types: list
|
||||
:param notification_types: The type of events that will trigger
|
||||
the notification.
|
||||
the notification. Valid types are:
|
||||
'autoscaling:EC2_INSTANCE_LAUNCH',
|
||||
'autoscaling:EC2_INSTANCE_LAUNCH_ERROR',
|
||||
'autoscaling:EC2_INSTANCE_TERMINATE',
|
||||
'autoscaling:EC2_INSTANCE_TERMINATE_ERROR',
|
||||
'autoscaling:TEST_NOTIFICATION'
|
||||
"""
|
||||
|
||||
name = autoscale_group
|
||||
@@ -704,6 +717,29 @@ class AutoScaleConnection(AWSQueryConnection):
|
||||
self.build_list_params(params, notification_types, 'NotificationTypes')
|
||||
return self.get_status('PutNotificationConfiguration', params)
|
||||
|
||||
def delete_notification_configuration(self, autoscale_group, topic):
|
||||
"""
|
||||
Deletes notifications created by put_notification_configuration.
|
||||
|
||||
:type autoscale_group: str or
|
||||
:class:`boto.ec2.autoscale.group.AutoScalingGroup` object
|
||||
:param autoscale_group: The Auto Scaling group to put notification
|
||||
configuration on.
|
||||
|
||||
:type topic: str
|
||||
:param topic: The Amazon Resource Name (ARN) of the Amazon Simple
|
||||
Notification Service (SNS) topic.
|
||||
"""
|
||||
|
||||
name = autoscale_group
|
||||
if isinstance(autoscale_group, AutoScalingGroup):
|
||||
name = autoscale_group.name
|
||||
|
||||
params = {'AutoScalingGroupName': name,
|
||||
'TopicARN': topic}
|
||||
|
||||
return self.get_status('DeleteNotificationConfiguration', params)
|
||||
|
||||
def set_instance_health(self, instance_id, health_status,
|
||||
should_respect_grace_period=True):
|
||||
"""
|
||||
|
||||
@@ -148,6 +148,9 @@ class AutoScalingGroup(object):
|
||||
:type vpc_zone_identifier: str
|
||||
:param vpc_zone_identifier: The subnet identifier of the Virtual
|
||||
Private Cloud.
|
||||
|
||||
:type tags: list
|
||||
:param tags: List of :class:`boto.ec2.autoscale.tag.Tag`s
|
||||
|
||||
:type termination_policies: list
|
||||
:param termination_policies: A list of termination policies. Valid values
|
||||
@@ -296,12 +299,23 @@ class AutoScalingGroup(object):
|
||||
def put_notification_configuration(self, topic, notification_types):
|
||||
"""
|
||||
Configures an Auto Scaling group to send notifications when
|
||||
specified events take place.
|
||||
specified events take place. Valid notification types are:
|
||||
'autoscaling:EC2_INSTANCE_LAUNCH',
|
||||
'autoscaling:EC2_INSTANCE_LAUNCH_ERROR',
|
||||
'autoscaling:EC2_INSTANCE_TERMINATE',
|
||||
'autoscaling:EC2_INSTANCE_TERMINATE_ERROR',
|
||||
'autoscaling:TEST_NOTIFICATION'
|
||||
"""
|
||||
return self.connection.put_notification_configuration(self,
|
||||
topic,
|
||||
notification_types)
|
||||
|
||||
def delete_notification_configuration(self, topic):
|
||||
"""
|
||||
Deletes notifications created by put_notification_configuration.
|
||||
"""
|
||||
return self.connection.delete_notification_configuration(self, topic)
|
||||
|
||||
def suspend_processes(self, scaling_processes=None):
|
||||
"""
|
||||
Suspends Auto Scaling processes for an Auto Scaling group.
|
||||
|
||||
@@ -94,7 +94,8 @@ class LaunchConfiguration(object):
|
||||
instance_type='m1.small', kernel_id=None,
|
||||
ramdisk_id=None, block_device_mappings=None,
|
||||
instance_monitoring=False, spot_price=None,
|
||||
instance_profile_name=None, ebs_optimized=False):
|
||||
instance_profile_name=None, ebs_optimized=False,
|
||||
associate_public_ip_address=None):
|
||||
"""
|
||||
A launch configuration.
|
||||
|
||||
@@ -109,8 +110,9 @@ class LaunchConfiguration(object):
|
||||
:param key_name: The name of the EC2 key pair.
|
||||
|
||||
:type security_groups: list
|
||||
:param security_groups: Names of the security groups with which to
|
||||
associate the EC2 instances.
|
||||
:param security_groups: Names or security group id's of the security
|
||||
groups with which to associate the EC2 instances or VPC instances,
|
||||
respectively.
|
||||
|
||||
:type user_data: str
|
||||
:param user_data: The user data available to launched EC2 instances.
|
||||
@@ -144,6 +146,10 @@ class LaunchConfiguration(object):
|
||||
:type ebs_optimized: bool
|
||||
:param ebs_optimized: Specifies whether the instance is optimized
|
||||
for EBS I/O (true) or not (false).
|
||||
|
||||
:type associate_public_ip_address: bool
|
||||
:param associate_public_ip_address: Used for Auto Scaling groups that launch instances into an Amazon Virtual Private Cloud.
|
||||
Specifies whether to assign a public IP address to each instance launched in a Amazon VPC.
|
||||
"""
|
||||
self.connection = connection
|
||||
self.name = name
|
||||
@@ -163,6 +169,7 @@ class LaunchConfiguration(object):
|
||||
self.instance_profile_name = instance_profile_name
|
||||
self.launch_configuration_arn = None
|
||||
self.ebs_optimized = ebs_optimized
|
||||
self.associate_public_ip_address = associate_public_ip_address
|
||||
|
||||
def __repr__(self):
|
||||
return 'LaunchConfiguration:%s' % self.name
|
||||
|
||||
@@ -55,11 +55,11 @@ class Tag(object):
|
||||
self.key = value
|
||||
elif name == 'Value':
|
||||
self.value = value
|
||||
elif name == 'PropogateAtLaunch':
|
||||
elif name == 'PropagateAtLaunch':
|
||||
if value.lower() == 'true':
|
||||
self.propogate_at_launch = True
|
||||
self.propagate_at_launch = True
|
||||
else:
|
||||
self.propogate_at_launch = False
|
||||
self.propagate_at_launch = False
|
||||
elif name == 'ResourceId':
|
||||
self.resource_id = value
|
||||
elif name == 'ResourceType':
|
||||
|
||||
@@ -95,7 +95,7 @@ class MetricAlarm(object):
|
||||
statistic is applied.
|
||||
|
||||
:type evaluation_periods: int
|
||||
:param evaluation_period: The number of periods over which data is
|
||||
:param evaluation_periods: The number of periods over which data is
|
||||
compared to the specified threshold.
|
||||
|
||||
:type unit: str
|
||||
@@ -112,9 +112,16 @@ class MetricAlarm(object):
|
||||
:type description: str
|
||||
:param description: Description of MetricAlarm
|
||||
|
||||
:type dimensions: list of dicts
|
||||
:param description: Dimensions of alarm, such as:
|
||||
[{'InstanceId':['i-0123456,i-0123457']}]
|
||||
: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.
|
||||
Example: {
|
||||
'InstanceId': ['i-0123456', 'i-0123457'],
|
||||
'LoadBalancerName': 'test-lb'
|
||||
}
|
||||
|
||||
:type alarm_actions: list of strs
|
||||
:param alarm_actions: A list of the ARNs of the actions to take in
|
||||
|
||||
@@ -69,7 +69,7 @@ from boto.exception import EC2ResponseError
|
||||
|
||||
class EC2Connection(AWSQueryConnection):
|
||||
|
||||
APIVersion = boto.config.get('Boto', 'ec2_version', '2013-07-15')
|
||||
APIVersion = boto.config.get('Boto', 'ec2_version', '2013-10-01')
|
||||
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')
|
||||
@@ -260,7 +260,7 @@ 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):
|
||||
dry_run=False, virtualization_type=None):
|
||||
"""
|
||||
Register an image.
|
||||
|
||||
@@ -293,6 +293,12 @@ class EC2Connection(AWSQueryConnection):
|
||||
:type dry_run: bool
|
||||
:param dry_run: Set to True if the operation should not actually run.
|
||||
|
||||
:type virtualization_type: string
|
||||
:param virtualization_type: The virutalization_type of the image.
|
||||
Valid choices are:
|
||||
* paravirtual
|
||||
* hvm
|
||||
|
||||
:rtype: string
|
||||
:return: The new image id
|
||||
"""
|
||||
@@ -315,6 +321,9 @@ class EC2Connection(AWSQueryConnection):
|
||||
block_device_map.ec2_build_list_params(params)
|
||||
if dry_run:
|
||||
params['DryRun'] = 'true'
|
||||
if virtualization_type:
|
||||
params['VirtualizationType'] = virtualization_type
|
||||
|
||||
rs = self.get_object('RegisterImage', params, ResultSet, verb='POST')
|
||||
image_id = getattr(rs, 'imageId', None)
|
||||
return image_id
|
||||
@@ -355,7 +364,8 @@ class EC2Connection(AWSQueryConnection):
|
||||
return result
|
||||
|
||||
def create_image(self, instance_id, name,
|
||||
description=None, no_reboot=False, dry_run=False):
|
||||
description=None, no_reboot=False,
|
||||
block_device_mapping=None, dry_run=False):
|
||||
"""
|
||||
Will create an AMI from the instance in the running or stopped
|
||||
state.
|
||||
@@ -377,6 +387,10 @@ class EC2Connection(AWSQueryConnection):
|
||||
responsibility of maintaining file system integrity is
|
||||
left to the owner of the instance.
|
||||
|
||||
:type block_device_mapping: :class:`boto.ec2.blockdevicemapping.BlockDeviceMapping`
|
||||
:param block_device_mapping: A BlockDeviceMapping data structure
|
||||
describing the EBS volumes associated with the Image.
|
||||
|
||||
:type dry_run: bool
|
||||
:param dry_run: Set to True if the operation should not actually run.
|
||||
|
||||
@@ -389,6 +403,8 @@ class EC2Connection(AWSQueryConnection):
|
||||
params['Description'] = description
|
||||
if no_reboot:
|
||||
params['NoReboot'] = 'true'
|
||||
if block_device_mapping:
|
||||
block_device_mapping.ec2_build_list_params(params)
|
||||
if dry_run:
|
||||
params['DryRun'] = 'true'
|
||||
img = self.get_object('CreateImage', params, Image, verb='POST')
|
||||
@@ -1500,7 +1516,7 @@ class EC2Connection(AWSQueryConnection):
|
||||
if dry_run:
|
||||
params['DryRun'] = 'true'
|
||||
return self.get_list('CancelSpotInstanceRequests', params,
|
||||
[('item', Instance)], verb='POST')
|
||||
[('item', SpotInstanceRequest)], verb='POST')
|
||||
|
||||
def get_spot_datafeed_subscription(self, dry_run=False):
|
||||
"""
|
||||
@@ -2189,17 +2205,17 @@ class EC2Connection(AWSQueryConnection):
|
||||
present, only the Snapshots associated with
|
||||
these snapshot ids will be returned.
|
||||
|
||||
:type owner: str
|
||||
:param owner: If present, only the snapshots owned by the specified user
|
||||
:type owner: str or list
|
||||
:param owner: If present, only the snapshots owned by the specified user(s)
|
||||
will be returned. Valid values are:
|
||||
|
||||
* self
|
||||
* amazon
|
||||
* AWS Account ID
|
||||
|
||||
:type restorable_by: str
|
||||
:type restorable_by: str or list
|
||||
:param restorable_by: If present, only the snapshots that are restorable
|
||||
by the specified account id will be returned.
|
||||
by the specified account id(s) will be returned.
|
||||
|
||||
:type filters: dict
|
||||
:param filters: Optional filters that can be used to limit
|
||||
@@ -2220,10 +2236,11 @@ class EC2Connection(AWSQueryConnection):
|
||||
params = {}
|
||||
if snapshot_ids:
|
||||
self.build_list_params(params, snapshot_ids, 'SnapshotId')
|
||||
|
||||
if owner:
|
||||
params['Owner'] = owner
|
||||
self.build_list_params(params, owner, 'Owner')
|
||||
if restorable_by:
|
||||
params['RestorableBy'] = restorable_by
|
||||
self.build_list_params(params, restorable_by, 'RestorableBy')
|
||||
if filters:
|
||||
self.build_filter_params(params, filters)
|
||||
if dry_run:
|
||||
|
||||
@@ -188,13 +188,13 @@ class ELBConnection(AWSQueryConnection):
|
||||
(LoadBalancerPortNumber, InstancePortNumber, Protocol, InstanceProtocol,
|
||||
SSLCertificateId).
|
||||
|
||||
Where;
|
||||
- LoadBalancerPortNumber and InstancePortNumber are integer
|
||||
values between 1 and 65535.
|
||||
- Protocol and InstanceProtocol is a string containing either 'TCP',
|
||||
'SSL', 'HTTP', or 'HTTPS'
|
||||
- SSLCertificateId is the ARN of an SSL certificate loaded into
|
||||
AWS IAM
|
||||
Where:
|
||||
- LoadBalancerPortNumber and InstancePortNumber are integer
|
||||
values between 1 and 65535
|
||||
- Protocol and InstanceProtocol is a string containing either 'TCP',
|
||||
'SSL', 'HTTP', or 'HTTPS'
|
||||
- SSLCertificateId is the ARN of an SSL certificate loaded into
|
||||
AWS IAM
|
||||
|
||||
:rtype: :class:`boto.ec2.elb.loadbalancer.LoadBalancer`
|
||||
:return: The newly created
|
||||
@@ -272,13 +272,13 @@ class ELBConnection(AWSQueryConnection):
|
||||
(LoadBalancerPortNumber, InstancePortNumber, Protocol, InstanceProtocol,
|
||||
SSLCertificateId).
|
||||
|
||||
Where;
|
||||
- LoadBalancerPortNumber and InstancePortNumber are integer
|
||||
values between 1 and 65535.
|
||||
- Protocol and InstanceProtocol is a string containing either 'TCP',
|
||||
'SSL', 'HTTP', or 'HTTPS'
|
||||
- SSLCertificateId is the ARN of an SSL certificate loaded into
|
||||
AWS IAM
|
||||
Where:
|
||||
- LoadBalancerPortNumber and InstancePortNumber are integer
|
||||
values between 1 and 65535
|
||||
- Protocol and InstanceProtocol is a string containing either 'TCP',
|
||||
'SSL', 'HTTP', or 'HTTPS'
|
||||
- SSLCertificateId is the ARN of an SSL certificate loaded into
|
||||
AWS IAM
|
||||
|
||||
:return: The status of the request
|
||||
"""
|
||||
|
||||
@@ -342,7 +342,7 @@ class LoadBalancer(object):
|
||||
"""
|
||||
if isinstance(subnets, str) or isinstance(subnets, unicode):
|
||||
subnets = [subnets]
|
||||
new_subnets = self.connection.detach_lb_to_subnets(self.name, subnets)
|
||||
new_subnets = self.connection.detach_lb_from_subnets(self.name, subnets)
|
||||
self.subnets = new_subnets
|
||||
|
||||
def apply_security_groups(self, security_groups):
|
||||
|
||||
@@ -340,14 +340,6 @@ class Instance(TaggedEC2Object):
|
||||
self.ami_launch_index = value
|
||||
elif name == 'previousState':
|
||||
self.previous_state = value
|
||||
elif name == 'name':
|
||||
self.state = value
|
||||
elif name == 'code':
|
||||
try:
|
||||
self.state_code = int(value)
|
||||
except ValueError:
|
||||
boto.log.warning('Error converting code (%s) to int' % value)
|
||||
self.state_code = value
|
||||
elif name == 'instanceType':
|
||||
self.instance_type = value
|
||||
elif name == 'rootDeviceName':
|
||||
|
||||
@@ -234,11 +234,12 @@ class PriceSchedule(object):
|
||||
|
||||
class ReservedInstancesConfiguration(object):
|
||||
def __init__(self, connection=None, availability_zone=None, platform=None,
|
||||
instance_count=None):
|
||||
instance_count=None, instance_type=None):
|
||||
self.connection = connection
|
||||
self.availability_zone = availability_zone
|
||||
self.platform = platform
|
||||
self.instance_count = instance_count
|
||||
self.instance_type = instance_type
|
||||
|
||||
def startElement(self, name, attrs, connection):
|
||||
return None
|
||||
@@ -250,6 +251,8 @@ class ReservedInstancesConfiguration(object):
|
||||
self.platform = value
|
||||
elif name == 'instanceCount':
|
||||
self.instance_count = int(value)
|
||||
elif name == 'instanceType':
|
||||
self.instance_type = value
|
||||
else:
|
||||
setattr(self, name, value)
|
||||
|
||||
@@ -271,12 +274,14 @@ class ModifyReservedInstancesResult(object):
|
||||
|
||||
class ModificationResult(object):
|
||||
def __init__(self, connection=None, modification_id=None,
|
||||
availability_zone=None, platform=None, instance_count=None):
|
||||
availability_zone=None, platform=None, instance_count=None,
|
||||
instance_type=None):
|
||||
self.connection = connection
|
||||
self.modification_id = modification_id
|
||||
self.availability_zone = availability_zone
|
||||
self.platform = platform
|
||||
self.instance_count = instance_count
|
||||
self.instance_type = instance_type
|
||||
|
||||
def startElement(self, name, attrs, connection):
|
||||
return None
|
||||
@@ -290,6 +295,8 @@ class ModificationResult(object):
|
||||
self.platform = value
|
||||
elif name == 'instanceCount':
|
||||
self.instance_count = int(value)
|
||||
elif name == 'instanceType':
|
||||
self.instance_type = value
|
||||
else:
|
||||
setattr(self, name, value)
|
||||
|
||||
|
||||
@@ -123,6 +123,9 @@ class SecurityGroup(TaggedEC2Object):
|
||||
only changes the local version of the object. No information
|
||||
is sent to EC2.
|
||||
"""
|
||||
if not self.rules:
|
||||
raise ValueError("The security group has no rules")
|
||||
|
||||
target_rule = None
|
||||
for rule in self.rules:
|
||||
if rule.ip_protocol == ip_protocol:
|
||||
@@ -136,9 +139,9 @@ class SecurityGroup(TaggedEC2Object):
|
||||
if grant.cidr_ip == cidr_ip:
|
||||
target_grant = grant
|
||||
if target_grant:
|
||||
rule.grants.remove(target_grant, dry_run=dry_run)
|
||||
if len(rule.grants) == 0:
|
||||
self.rules.remove(target_rule, dry_run=dry_run)
|
||||
rule.grants.remove(target_grant)
|
||||
if len(rule.grants) == 0:
|
||||
self.rules.remove(target_rule)
|
||||
|
||||
def authorize(self, ip_protocol=None, from_port=None, to_port=None,
|
||||
cidr_ip=None, src_group=None, dry_run=False):
|
||||
|
||||
Reference in New Issue
Block a user