HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/awscli/customizations/ec2/__pycache__/secgroupsimplify.cpython-310.pyc
o

.&�a!�
@s�dZddlmZdd�Zdd�Zdd�Zd	efd
efdefdefd
efdefdefdefdefdefdefdefgZdZdZdZ	dZ
dZdd�Zdd�Z
Gdd�de�ZGd d!�d!e�ZGd"d#�d#e�ZGd$d%�d%e�ZGd&d'�d'e�Zd(S))a�
This customization adds the following scalar parameters to the
authorize operations:

* --protocol: tcp | udp | icmp or any protocol number
* --port:  A single integer or a range (min-max). You can specify ``all``
  to mean all ports (for example, port range 0-65535)
* --source-group: Either the source security group ID or name.
* --cidr -  The CIDR range. Cannot be used when specifying a source or
  destination security group.
�)�CustomArgumentcKs�tdtd�}||d<d|d_tdtd�}||d<d|d_d|d_tdtd�}||d<d|d	_td
td�}||d
<d|d_t	dt
d�}||d<d|d
_dS)N�protocol)�	help_textTzip-protocol�portz	from-portzto-port�cidrzcidr-ipzsource-groupzsource-security-group-namezgroup-ownerzsource-security-group-owner-id)�ProtocolArgument�
PROTOCOL_DOCS�
_UNDOCUMENTED�PortArgument�	PORT_DOCS�CidrArgument�	CIDR_DOCS�SourceGroupArgument�SOURCEGROUP_DOCS�GroupOwnerArgument�GROUPOWNER_DOCS)�argument_table�kwargs�arg�r�L/usr/lib/python3/dist-packages/awscli/customizations/ec2/secgroupsimplify.py�_add_paramss,�



�
�rcKs:t|�}|drdD]}||rd|}t|��q
dSdS)N�ip_permissions)rrr�source_group�group_ownerzCThe --%s option is not compatible with the --ip-permissions option )�vars�
ValueError)�parsed_argsr�arg_dict�key�msgrrr�_check_args8s���r!cKs6|j}|j��|j��d}|�|�|j��dS)NzZTo specify multiple rules in a single command use the <code>--ip-permissions</code> option)�doc�style�
new_paragraph�
start_note�include_doc_string�end_note)�help_commandrr"r rrr�	_add_docsFs


r)z<building-argument-table.ec2.authorize-security-group-ingressz;building-argument-table.ec2.authorize-security-group-egressz9building-argument-table.ec2.revoke-security-group-ingressz8building-argument-table.ec2.revoke-security-group-egressz:operation-args-parsed.ec2.authorize-security-group-ingressz9operation-args-parsed.ec2.authorize-security-group-egressz7operation-args-parsed.ec2.revoke-security-group-ingressz6operation-args-parsed.ec2.revoke-security-group-egressz4doc-description.ec2.authorize-security-group-ingressz3doc-description.ec2.authorize-security-group-egressz1doc-description.ec2.revoke-security-group-ingressz4doc-description.ec2.revoke-security-groupdoc-ingressa+<p>The IP protocol: <code>tcp</code> | <code>udp</code> | <code>icmp</code></p> <p>(VPC only) Use <code>all</code> to specify all protocols.</p><p>If this argument is provided without also providing the <code>port</code> argument, then it will be applied to all ports for the specified protocol.</p>a�<p>For TCP or UDP: The range of ports to allow.  A single integer or a range (<code>min-max</code>).</p><p>For ICMP: A single integer or a range (<code>type-code</code>) representing the ICMP type number and the ICMP code number respectively. A value of -1 indicates all ICMP codes for all ICMP types. A value of -1 just for <code>type</code> indicates all ICMP codes for the specified ICMP type.</p>z<p>The CIDR IP range.</p>z3<p>The name or ID of the source security group.</p>zp<p>The AWS account ID that owns the source security group. Cannot be used when specifying a CIDR IP address.</p>cCstD]
\}}|�||�qdS)N)�EVENTS�register)�
event_handler�event�handlerrrr�register_secgroupvs�r/cCs�d|vr	ig|d<|dkr*d|ddvrg|ddd<|ddd�|�dS|dvrMd|ddvr?ig|ddd<||dddd|<dS||dd|<dS)N�
IpPermissions�CidrIp�IpRangesrr)�GroupId�	GroupName�UserId�UserIdGroupPairs)�append)�paramsr�valuerrr�_build_ip_permissions{s
r:c@�eZdZdd�ZdS)rcCs||r<zt|�}|dks|dkr|dkrd}t|��Wnty3|dvr+d}t|��|dkr1d}Ynwt|d	|�dSdS)
Nr����zJprotocol numbers must be in the range 0-255 or -1 to specify all protocols)�tcp�udp�icmp�allzSprotocol parameter should be one of: tcp|udp|icmp|all or any valid protocol number.rA�-1�
IpProtocol)�intrr:)�self�
parametersr9�	int_valuer rrr�
add_to_params�s"����zProtocolArgument.add_to_paramsN��__name__�
__module__�__qualname__rHrrrrr��rc@r;)r
cCs�|rBz2|dks|dkrd}d}nd|vr|�dd�\}}n||}}t|dt|��t|dt|��WdStyAd}t|��wdS)NrBrA�-��FromPort�ToPortzCport parameter should be of the form <from[-to]> (e.g. 22 or 22-25))�splitr:rDr)rErFr9�fromstr�tostrr rrrrH�s
��zPortArgument.add_to_paramsNrIrrrrr
�rMr
c@r;)rcCs"|rd|ig}t|d|�dSdS)Nr1r2�r:�rErFr9rrrrH�s
�zCidrArgument.add_to_paramsNrIrrrrr�rMrc@r;)rcCs2|r|�d�rt|d|�dSt|d|�dSdS)Nzsg-r3r4)�
startswithr:rVrrrrH�s

�z!SourceGroupArgument.add_to_paramsNrIrrrrr�rMrc@r;)rcCs|r
t|d|�dSdS)Nr5rUrVrrrrH�s�z GroupOwnerArgument.add_to_paramsNrIrrrrr�rMrN)�__doc__�awscli.argumentsrrr!r)r*rrr
rrr/r:rr
rrrrrrr�<module>sH����