HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/awscli/customizations/__pycache__/cloudfront.cpython-38.pyc
U

<�^T)�@s�ddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
dd�Zdd
d�Zdd
�ZGdd�de	�ZGdd�de	�ZGdd�de�ZGdd�de�ZGdd�de�Zdd�ZGdd�de
�ZGdd�de�ZdS)�N)�parse_to_aware_datetime)�CloudFrontSigner)�CustomArgument)�#validate_mutually_exclusive_handler)�BasicCommandcs�|�dt�|�dt�|�dtdgdg��|�dtddgd	g��|�d
dd��|�d
d
d��i�|jd�jdd�|�dtdgd	g��|�d�fdd��dS)Nz!building-command-table.cloudfrontz6building-argument-table.cloudfront.create-invalidationz4operation-args-parsed.cloudfront.create-invalidationZinvalidation_batch�pathsz4operation-args-parsed.cloudfront.create-distributionZdefault_root_objectZorigin_domain_nameZdistribution_configz6building-argument-table.cloudfront.create-distributionc[s|�dt|��S)N�origin-domain-name)�__setitem__�OriginDomainName��argument_table�kwargs�r�B/usr/lib/python3/dist-packages/awscli/customizations/cloudfront.py�<lambda>+s�zregister.<locals>.<lambda>c[s|�dt|��S)N�default-root-object)r	�CreateDefaultRootObjectrrrrr/s�ztop-level-args-parsed�
cloudfront)Z	unique_idz4operation-args-parsed.cloudfront.update-distributionz6building-argument-table.cloudfront.update-distributioncs|�dt�|d��S)Nr)�contextr)r	�UpdateDefaultRootObjectr�rrrr;s��)�register�	_add_sign�
_add_pathsr�update)Z
event_handlerrrrrsR���������
�r�clicCsd|tt���t�dd�fS)Nz%s-%s-%s�i@B)�int�time�randomZrandint��prefixrrr�
unique_string@sr"cKsd|d_t�|d<dS)NFzinvalidation-batchr)�required�
PathsArgumentrrrrrDs
rcs$eZdZ�fdd�Zdd�Z�ZS)r$csd}tt|�jdd|d�dS)NzlThe space-separated paths to be invalidated. Note: --invalidation-batch and --paths are mututally exclusive.r�+)�nargs�	help_text)�superr$�__init__)�self�doc��	__class__rrr)Ks�zPathsArgument.__init__cCs&|dk	r"t�t|�|d�d�|d<dS)N��QuantityZItems)�CallerReferenceZPathsZInvalidationBatch)r"�len�r*�
parameters�valuerrr�
add_to_paramsRs�zPathsArgument.add_to_params��__name__�
__module__�__qualname__r)r5�
__classcell__rrr,rr$Isr$cs*eZdZdZd�fdd�	Zdd�Z�ZS)	�ExclusiveArgumentz2%s This argument and --%s are mututally exclusive.�distribution-config�cs,d||_tt|�j||j||fd�dS)NF�r')r#r(r;r)�DOC)r*�namerZexclusive_tor'r,rrr)]s


�zExclusiveArgument.__init__cCs4t�dgd�ddddid�ddd�d	dd
�ddd
�S)Nrr.ZplaceholderFZForwardZnone)ZQueryStringZCookies)�Enabledr/z	allow-all)�TargetOriginIdZForwardedValuesZTrustedSignersZViewerProtocolPolicyZMinTTLTr=)r0�Origins�DefaultCacheBehaviorrA�Comment)r")r*rrr�distribution_config_templatecs���
�z.ExclusiveArgument.distribution_config_template)r<r=)r7r8r9r?r)rFr:rrr,rr;Zs
�r;cs$eZdZ�fdd�Zdd�Z�ZS)r
cstt|�jd|dd�dS)Nrz The domain name for your origin.r>)r(r
r))r*rr,rrr)zs

