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

�T_Z�@s�ddlZddlmZddlZddlZddlZddlmZddlm	Z	ej
d�ZdZdZ
dZd	Zd
Zdd�Zd
d�ZdZdd�Zdd�Zdd�ZdefdefdefgZdd�ZGdd�de	�ZdS)�N)�sha1)�six)�CustomArgumentZec2bundleinstancez�The bucket in which to store the AMI.  You can specify a bucket that you already own or a new bucket that Amazon EC2 creates on your behalf.  If you specify a bucket that belongs to someone else, Amazon EC2 returns an error.zCThe prefix for the image component names being stored in Amazon S3.z7The access key ID of the owner of the Amazon S3 bucket.acAn Amazon S3 upload policy that gives Amazon EC2 permission to upload items into Amazon S3 on the user's behalf. If you provide this parameter, you must also provide your secret access key, so we can create a policy signature for you (the secret access key is not passed to Amazon EC2). If you do not provide this parameter, we generate an upload policy for you automatically. For more information about upload policies see the sections about policy construction and signatures in the <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/HTTPPOSTForms.html">Amazon Simple Storage Service Developer Guide</a>.z�The AWS secret access key for the owner of the Amazon S3 bucket specified in the --bucket parameter. This parameter is required so that a signature can be computed for the policy.cKs�|d}d|_tddtd�}||d<tddtd�}||d<tdd	td�}||d	<td
dtd�}||d<tdd
td�}||d
<dS)N�storageF�Bucket�bucket)�
storage_param�nameZ	help_text�Prefix�prefixZAWSAccessKeyIdz
owner-akid�_SAKz	owner-sak�UploadPolicy�policy)Zrequired�BundleArgument�BUCKET_DOCS�PREFIX_DOCS�OWNER_AKID_DOCS�OWNER_SAK_DOCS�POLICY_DOCS)Zargument_table�kwargsZstorage_arg�arg�r�$/usr/lib/python3.6/bundleinstance.py�_add_paramsBs,rcKs@tj|�t|�}|dr<x dD]}||r d}t|��q WdS)	Nrrr�
owner_akid�	owner_sakrzOMixing the --storage option with the simple, scalar options is not recommended.)rrrrr)�logger�debug�vars�
ValueError)Zparsed_argsrZarg_dict�key�msgrrr�_check_args^s
r"z�{{"expiration": "{expires}","conditions": [{{"bucket": "{bucket}"}},{{"acl": "ec2-bundle-read"}},["starts-with", "$key", "{prefix}"]]}}cCsHtjdd�}tjj�|}|jd�}tj||d|dd�}||d<dS)N�)Zhoursz%Y-%m-%dT%H:%M:%S.%fZrr
)�expiresrrr
)�datetimeZ	timedeltaZutcnowZstrftime�POLICY�format)�paramsZdeltar$Zexpires_isorrrr�_generate_policyvs
r)cCs�|jd�}|jd�}|r||r|tjtj|��jd�}tj|jd�t	d�}|j
tj|��tj|j��j
�jd�}||d<|d=dS)Nr
rzutf-8)Z	digestmod�UploadPolicySignature)�get�base64Z	b64encoder�b�decode�hmac�new�encoder�updateZencodestringZdigest�strip)r(rZsakZnew_hmacZpsrrr�_generate_signature�s

r4cKs0|dd}d|krt|�d|kr,t|�dS)N�Storage�S3r
r*)r)r4)r(rrrrr�
_check_params�s
r7z+building-argument-table.ec2.bundle-instancez)operation-args-parsed.ec2.bundle-instancez)before-parameter-build.ec2.BundleInstancecCs"xtD]\}}|j||�qWdS)N)�EVENTS�register)Z
event_handlerZeventZhandlerrrr�register_bundleinstance�sr:cs,eZdZ�fdd�Zdd�Zdd�Z�ZS)rcstt|�j||�||_dS)N)�superr�__init__�_storage_param)�selfr�argsr)�	__class__rrr<�szBundleArgument.__init__cCs*d|krdii|d<||dd|j<dS)Nr5r6)r=)r>r(�valuerrr�_build_storage�szBundleArgument._build_storagecCs|r|j||�dS)N)rB)r>Z
parametersrArrr�
add_to_params�szBundleArgument.add_to_params)�__name__�
__module__�__qualname__r<rBrC�
__classcell__rr)r@rr�sr)ZloggingZhashlibrr/r,r%Z
awscli.compatrZawscli.argumentsrZ	getLoggerrrrrrrrr"r&r)r4r7r8r:rrrrr�<module>s.