o
    rMf7*  ã                   @   sx   d dl mZ d dlmZ d dlmZ d dlZd dl	Z	G dd„ de
ƒZG dd„ de
ƒZG d	d
„ d
e
ƒZG dd„ de
ƒZdS )é    )ÚListElement)ÚBlockDeviceMapping)Ú	ResultSetNc                   @   s.   e Zd Zd
dd„Zdd„ Zdd„ Zdd	„ ZdS )ÚEbsNc                 C   s   || _ || _|| _d S ©N)Ú
connectionÚsnapshot_idÚvolume_size)Úselfr   r   r	   © r   úa/var/www/html/analyze/labelStudio/lib/python3.10/site-packages/boto/ec2/autoscale/launchconfig.pyÚ__init__"   s   
zEbs.__init__c                 C   ó   d| j | jf S )NzEbs(%s, %s)©r   r	   ©r
   r   r   r   Ú__repr__'   s   zEbs.__repr__c                 C   ó   d S r   r   ©r
   ÚnameÚattrsr   r   r   r   ÚstartElement*   ó   zEbs.startElementc                 C   s(   |dkr	|| _ d S |dkr|| _d S d S )NÚ
SnapshotIdÚ
VolumeSizer   ©r
   r   Úvaluer   r   r   r   Ú
endElement-   s
   

ÿzEbs.endElement)NNN©Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r   !   s
    
r   c                   @   s.   e Zd Zddd„Zdd„ Zdd„ Zd	d
„ ZdS )ÚInstanceMonitoringNÚfalsec                 C   s   || _ || _d S r   )r   Úenabled)r
   r   r#   r   r   r   r   5   s   
zInstanceMonitoring.__init__c                 C   ó
   d| j  S )NzInstanceMonitoring(%s)©r#   r   r   r   r   r   9   ó   
zInstanceMonitoring.__repr__c                 C   r   r   r   r   r   r   r   r   <   r   zInstanceMonitoring.startElementc                 C   s   |dkr	|| _ d S d S )NÚEnabledr%   r   r   r   r   r   ?   s   
ÿzInstanceMonitoring.endElement)Nr"   r   r   r   r   r   r!   4   s
    
r!   c                   @   s2   e Zd Z		d
dd„Zdd„ Zdd„ Zdd	„ ZdS )r   Nc                 C   s"   || _ || _|| _|| _|| _d S r   )r   Údevice_nameÚvirtual_nameÚebsÚ	no_device)r
   r   r(   r)   r*   r+   r   r   r   r   H   s
   
zBlockDeviceMapping.__init__c                 C   r   )NzBlockDeviceMapping(%s, %s))r(   r)   r   r   r   r   r   P   s   ÿzBlockDeviceMapping.__repr__c                 C   s   |dkrt | ƒ| _| jS d S )Nr   )r   r*   r   r   r   r   r   T   s   
þzBlockDeviceMapping.startElementc                 C   s>   |dkr	|| _ d S |dkr|| _d S |dkrt|ƒ| _d S d S )NÚ
DeviceNameÚVirtualNameÚNoDevice)r(   r)   Úboolr+   r   r   r   r   r   Y   s   

ÿzBlockDeviceMapping.endElement)NNNNNr   r   r   r   r   r   G   s    
ÿr   c                   @   sJ   e Zd Z										ddd„Zdd„ Zd	d
„ Zdd„ Zdd„ ZdS )ÚLaunchConfigurationNúm1.smallFTc                 C   sÀ   || _ || _|| _|
| _|| _|pg }t|ƒ| _|| _|	| _d| _	|| _
|| _d| _	|| _|| _|| _d| _|| _|| _|| _|| _|| _|| _|| _|pNg }t|ƒ| _|dur^|j| _dS dS )al	  
        A launch configuration.

        :type name: str
        :param name: Name of the launch configuration to create.

        :type image_id: str
        :param image_id: Unique ID of the Amazon Machine Image (AMI) which was
            assigned during registration.

        :type key_name: str
        :param key_name: The name of the EC2 key pair.

        :type security_groups: list
        :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.

        :type instance_type: str
        :param instance_type: The instance type

        :type kernel_id: str
        :param kernel_id: Kernel id for instance

        :type ramdisk_id: str
        :param ramdisk_id: RAM disk id for instance

        :type block_device_mappings: list
        :param block_device_mappings: Specifies how block devices are exposed
            for instances

        :type instance_monitoring: bool
        :param instance_monitoring: Whether instances in group are launched
            with detailed monitoring.

        :type spot_price: float
        :param spot_price: The spot price you are bidding.  Only applies
            if you are building an autoscaling group with spot instances.

        :type instance_profile_name: string
        :param instance_profile_name: The name or the Amazon Resource
            Name (ARN) of the instance profile associated with the IAM
            role for the instance.

        :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.

        :type classic_link_vpc_id: str
        :param classic_link_vpc_id: ID of ClassicLink enabled VPC.

        :type classic_link_vpc_security_groups: list
        :param classic_link_vpc_security_groups: Security group
            id's of the security groups with which to associate the
            ClassicLink VPC instances.
        N)r   r   Úinstance_typeÚblock_device_mappingsÚkey_namer   Úsecurity_groupsÚimage_idÚ
