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__/awslambda.cpython-38.pyc
U

���^G�@s�ddlZddlZddlmZddlZddlmZmZdZdZ	dd�Z
dd	�ZGd
d�de�Z
dd
�Zdd�ZGdd�de�ZGdd�de�ZdS)�N)�closing)�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@|�dtd�j�|�dtd�j�|�dt�|�dt�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
�A/usr/lib/python3/dist-packages/awscli/customizations/awslambda.py�register_lambda_create_function!s����rcKs|jdkrt|�dS�N�zip-file)�name�_should_contain_zip_content)Zcli_argument�value�kwargsr
r
rr	,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||_|��|_dS)N)�_serialized_name�lower�_name)�self�serialized_namer
r
r�__init__:szZipFileArgumentHoister.__init__cKsltj|jd�}td|d|jd�|d<||j}t�|j�}|jd=t	|j||j
d|�d�|jd�||j<dS)	N)Z
param_typerZblob)�	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_tablerrZargumentZmodelr
r
rr>s$�

�zZipFileArgumentHoister.hoistN)�__name__�
__module__�__qualname__�__doc__rrr
r
r
rr1srcKsd|krt|d_dSr
)rZ
documentation)r$r%rr
r
rrQsrc	Csht|t�s|�d�}t�|�}z&tt�|���}|��W5QRXWntj	k
rbt
t��YnXdS)Nzutf-8)�
isinstance�bytes�encode�six�BytesIOr�zipfilerZinfolistZ
BadZipfile�
ValueError�	ERROR_MSG)rZfileobj�fr
r
rrVs


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"|�d�|_tt|�j||�dS)Nr)�pop�_param_to_replace�superrr�r�argsr��	__class__r
rrnszZipFileArgument.__init__cCsH|dkrdSt|�d|i}|�|j�r:||j�|�n
|||j<dS)Nr)r�getr4�update)r�
parametersrZzip_file_paramr
r
r�
add_to_paramsrszZipFileArgument.add_to_params�r&r'r(r)rr=�
__classcell__r
r
r8rres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)r5r#r�	_cli_namer4r6r8r
rr�sz ReplacedZipFileArgument.__init__cCsX|dkrdS|�|�}d|kr,td|j��|�|j�rJ||j�|�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_argumentr0r@r:r4r;)rr<rZunpackedr
r
rr=�s
��z%ReplacedZipFileArgument.add_to_paramsr>r
r
r8rr#}sr#)r/r �
contextlibrr-Zawscli.argumentsrrr1rrr	�objectrrrrr#r
r
r
r�<module>
s��