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__/secgroupsimplify.cpython-36.pyc
3

�T_!�
@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)Z	help_textTzip-protocol�portz	from-portzto-port�cidrzcidr-ipzsource-groupzsource-security-group-namezgroup-ownerzsource-security-group-owner-id)�ProtocolArgument�
PROTOCOL_DOCSZ
_UNDOCUMENTED�PortArgument�	PORT_DOCS�CidrArgument�	CIDR_DOCS�SourceGroupArgument�SOURCEGROUP_DOCS�GroupOwnerArgument�GROUPOWNER_DOCS)Zargument_table�kwargs�arg�r�&/usr/lib/python3.6/secgroupsimplify.py�_add_paramss&




rcKs:t|�}|dr6x$dD]}||rd|}t|��qWdS)	N�ip_permissionsrrr�source_group�group_ownerzCThe --%s option is not compatible with the --ip-permissions option )rrrrr)�vars�
ValueError)Zparsed_argsrZarg_dict�key�msgrrr�_check_args8srcKs6|j}|jj�|jj�d}|j|�|jj�dS)NzZTo specify multiple rules in a single command use the <code>--ip-permissions</code> option)�docZstyleZ
new_paragraphZ
start_noteZinclude_doc_stringZend_note)Zhelp_commandrrrrrr�	_add_docsFs


rz<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>cCs"xtD]\}}|j||�qWdS)N)�EVENTS�register)Z
event_handlerZeventZhandlerrrr�register_secgroupvsr!cCs�d|krig|d<|dkrRd|ddkr:g|ddd<|dddj|�nT|d
kr�d	|ddkr|ig|ddd	<||ddd	d|<n||dd|<dS)NZ
IpPermissions�CidrIp�IpRangesrr�GroupId�	GroupName�UserIdZUserIdGroupPairs)r$r%r&)�append)Zparamsr�valuerrr�_build_ip_permissions{s
r)c@seZdZdd�ZdS)rcCsz|rvy0t|�}|dks|dkr2|dkr2d}t|��Wn4tk
rh|d
krXd	}t|��|dkrdd
}YnXt|d|�dS)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.z-1Z
IpProtocol���)r,r-r.r/)�intrr))�self�
parametersr(Z	int_valuerrrr�
add_to_params�s
zProtocolArgument.add_to_paramsN)�__name__�
__module__�__qualname__r4rrrrr�src@seZdZdd�ZdS)rcCs�|r�yb|dks|dkr d}d}n$d|kr:|jdd�\}}n
||}}t|dt|��t|dt|��Wn tk
r�d}t|��YnXdS)Nz-1r/�-r+ZFromPortZToPortzCport parameter should be of the form <from[-to]> (e.g. 22 or 22-25))�splitr)r1r)r2r3r(ZfromstrZtostrrrrrr4�s
zPortArgument.add_to_paramsN)r5r6r7r4rrrrr�src@seZdZdd�ZdS)r
cCs|rd|ig}t|d|�dS)Nr"r#)r))r2r3r(rrrr4�s
zCidrArgument.add_to_paramsN)r5r6r7r4rrrrr
�sr
c@seZdZdd�ZdS)rcCs,|r(|jd�rt|d|�nt|d|�dS)Nzsg-r$r%)�
startswithr))r2r3r(rrrr4�s
z!SourceGroupArgument.add_to_paramsN)r5r6r7r4rrrrr�src@seZdZdd�ZdS)rcCs|rt|d|�dS)Nr&)r))r2r3r(rrrr4�sz GroupOwnerArgument.add_to_paramsN)r5r6r7r4rrrrr�srN)�__doc__Zawscli.argumentsrrrrrrr	rr
rr!r)rrr
rrrrrr�<module>s>