ramdisk_idÚcreated_timeÚ	kernel_idÚ	user_dataÚinstance_monitoringÚ
spot_priceÚinstance_profile_nameÚlaunch_configuration_arnÚebs_optimizedÚassociate_public_ip_addressÚvolume_typeÚdelete_on_terminationÚiopsÚuse_block_device_typesÚclassic_link_vpc_idÚ classic_link_vpc_security_groups)r
   r   r   r6   r4   r5   r:   r2   r9   r7   r3   r;   r<   r=   r?   r@   rA   rB   rC   rD   rE   rF   Ú
sec_groupsÚclassic_link_vpc_sec_groupsr   r   r   r   c   s<   J
ÿÿzLaunchConfiguration.__init__c                 C   r$   )NzLaunchConfiguration:%s)r   r   r   r   r   r   Ì   r&   zLaunchConfiguration.__repr__c                 C   sj   |dkr| j S |dkr| jS |dkr'| jrtƒ | _| jS tdtfgƒ| _| jS |dkr3t| ƒ| _| jS d S )NÚSecurityGroupsÚClassicLinkVPCSecurityGroupsÚBlockDeviceMappingsÚmemberr!   )	r5   rF   rD   ÚBDMr3   r   r   r!   r;   r   r   r   r   r   Ï   s   ÿ
þz LaunchConfiguration.startElementc                 C   sÊ  |dkr	|| _ d S |dkr|| _d S |dkr|| _d S |dkr$|| _d S |dkr1tj |¡| _d S |dkr:|| _d S |dkrC|| _	d S |dkr^z	t
 |¡| _W d S  ty]   || _Y d S w |d	krg|| _d S |d
krp|| _d S |dkr{t|ƒ| _d S |dkr„|| _d S |dkr˜| ¡ dkr“d| _d S d| _d S |dkr¬| ¡ dkr§d| _d S d| _d S |dkrµ|| _d S |dkrÉ| ¡ dkrÄd| _d S d| _d S |dkrÔt|ƒ| _d S |dkrÝ|| _d S t| ||ƒ d S )NÚInstanceTypeÚLaunchConfigurationNameÚKeyNameÚImageIdÚCreatedTimeÚKernelIdÚ	RamdiskIdÚUserDataÚLaunchConfigurationARNr!   Ú	SpotPriceÚIamInstanceProfileÚEbsOptimizedÚtrueTFÚAssociatePublicIpAddressÚ
VolumeTypeÚDeleteOnTerminationÚIopsÚClassicLinkVPCId)r2   r   r4   r6   ÚbotoÚutilsÚparse_tsr8   r9   r7   Úbase64Ú	b64decoder:   Ú	TypeErrorr>   r;   Úfloatr<   r=   Úlowerr?   r@   rA   rB   ÚintrC   rE   Úsetattrr   r   r   r   r   Þ   sV   





ÿ


  



zLaunchConfiguration.endElementc                 C   s   | j  | j¡S )z# Delete this launch configuration. )r   Údelete_launch_configurationr   r   r   r   r   Údelete  s   zLaunchConfiguration.delete)NNNNNNr1   NNNFNNFNNTNFNN)r   r   r    r   r   r   r   rk   r   r   r   r   r0   b   s     
÷i.r0   )Úboto.ec2.elb.listelementr   Úboto.ec2.blockdevicemappingr   rM   Úboto.resultsetr   Ú
boto.utilsr`   rc   Úobjectr   r!   r0   r   r   r   r   Ú<module>   s   