FRTc@skdZddlZddlZddlmZddlmZmZmZddl m Z ddl m Z ddl mZddl mZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlm Z ej!diZ"dZ#dZ$defdYZ%dS(s\ This module provides an interface to the Elastic Compute Cloud (EC2) Auto Scaling service. iN(tAWSQueryConnection(t RegionInfot get_regionst load_regions(tRequest(tLaunchConfiguration(tAutoScalingGroup(t ProcessType(tActivity(tAdjustmentType(tMetricCollectionTypes(t ScalingPolicy(tTerminationPolicies(tInstance(tScheduledUpdateGroupAction(tTag(t AccountLimits(tsixt autoscalingcCstddtS(s Get all available regions for the Auto Scaling service. :rtype: list :return: A list of :class:`boto.RegionInfo` instances Rtconnection_cls(RtAutoScaleConnection(((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytregions5scKs4x-tD]"}|j|kr |j|Sq WdS(sF Given a valid region name, return a :class:`boto.ec2.autoscale.AutoScaleConnection`. :param str region_name: The name of the region to connect to. :rtype: :class:`boto.ec2.AutoScaleConnection` or ``None`` :return: A connection to the given region, or None if an invalid region name is given N(RtnametconnecttNone(t region_namet kw_paramstregion((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytconnect_to_region?s RcBsHeZejjdddZejjdddZejjdddZd.d.e d.d.d.d.d.dd.d.dd.e d.e d Z d Z d Z d Zd ZdZe dZdZdZdZdZd.d.d.dZdZd.d.d.dZdZd.dZe dZd.dZdZd.d.d.dZdZd.d.d.d.dZ dZ!d.d Z"d.d!Z#d.d.d.d.d.d.d.d"Z$d.d.d.d.d.d.d#Z%d.d$Z&d.d%Z'd.d.d&Z(d'Z)d(Z*e d)Z+e d*Z,d.d.d.d+Z-d,Z.d-Z/RS(/tBototautoscale_versions 2011-01-01tautoscale_endpoints#autoscaling.us-east-1.amazonaws.comtautoscale_region_names us-east-1it/cCs| s$t||j|jt} n| |_||_tt|j|||||||||jj| | d| d| d|d| dS(s Init method to create a new connection to the AutoScaling service. B{Note:} The host argument is overridden by the host specified in the boto configuration file. tpathtsecurity_tokentvalidate_certst profile_nameN( RtDefaultRegionNametDefaultRegionEndpointRRtuse_block_device_typestsupert__init__tendpoint(tselftaws_access_key_idtaws_secret_access_keyt is_securetporttproxyt proxy_portt proxy_usert proxy_passtdebugthttps_connection_factoryRR"R#R$R%R(((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pyR*Ws       cCsdgS(Nshmac-v4((R,((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pyt_required_auth_capabilityusc Csxtdt|dD]}t||dtrxtj||dD]o\}}t|trxQtj|D]&\}}||d||||ftzonesRAttag((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pyt _update_groups>                cCs0i|d6}|j||d|jd|S(s; Attach instances to an autoscaling group. RGt InstanceIdstAttachInstances(RFt get_status(R,Rt instance_idsR>((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytattach_instancess cCs|jd|S(s, Create auto scaling group. tCreateAutoScalingGroup(Rk(R,Rh((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytcreate_auto_scaling_groupscCs=|ri|d6dd6}n i|d6}|jd|tS(s Deletes the specified auto scaling group if the group has no instances and no scaling activities in progress. RGttruet ForceDeletetDeleteAutoScalingGroup(RfR(R,Rt force_deleteR>((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytdelete_auto_scaling_groups cCs<i|jd6|jd6|jd6}|jr=|j|dRtx((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytcreate_launch_configurationsT         &                cCsi}|jd|tS(ss Returns the limits for the Auto Scaling resources currently granted for your AWS account. tDescribeAccountLimits(RfR(R,R>((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytget_account_limits scCsi|jd6|jd6|jd6|jd6}|jdkr\|jd k r\|j|d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytcreate_scaling_policys    cCs i|d6}|jd|tS(s Deletes the specified LaunchConfiguration. The specified launch configuration must not be attached to an Auto Scaling group. Once this call completes, the launch configuration is no longer available for use. RHtDeleteLaunchConfiguration(RfR(R,RUR>((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytdelete_launch_configuration&s cCsdi}|r||d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytget_all_groups1s   cKsi}|jdd }|jdd }|d k rC||dRRR((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytget_all_launch_configurationsPs    cCs|}t|tr!|j}ni|d6}|rA||d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytget_all_activitiests     cCs|jditS(sGets all valid termination policies. These values can then be used as the termination_policies arg when creating and updating autoscale groups. tDescribeTerminationPolicyTypes(RfR (R,((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytget_termination_policiess cCs0i|d6}|r ||d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytdelete_scheduled_actions  cCs=i|d6}|r d|d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytterminate_instances    cCs0i|d6}|r ||d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pyt delete_policys  cCs|jdidtfgS(NtDescribeAdjustmentTypesR(RR (R,((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytget_all_adjustment_typess cCsdi}|r"|j||dn|r5||d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytget_all_autoscaling_instancess   cCs|jditS(sn Returns a list of metrics and a corresponding list of granularities for each metric. tDescribeMetricCollectionTypes(RfR (R,((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytget_all_metric_collection_typess cCswi}|r||d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytget_all_policiess    cCs|jdidtfgS(st Returns scaling process types for use in the ResumeProcesses and SuspendProcesses actions. tDescribeScalingProcessTypesR(RR(R,((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytget_all_scaling_process_types#s cCs9i|d6}|r)|j||dn|jd|S(sV Suspends Auto Scaling processes for an Auto Scaling group. :type as_group: string :param as_group: The auto scaling group to suspend processes on. :type scaling_processes: list :param scaling_processes: Processes you want to suspend. If omitted, all processes will be suspended. RGtScalingProcessestSuspendProcesses(RFRn(R,Rhtscaling_processesR>((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytsuspend_processes+s   cCs9i|d6}|r)|j||dn|jd|S(sQ Resumes Auto Scaling processes for an Auto Scaling group. :type as_group: string :param as_group: The auto scaling group to resume processes on. :type scaling_processes: list :param scaling_processes: Processes you want to resume. If omitted, all processes will be resumed. RGRtResumeProcesses(RFRn(R,RhRR>((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytresume_processes<s   c Csi|d6|d6} |d k r3|j| d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytcreate_scheduled_group_actionNs"&            cCswi}|r||d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytget_all_scheduled_actionss      cCs9i|d6}|r)|j||dn|jd|S(s Disables monitoring of group metrics for the Auto Scaling group specified in AutoScalingGroupName. You can specify the list of affected metrics with the Metrics parameter. RGtMetricstDisableMetricsCollection(RFRn(R,RhtmetricsR>((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytdisable_metrics_collections cCs@i|d6|d6}|r0|j||dn|jd|S(s[ Enables monitoring of group metrics for the Auto Scaling group specified in AutoScalingGroupName. You can specify the list of enabled metrics with the Metrics parameter. Auto scaling metrics collection can be turned on only if the InstanceMonitoring.Enabled flag, in the Auto Scaling group's launch configuration, is set to true. :type autoscale_group: string :param autoscale_group: The auto scaling group to get activities on. :type granularity: string :param granularity: The granularity to associate with the metrics to collect. Currently, the only legal granularity is "1Minute". :type metrics: string list :param metrics: The list of metrics to collect. If no metrics are specified, all metrics are enabled. RGt GranularityRtEnableMetricsCollection(RFRn(R,Rht granularityRR>((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytenable_metrics_collections   cCsCi|d6}|r ||d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytexecute_policys    cCsX|}t|tr!|j}ni|d6|d6}|j||d|jd|S(ss Configures an Auto Scaling group to send notifications when specified events take place. :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. :type notification_types: list :param notification_types: The type of events that will trigger 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' RGtTopicARNtNotificationTypestPutNotificationConfiguration(R:RRRFRn(R,Rttopictnotification_typesRR>((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytput_notification_configurations   cCsE|}t|tr!|j}ni|d6|d6}|jd|S(s 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. RGRtDeleteNotificationConfiguration(R:RRRn(R,RRRR>((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pyt!delete_notification_configurations    cCsAi|d6|d6}|r'd|d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytset_instance_healths     cCs7i|d6|d6}|r'd|d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytset_desired_capacitys    cCsHi}|r||d((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pyt get_all_tags0s   cCsMi}x.t|D] \}}|j||dqW|jd|ddS(s Creates new tags or updates existing tags for an Auto Scaling group. :type tags: List of :class:`boto.ec2.autoscale.tag.Tag` :param tags: The new or updated tags. itCreateOrUpdateTagsRR(RdReRn(R,RcR>RARj((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pytcreate_or_update_tagsLscCsMi}x.t|D] \}}|j||dqW|jd|ddS(s Deletes existing tags for an Auto Scaling group. :type tags: List of :class:`boto.ec2.autoscale.tag.Tag` :param tags: The new or updated tags. it DeleteTagsRR(RdReRn(R,RcR>RARj((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pyt delete_tagsXsN(0t__name__t __module__tbototconfigRt APIVersionR'R&RRRR*R7RFRkRpRrRwRRRRRRRRRRRRRRRRRRRRRRRR R RRRRR(((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pyRPsp          $  5    $     $    4  !    (&t__doc__RRtboto.connectionRtboto.regioninfoRRRtboto.ec2.autoscale.requestRtboto.ec2.autoscale.launchconfigRtboto.ec2.autoscale.groupRRtboto.ec2.autoscale.activityRtboto.ec2.autoscale.policyR R R R tboto.ec2.autoscale.instanceR tboto.ec2.autoscale.scheduledRtboto.ec2.autoscale.tagRtboto.ec2.autoscale.limitsRt boto.compatRRt RegionDataRRR(((sH/opt/freeware/lib/python2.7/site-packages/boto/ec2/autoscale/__init__.pyts,