�zOriginDomainName.__init__cCs�|dkrdS|�d|���t|d�}||dd�}|d�d�rNddi|d<nd	d
dd�|d
<d|gd�|dd<||ddd<dS)N�DistributionConfigr r=)�Id�
DomainNameZ
OriginPathrIz.s3.amazonaws.comZOriginAccessIdentityZS3OriginConfig�Pi�z	http-only)ZHTTPPortZ	HTTPSPortZOriginProtocolPolicyZCustomOriginConfigrr.rCrDrB)�
setdefaultrFr"�endswith)r*r3r4Z	origin_id�itemrrrr5s*�
�
��
�zOriginDomainName.add_to_paramsr6rrr,rr
ysr
cs&eZdZd�fdd�	Zdd�Z�ZS)rr=cstt|�jd||pdd�dS)NrzvThe object that you want CloudFront to return (for example, index.html) when a viewer request points to your root URL.r>)r(rr))r*rr'r,rrr)�s
�z CreateDefaultRootObject.__init__cCs(|dk	r$|�d|���||dd<dS)NrG�DefaultRootObject)rKrFr2rrrr5�s�z%CreateDefaultRootObject.add_to_params)r=r6rrr,rr�srcs$eZdZ�fdd�Zdd�Z�ZS)rcstt|�j|dd�||_dS)Nz�The object that you want CloudFront to return (for example, index.html) when a viewer request points to your root URL. CLI will automatically make a get-distribution-config call to load and preserve your other settings.r>)r(rr)r)r*rrr,rrr)�s

�z UpdateDefaultRootObject.__init__cCsp|dk	rl|jdjd|jdj|jdj|jdjd�}|j|dd�}|d|d<|d	|d	<||d	d
<dS)N�sessionrZparsed_args)Zregion_name�endpoint_urlZverifyrH)rHZETagZIfMatchrGrN)rZ
create_clientZregionrPZ
verify_sslZget_distribution_config)r*r3r4ZclientZresponserrrr5�s



�z%UpdateDefaultRootObject.add_to_paramsr6rrr,rr�s	rcKst|�|d<dS)N�sign)�SignCommand)Z
command_tablerOr
rrrr�src@sfeZdZdZdZdZddddd�ddd	d
�dddd
�d
dded
�dded�ddd�gZdd�ZdS)rRrQzSign a given url.aOSupported formats include:
        YYYY-MM-DD (which means 0AM UTC of that day),
        YYYY-MM-DDThh:mm:ss (with default timezone as UTC),
        YYYY-MM-DDThh:mm:ss+hh:mm or YYYY-MM-DDThh:mm:ss-hh:mm (with offset),
        or EpochTime (which always means UTC).
        Do NOT use YYYYMMDD, because it will be treated as EpochTime.�urlTzThe URL to be signed)r@Zno_paramfiler#r'zkey-pair-idz_The active CloudFront key pair Id for the key pair that you're using to generate the signature.)r@r#r'zprivate-keyz#file://path/to/your/private-key.pemzdate-less-thanz*The expiration date and time for the URL. zdate-greater-thanz-An optional start date and time for the URL. )r@r'z
ip-addressztAn optional IP address or IP address range to allow client making the GET request from. Format: x.x.x.x/x or x.x.x.xcCs�t|jt|j�j�}t|j�}|j}|dk	r4t|�}|dk	sF|jdk	rv|j	|j
|||jd�}tj�
|j|j
|d��ntj�
|j|j
|d��dS)N)�date_greater_than�
ip_address)�policy)�date_less_thanr)rZkey_pair_id�	RSASigner�private_keyrQrrWrTrUZbuild_policyrS�sys�stdout�writeZgenerate_presigned_url)r*�argsZparsed_globalsZsignerrWrTrVrrr�	_run_main�s0
�
�
�

�zSignCommand._run_mainN)r7r8r9�NAMEZDESCRIPTIONZDATE_FORMATZ	ARG_TABLEr^rrrrrR�s8�������%rRc@seZdZdd�Zdd�ZdS)rXcCstj�|�d��|_dS)N�utf8)�rsaZ
PrivateKeyZ
load_pkcs1�encode�priv_key)r*rYrrrr)szRSASigner.__init__cCst�||jd�S)NzSHA-1)rarQrc)r*�messagerrrrQszRSASigner.signN)r7r8r9r)rQrrrrrX�srX)r)rZrrraZbotocore.utilsrZbotocore.signersrZawscli.argumentsrZawscli.customizations.utilsrZawscli.customizations.commandsrrr"rr$r;r
rrrrR�objectrXrrrr�<module>
s&&
A