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__/bundleinstance.cpython-310.pyc
o

.&�aY�@s�ddlZddlmZddlZddlZddlZddlmZddlm	Z	e�
d�ZdZdZ
dZd	Zd
Zdd�Zd
d�ZdZdd�Zdd�Zdd�ZdefdefdefgZdd�ZGdd�de	�ZdS)�N)�sha1)�six)�CustomArgument�ec2bundleinstancez�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�name�	help_text�Prefix�prefix�AWSAccessKeyIdz
owner-akid�_SAKz	owner-sak�UploadPolicy�policy)�required�BundleArgument�BUCKET_DOCS�PREFIX_DOCS�OWNER_AKID_DOCS�OWNER_SAK_DOCS�POLICY_DOCS)�argument_table�kwargs�storage_arg�arg�r�J/usr/lib/python3/dist-packages/awscli/customizations/ec2/bundleinstance.py�_add_paramsBs6�����rcKs@t�|�t|�}|drdD]}||rd}t|��qdSdS)Nr)rr
�
owner_akid�	owner_sakrzOMixing the --storage option with the simple, scalar options is not recommended.)�logger�debug�vars�
ValueError)�parsed_argsr�arg_dict�key�msgrrr�_check_args^s
��r*z�{{"expiration": "{expires}","conditions": [{{"bucket": "{bucket}"}},{{"acl": "ec2-bundle-read"}},["starts-with", "$key", "{prefix}"]]}}cCsHtjdd�}tj��|}|�d�}tj||d|dd�}||d<dS)N�)�hoursz%Y-%m-%dT%H:%M:%S.%fZrr)�expiresrr
r)�datetime�	timedelta�utcnow�strftime�POLICY�format)�params�deltar-�expires_isorrrr�_generate_policyvs
�r7cCs�|�d�}|�d�}|r@|rBt�t�|���d�}tj|�d�t	d�}|�
t�|��t�|����
��d�}||d<|d=dSdSdS)Nrrzutf-8)�	digestmod�UploadPolicySignature)�get�base64�	b64encoder�b�decode�hmac�new�encoder�update�encodebytes�digest�strip)r4r�sak�new_hmac�psrrr�_generate_signature�s


�rIcKs4|dd}d|vrt|�d|vrt|�dSdS)N�Storage�S3rr9)r7rI)r4rrrrr�
_check_params�s�rLz+building-argument-table.ec2.bundle-instancez)operation-args-parsed.ec2.bundle-instancez)before-parameter-build.ec2.BundleInstancecCstD]
\}}|�||�qdS�N)�EVENTS�register)�
event_handler�event�handlerrrr�register_bundleinstance�s�rScs,eZdZ�fdd�Zdd�Zdd�Z�ZS)rcs tt|�j|i|��||_dSrM)�superr�__init__�_storage_param)�selfr	�argsr��	__class__rrrU�s
zBundleArgument.__init__cCs*d|vr
dii|d<||dd|j<dS)NrJrK)rV)rWr4�valuerrr�_build_storage�szBundleArgument._build_storagecCs|r
|�||�dSdSrM)r\)rW�
parametersr[rrr�
add_to_params�s�zBundleArgument.add_to_params)�__name__�
__module__�__qualname__rUr\r^�
__classcell__rrrYrr�sr)�logging�hashlibrr?r;r.�
awscli.compatr�awscli.argumentsr�	getLoggerr"rrrrrrr*r2r7rIrLrNrSrrrrr�<module>s4

�	
