o ckF[,5@sddlmZddlmZddlmZddlmZddlm Z ddl m Z Gddde Z Gd d d e ZGd d d e ZGd ddeZGddde ZGddde ZdS)) ListElement) ResultSet)LaunchConfiguration)Request)Instance)Tagc@.eZdZd ddZddZddZdd ZdS) ProcessTypeNcCs||_d|_dSN) connection process_nameselfr r:/usr/lib/python3/dist-packages/boto/ec2/autoscale/group.py__init__s zProcessType.__init__cC d|jS)NzProcessType(%s)r rrrr__repr__# zProcessType.__repr__cCdSr rrnameattrsr rrr startElement&zProcessType.startElementcCs|dkr ||_dSdS)N ProcessNamerrrvaluer rrr endElement)s zProcessType.endElementr __name__ __module__ __qualname__rrrr rrrrr s   r c@r) SuspendedProcessNcC||_d|_d|_dSr )r r reasonr rrrr/ zSuspendedProcess.__init__cCd|j|jfS)NzSuspendedProcess(%s, %s)r r'rrrrr4zSuspendedProcess.__repr__cCrr rrrrrr7rzSuspendedProcess.startElementcC(|dkr ||_dS|dkr||_dSdS)NrSuspensionReasonr*rrrrr :   zSuspendedProcess.endElementr r!rrrrr%.   r%c@r) EnabledMetricNcCs||_||_||_dSr r metric granularity)rr r2r3rrrrBr(zEnabledMetric.__init__cCr))NzEnabledMetric(%s, %s))r2r3rrrrrGr+zEnabledMetric.__repr__cCrr rrrrrrJrzEnabledMetric.startElementcCr,)N GranularityMetric)r3r2rrrrr Mr.zEnabledMetric.endElement)NNNr!rrrrr0Ar/r0c@seZdZddZddZdS)TerminationPoliciescCrr rrrrrrVrz TerminationPolicies.startElementcCs|dkr ||dSdS)Nmember)appendrrrrr YszTerminationPolicies.endElementN)r"r#r$rr rrrrr6Ts r6c@seZdZ       d"ddZddZddZeeeZdd Zd d Z d d Z ddZ ddZ ddZ d#ddZd$ddZddZddZd%ddZd%d d!ZdS)&AutoScalingGroupNcKs|p|d|_||_| durt| nd|_| durt| nd|_d|_|p*|d}|dur3t|}||_||_|rDt |t rD|j|_| |_ |pJg}t ||_ |pSg}t ||_||_||_| |_d|_t| turpd| } | |_d|_|pyd|_|p~g}t ||_||_dS)a. Creates a new AutoScalingGroup with the specified name. You must not have already used up your entire quota of AutoScalingGroups in order for this call to be successful. Once the creation request is completed, the AutoScalingGroup is ready to be used in other calls. :type name: str :param name: Name of autoscaling group (required). :type availability_zones: list :param availability_zones: List of availability zones (required). :type default_cooldown: int :param default_cooldown: Number of seconds after a Scaling Activity completes before any further scaling activities can start. :type desired_capacity: int :param desired_capacity: The desired capacity for the group. :type health_check_period: str :param health_check_period: Length of time in seconds after a new EC2 instance comes into service that Auto Scaling starts checking its health. :type health_check_type: str :param health_check_type: The service you want the health status from, Amazon EC2 or Elastic Load Balancer. :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. :type max_size: int :param max_size: Maximum size of group (required). :type min_size: int :param min_size: Minimum size of group (required). :type placement_group: str :param placement_group: Physical location of your cluster placement group created in Amazon EC2. :type vpc_zone_identifier: str or list :param vpc_zone_identifier: A comma-separated string or python list of the subnet identifiers 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 are: "OldestInstance", "NewestInstance", "OldestLaunchConfiguration", "ClosestToNextInstanceHour", "Default". If no value is specified, the "Default" value is used. :type instance_id: str :param instance_id: The ID of the Amazon EC2 instance you want to use to create the Auto Scaling group. :rtype: :class:`boto.ec2.autoscale.group.AutoScalingGroup` :return: An autoscale group. group_nameNcooldown,)getrr intmin_sizemax_size created_timedefault_cooldownlaunch_config_name isinstancerdesired_capacityrload_balancersavailability_zoneshealth_check_periodhealth_check_typeplacement_groupautoscaling_group_arntypelistjoinvpc_zone_identifier instancestagstermination_policies instance_id)rr r launch_configrGrFrBrIrHrJrOrEr?r@rQrRrSkwargslbszonesrrrr_s:J       zAutoScalingGroup.__init__cCs|jSr rBrrrr _get_cooldownszAutoScalingGroup._get_cooldowncCs ||_dSr rX)rvalrrr _set_cooldownrzAutoScalingGroup._set_cooldowncCr)NzAutoScaleGroup<%s>)rrrrrrrzAutoScalingGroup.__repr__cCs|dkrtdtfg|_|jS|dkr|jS|dkr|jS|dkr,tdtfg|_|jS|dkr;tdtfg|_|jS|dkrJtdt fg|_ |j S|dkrQ|j SdS) N Instancesr7LoadBalancerNamesAvailabilityZonesEnabledMetricsSuspendedProcessesTagsr6) rrrPrFrGr0enabled_metricsr%suspended_processesrrQrRrrrrrs&zAutoScalingGroup.startElementcCs,|dkr t||_dS|dkr||_dS|dkr||_dS|dkr(t||_dS|dkr1||_dS|dkrr?rKrArBrCrEr@rrJrH ValueErrorrIrOrSsetattrrrrrr s>          zAutoScalingGroup.endElementcCs(|j|d}|jd|t}||j_|S)z9 Set the desired capacity for the group. )rkriSetDesiredCapacity)rr get_objectr last_request)rcapacityparamsreqrrr set_capacity s zAutoScalingGroup.set_capacitycCs|jd|S)z< Sync local changes with AutoScaling group. UpdateAutoScalingGroup)r _update_grouprrrrupdatezAutoScalingGroup.updatecCsd|_d|_d|_|dS)zg Convenience method which shuts down all instances associated with this group. rN)r?r@rEr|rrrrshutdown_instancess z#AutoScalingGroup.shutdown_instancesFcC|j|j|S)zw Delete this auto-scaling group if no instances attached or no scaling activities in progress. )r delete_auto_scaling_groupr)r force_deleterrrdelete&s zAutoScalingGroup.delete2cC|j|||S)z2 Get all activies for this group. )r get_all_activities)r activity_ids max_recordsrrrget_activities.s zAutoScalingGroup.get_activitiescCr)av Configures an Auto Scaling group to send notifications when 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' )r put_notification_configuration)rtopicnotification_typesrrrr5s z/AutoScalingGroup.put_notification_configurationcCs|j||S)zR Deletes notifications created by put_notification_configuration. )r !delete_notification_configuration)rrrrrrCr}z2AutoScalingGroup.delete_notification_configurationcCr)zL Suspends Auto Scaling processes for an Auto Scaling group. )r suspend_processesrrscaling_processesrrrrIz"AutoScalingGroup.suspend_processescCr)zK Resumes Auto Scaling processes for an Auto Scaling group. )r resume_processesrrrrrrOrz!AutoScalingGroup.resume_processes)NNNNNNNNNNNNNNNN)F)Nrr )r"r#r$rrYr[propertyr;rrr ryr|r~rrrrrrrrrrr9^s0 j !   r9c@r) AutoScalingGroupMetricNcCr&r r1r rrrrWs zAutoScalingGroupMetric.__init__cCr)NzAutoScalingGroupMetric:%s)r2rrrrr]rzAutoScalingGroupMetric.__repr__cCrr rrrrrr`rz#AutoScalingGroupMetric.startElementcCs4|dkr ||_dS|dkr||_dSt|||dS)Nr5r4)r2r3rrrrrrr cs   z!AutoScalingGroupMetric.endElementr r!rrrrrVs   rN)boto.ec2.elb.listelementrboto.resultsetrboto.ec2.autoscale.launchconfigrboto.ec2.autoscale.requestrboto.ec2.autoscale.instancerboto.ec2.autoscale.tagrobjectr r%r0rMr6r9rrrrrs       y