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/__pycache__/awslambda.cpython-310.pyc
o

�s�aG�@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-function�Codez4building-argument-table.lambda.publish-layer-version�Contentz3building-argument-table.lambda.update-function-codez+process-cli-arg.lambda.update-function-code)�register�ZipFileArgumentHoister�hoist�_modify_zipfile_docstring�validate_is_zip_file)�cli�r
�A/usr/lib/python3/dist-packages/awscli/customizations/awslambda.py�register_lambda_create_function!s����rcKs|jdkrt|�dSdS�N�zip-file)�name�_should_contain_zip_content)�cli_argument�value�kwargsr
r
rr,s
�rc@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)�
param_typer�blob)�	help_text�
cli_type_namer�ZipFileF�
event_emitter)r�argument_model�operation_model�is_requiredr"r)�
ZIP_DOCSTRING�formatr�ZipFileArgumentr�copy�deepcopyr#�members�ReplacedZipFileArgument�_operation_model�
get_component)r�session�argument_tablerr�argument�modelr
r
rr	>s 
�
�zZipFileArgumentHoister.hoistN)�__name__�
__module__�__qualname__�__doc__rr	r
r
r
rr1srcKsd|vrt|d_dSdSr)r&�
documentation)r/r0rr
r
rr
Qs�r
cCsxt|t�s
|�d�}t�|�}z tt�|���}|��Wd�WdS1s(wYWdStj	y;t
t��w)Nzutf-8)�
isinstance�bytes�encode�six�BytesIOr�zipfiler!�infolist�
BadZipfile�
ValueError�	ERROR_MSG)r�fileobj�fr
r
rrVs



&��rc�(eZdZdZ�fdd�Zdd�Z�ZS)r(a�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|i|��dS)Nr)�pop�_param_to_replace�superr(r�r�argsr��	__class__r
rrnszZipFileArgument.__init__cCsJ|durdSt|�d|i}|�|j�r||j�|�dS|||j<dS)Nr!)r�getrF�update)r�
parametersr�zip_file_paramr
r
r�
add_to_paramsrszZipFileArgument.add_to_params�r3r4r5r6rrP�
__classcell__r
r
rJrr(esr(crD)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.
    cs2tt|�j|i|��d|d|_|d|_dS)Nz--%srr)rGr,r�	_cli_namerFrHrJr
rr�sz ReplacedZipFileArgument.__init__cCsZ|durdS|�|�}d|vrtd|j��|�|j�r&||j�|�dS|||j<dS)Nr!zyZipFile cannot be provided as part of the %s argument.  Please use the '--zip-file' option instead to specify a zip file.)�_unpack_argumentr@rSrLrFrM)rrNr�unpackedr
r
rrP�s
��z%ReplacedZipFileArgument.add_to_paramsrQr
r
rJrr,}sr,)r=r)�
contextlibrr;�awscli.argumentsrrrAr&rr�objectrr
rr(r,r
r
r
r�<module>s ��