HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/awscli/customizations/ec2/__pycache__/runinstances.cpython-36.pyc
3

�T_O�@s�dZddlmZdZdZdZdd�Zdd	�Zd
d�Zdefd
efdefgZ	dd�Z
dd�ZGdd�de�ZGdd�de�Z
Gdd�de�ZGdd�de�ZdS)a=
This customization adds two new parameters to the ``ec2 run-instance``
command.  The first, ``--secondary-private-ip-addresses`` allows a list
of IP addresses within the specified subnet to be associated with the
new instance.  The second, ``--secondary-ip-address-count`` allows you
to specify how many additional IP addresses you want but the actual
address will be assigned for you.

This functionality (and much more) is also available using the
``--network-interfaces`` complex argument.  This just makes two of
the most commonly used features available more easily.
�)�CustomArgumenta$[EC2-VPC] A secondary private IP address for the network interface or instance. You can specify this multiple times to assign multiple secondary IP addresses.  If you want additional private IP addresses but do not need a specific address, use the --secondary-private-ip-address-count option.z^[EC2-VPC] The number of secondary IP addresses to assign to the network interface or instance.zY[EC2-VPC] If specified a public IP address will be assigned to the new instance in a VPC.cKs\tdtd�}||d<tdtd�}||d<tdtddd�}||d<tdtd	dd�}||d<dS)
Nzsecondary-private-ip-addresses)�name�	help_textz"secondary-private-ip-address-countzassociate-public-ip-address�
store_trueZassociate_public_ip)rr�actionZ
group_namezno-associate-public-ip-addressZstore_false)�#SecondaryPrivateIpAddressesArgument�#SECONDARY_PRIVATE_IP_ADDRESSES_DOCS�&SecondaryPrivateIpAddressCountArgument�'SECONDARY_PRIVATE_IP_ADDRESS_COUNT_DOCS� AssociatePublicIpAddressArgument� ASSOCIATE_PUBLIC_IP_ADDRESS_DOCS�"NoAssociatePublicIpAddressArgument)Zargument_table�kwargs�arg�r�"/usr/lib/python3.6/runinstances.py�_add_params.s$

rcKs6t|�}|dr2x dD]}||rd}t|��qWdS)NZnetwork_interfaces�secondary_private_ip_addresses�"secondary_private_ip_address_count�associate_public_ip_addresszXMixing the --network-interfaces option with the simple, scalar options is not supported.)rrr)�vars�
ValueError)Zparsed_argsrZarg_dict�key�msgrrr�_check_argsCsrcs�dddg}d|kr�|dd�t�fdd�|D��r�d|krN|d�d<|d=d	|krh|d	�d
<|d	=d|kr�|ddd
�}|g�d<|d=d|kr�|d�d<|d=d|kr�|d�d<|d=dS)N�PrivateIpAddresses�SecondaryPrivateIpAddressCount�AssociatePublicIpAddress�NetworkInterfacesrc3s|]}|�kVqdS)Nr)�.0Zparam)�	interfacerr�	<genexpr>fsz_fix_args.<locals>.<genexpr>ZSubnetIdZSecurityGroupIdsZGroups�PrivateIpAddressT)r"�PrimaryZIpv6AddressCountZ
Ipv6Addresses)�any)�paramsrZnetwork_interface_paramsZip_addrr)r r�	_fix_argsSs.

r&z)building-argument-table.ec2.run-instancesz'operation-args-parsed.ec2.run-instancesz'before-parameter-build.ec2.RunInstancescCs"xtD]\}}|j||�qWdS)N)�EVENTS�register)Z
event_handlerZeventZhandlerrrr�register_runinstances�sr)cCsTd|krddig|d<|dkr@d|ddkrP||ddd<n||dd|<dS)NrZDeviceIndexrrr)r%r�valuerrr�_build_network_interfaces�sr+c@seZdZddd�Zdd�ZdS)rNcCs|j|j|j|jdd�dS)N�*)�dest�default�nargs)�add_argument�cli_name�py_name�_default)�self�parserr1rrr�
add_to_parser�sz1SecondaryPrivateIpAddressesArgument.add_to_parsercCs"|rdd�|D�}t|d|�dS)NcSsg|]}|dd��qS)F)r"r#r)r�vrrr�
<listcomp>�szESecondaryPrivateIpAddressesArgument.add_to_params.<locals>.<listcomp>r)r+)r4�
parametersr*rrr�
add_to_params�sz1SecondaryPrivateIpAddressesArgument.add_to_params)N)�__name__�
__module__�__qualname__r6r:rrrrr�s
rc@seZdZddd�Zdd�ZdS)r	NcCs|j|j|j|jtd�dS)N)r-r.�type)r0r1r2r3�int)r4r5r1rrrr6�sz4SecondaryPrivateIpAddressCountArgument.add_to_parsercCs|rt|d|�dS)Nr)r+)r4r9r*rrrr:�sz4SecondaryPrivateIpAddressCountArgument.add_to_params)N)r;r<r=r6r:rrrrr	�s
r	c@seZdZdd�ZdS)rcCs|dkrt|d|�dS)NTr)r+)r4r9r*rrrr:�sz.AssociatePublicIpAddressArgument.add_to_paramsN)r;r<r=r:rrrrr�src@seZdZdd�ZdS)r
cCs|dkrt|d|�dS)NFr)r+)r4r9r*rrrr:�sz0NoAssociatePublicIpAddressArgument.add_to_paramsN)r;r<r=r:rrrrr
�sr
N)�__doc__Zawscli.argumentsrrr
rrrr&r'r)r+rr	rr
rrrr�<module>s (