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

�T_^�@s�ddlZddlZddlmZddlmZddlmZmZdZ	dZ
dd�Zd	d
�ZGdd�de
�Zd
d�Zdd�ZGdd�de�ZGdd�de�ZdS)�N)�closing)�six)�CustomArgument�CLIArgumentzk--zip-file must be a zip file with the fileb:// prefix.
Example usage:  --zip-file fileb://path/to/file.zipz�<p>The path to the zip file of the {param_type} you are uploading. Specify --zip-file or --{param_type}, but not both. Example: fileb://{param_type}.zip</p>cCs@|jdtd�j�|jdtd�j�|jdt�|jdt�dS)Nz.building-argument-table.lambda.create-functionZCodez4building-argument-table.lambda.publish-layer-versionZContentz3building-argument-table.lambda.update-function-codez+process-cli-arg.lambda.update-function-code)�register�ZipFileArgumentHoister�hoist�_modify_zipfile_docstring�validate_is_zip_file)Zcli�r�/usr/lib/python3.6/awslambda.py�register_lambda_create_function!sr
cKs|jdkrt|�dS)Nzzip-file)�name�_should_contain_zip_content)Zcli_argument�value�kwargsrrrr
,s
r
c@s eZdZdZdd�Zdd�ZdS)rarHoists a ZipFile argument up to the top level.

    Injects a top-level ZipFileArgument into the argument table which maps
    a --zip-file parameter to the underlying ``serialized_name`` ZipFile
    shape. Repalces the old ZipFile argument with an instance of
    ReplacedZipFileArgument to prevent its usage and recommend the new
    top-level injected parameter.
    cCs||_|j�|_dS)N)�_serialized_name�lower�_name)�self�serialized_namerrr�__init__:szZipFileArgumentHoister.__init__cKsltj|jd�}td|d|jd�|d<||j}tj|j�}|jd=t	|j||j
d|jd�|jd�||j<dS)	N)Z
param_typezzip-fileZblob)�	help_textZ
cli_type_namer�ZipFileF�
event_emitter)r�argument_modelZoperation_modelZis_requiredrr)�
ZIP_DOCSTRING�formatr�ZipFileArgumentr�copy�deepcopyr�members�ReplacedZipFileArgumentZ_operation_modelZ
get_component)r�session�argument_tablerrZargumentZmodelrrrr>s
zZipFileArgumentHoister.hoistN)�__name__�
__module__�__qualname__�__doc__rrrrrrr1srcKsd|krt|d_dS)Nzzip-file)rZ
documentation)r#r$rrrrr	Qsr	cCsht|t�s|jd�}tj|�}y&ttj|���}|j�WdQRXWntj	k
rbt
t��YnXdS)Nzutf-8)�
isinstance�bytes�encoder�BytesIOr�zipfilerZinfolistZ
BadZipfile�
ValueError�	ERROR_MSG)rZfileobj�frrrrVs


rcs(eZdZdZ�fdd�Zdd�Z�ZS)ra�A new ZipFile argument to be injected at the top level.

    This class injects a ZipFile argument under the specified serialized_name
    parameter. This can be used to take a top level parameter like --zip-file
    and inject it into a nested different parameter like Code so
    --zip-file foo.zip winds up being serilized as
    { 'Code': { 'ZipFile': <contents of foo.zip> } }.
    cs"|jd�|_tt|�j||�dS)Nr)�pop�_param_to_replace�superrr)r�argsr)�	__class__rrrnszZipFileArgument.__init__cCsH|dkrdSt|�d|i}|j|j�r:||jj|�n
|||j<dS)Nr)r�getr2�update)r�
parametersrZzip_file_paramrrr�
add_to_paramsrszZipFileArgument.add_to_params)r%r&r'r(rr9�
__classcell__rr)r5rresrcs(eZdZdZ�fdd�Zdd�Z�ZS)r"a�A replacement arugment for nested ZipFile argument.

    This prevents the use of a non-working nested argument that expects binary.
    Instead an instance of ZipFileArgument should be injected at the top level
    and used instead. That way fileb:// can be used to load the binary
    contents. And the argument class can inject those bytes into the correct
    serialization name.
    cs.tt|�j||�d|d|_|d|_dS)Nz--%srr)r3r"r�	_cli_namer2)rr4r)r5rrr�sz ReplacedZipFileArgument.__init__cCsX|dkrdS|j|�}d|kr,td|j��|j|j�rJ||jj|�n
|||j<dS)NrzyZipFile cannot be provided as part of the %s argument.  Please use the '--zip-file' option instead to specify a zip file.)Z_unpack_argumentr.r;r6r2r7)rr8rZunpackedrrrr9�s

z%ReplacedZipFileArgument.add_to_params)r%r&r'r(rr9r:rr)r5rr"}sr")r-r�
contextlibrZbotocore.vendoredrZawscli.argumentsrrr/rr
r
�objectrr	rrr"rrrr�<module>
s