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/__pycache__/cloudfront.cpython-36.pyc
3

�T_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�|jdt�|jdt�|jdtdgdg��|jdtddgd	g��|jd
dd��|jd
d
d��i�|jd�jdd�|jdtdgd	g��|jd�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|jdt|��S)Nzorigin-domain-name)�__setitem__�OriginDomainName)�argument_table�kwargs�r� /usr/lib/python3.6/cloudfront.py�<lambda>+szregister.<locals>.<lambda>c[s|jdt|��S)Nzdefault-root-object)r�CreateDefaultRootObject)r
rrrr
r/sztop-level-args-parsed�
cloudfront)Z	unique_idz4operation-args-parsed.cloudfront.update-distributionz6building-argument-table.cloudfront.update-distributioncs|jdt�|d��S)Nzdefault-root-object)�contextr
)r�UpdateDefaultRootObject)r
r)rrr
r;s)�register�	_add_sign�
_add_pathsr�update)Z
event_handlerr)rr
rs6


r�clicCsd|ttj��tjdd�fS)Nz%s-%s-%s�i@B)�int�time�randomZrandint)�prefixrrr
�
unique_string@srcKsd|d_t�|d<dS)NFzinvalidation-batchr)�required�
PathsArgument)r
rrrr
rDs
rcs$eZdZ�fdd�Zdd�Z�ZS)rcsd}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__rr
r$KszPathsArgument.__init__cCs&|dk	r"t�t|�|d�d�|d<dS)N)�Quantity�Items)�CallerReference�PathsZInvalidationBatch)r�len)r%�
parameters�valuerrr
�
add_to_paramsRszPathsArgument.add_to_params)�__name__�
__module__�__qualname__r$r/�
__classcell__rr)r'r
rIsrcs*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")rr#r4r$�DOC)r%�namer
Zexclusive_tor")r'rr
r$]s

zExclusiveArgument.__init__cCs4t�dgd�ddddid�ddd�d	dd
�ddd
�S)Nr)r(r)ZplaceholderFZForwardZnone)ZQueryStringZCookies)�Enabledr(z	allow-all)�TargetOriginIdZForwardedValuesZTrustedSignersZViewerProtocolPolicyZMinTTLTr6)r*�Origins�DefaultCacheBehaviorr9�Comment)r)r%rrr
�distribution_config_templatecs
z.ExclusiveArgument.distribution_config_template)r5r6)r0r1r2r7r$r>r3rr)r'r
r4Zsr4cs$eZdZ�fdd�Zdd�Z�ZS)r	cstt|�jd|dd�dS)Nzorigin-domain-namez The domain name for your origin.)r")r#r	r$)r%r
)r'rr
r$zs
zOriginDomainName.__init__cCs�|dkrdS|jd|j��t|d�}||dd�}|djd�rNddi|d<nd	d
dd�|d
<d|gd�|dd<||ddd<dS)N�DistributionConfig)rr6)�Id�
DomainNameZ
OriginPathrAz.s3.amazonaws.comZOriginAccessIdentityZS3OriginConfig�Pi�z	http-only)ZHTTPPortZ	HTTPSPortZOriginProtocolPolicyZCustomOriginConfigr)r(r)r;r<r:)�
setdefaultr>r�endswith)r%r-r.Z	origin_id�itemrrr
r/s
zOriginDomainName.add_to_params)r0r1r2r$r/r3rr)r'r
r	ysr	cs&eZdZd�fdd�	Zdd�Z�ZS)rr6cstt|�jd||pdd�dS)Nzdefault-root-objectzvThe 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'rr
r$�s
z CreateDefaultRootObject.__init__cCs(|dk	r$|jd|j��||dd<dS)Nr?�DefaultRootObject)rCr>)r%r-r.rrr
r/�sz%CreateDefaultRootObject.add_to_params)r6)r0r1r2r$r/r3rr)r'r
r�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'rr
r$�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_urlZverifyr@)r@ZETagZIfMatchr?rF)rZ
create_clientZregionrHZ
verify_sslZget_distribution_config)r%r-r.ZclientZresponserrr
r/�s


z%UpdateDefaultRootObject.add_to_params)r0r1r2r$r/r3rr)r'r
r�s	rcKst|�|d<dS)N�sign)�SignCommand)Z
command_tablerGrrrr
r�src@sfeZdZdZdZdZddddd�ddd	d
�dddd
�d
dded
�dded�ddd�gZdd�ZdS)rJrIzSign 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)r8Zno_paramfilerr"zkey-pair-idz_The active CloudFront key pair Id for the key pair that you're using to generate the signature.)r8rr"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. )r8r"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|j
|d��ntjj
|j|j
|d��dS)N)�date_greater_than�
ip_address)�policy)�date_less_thanr)rZkey_pair_id�	RSASigner�private_keyrIrrOrLrMZbuild_policyrK�sys�stdout�writeZgenerate_presigned_url)r%�argsZparsed_globalsZsignerrOrLrNrrr
�	_run_main�s



zSignCommand._run_mainN)r0r1r2�NAMEZDESCRIPTIONZDATE_FORMATZ	ARG_TABLErVrrrr
rJ�s(


rJc@seZdZdd�Zdd�ZdS)rPcCstjj|jd��|_dS)N�utf8)�rsaZ
PrivateKeyZ
load_pkcs1�encode�priv_key)r%rQrrr
r$szRSASigner.__init__cCstj||jd�S)NzSHA-1)rYrIr[)r%�messagerrr
rIszRSASigner.signN)r0r1r2r$rIrrrr
rP�srP)r)rRrrrYZbotocore.utilsrZbotocore.signersrZawscli.argumentsrZawscli.customizations.utilsrZawscli.customizations.commandsrrrrrr4r	rrrrJ�objectrPrrrr
�<module>
s&&
A