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

�T_��@s�ddlZddlZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
dd	�Zd
d�ZGdd
�d
e�ZGdd�de	�ZdS)�N)�
xform_name)�Stubber)�ArgumentGenerator)�CLIOperationCaller)�OverrideRequiredArgsArgument)�json_encodercCs|jdt�dS)Nzbuilding-argument-table)�register�add_generate_skeleton)Zcli�r
�)/usr/lib/python3.6/generatecliskeleton.py�register_generate_cli_skeletonsrcKs d|krt||�}|j|�dS)NZoutfile)�GenerateCliSkeletonArgumentZadd_to_arg_table)�session�operation_model�argument_table�kwargsZgenerate_cli_skeleton_argumentr
r
rr	sr	csTeZdZdZddddddgd�Z�fdd	�Z�fd
d�Z�fdd
�Zdd�Z�Z	S)r
z�This argument writes a generated JSON skeleton to stdout

    The argument, if present in the command line, will prevent the intended
    command from taking place. Instead, it will generate a JSON skeleton and
    print it to standard output.
    zgenerate-cli-skeletonaJPrints a JSON skeleton to standard output without sending an API request. If provided with no value or the value ``input``, prints a sample input JSON that can be used as an argument for ``--cli-input-json``. If provided with the value ``output``, it validates the command inputs and returns a sample output JSON for that command.�?�input�output)�nameZ	help_text�nargs�const�choicescstt|�j|�||_dS)N)�superr
�__init__�_operation_model)�selfrr)�	__class__r
rr<sz$GenerateCliSkeletonArgument.__init__cs"|jjd|j�tt|�j�dS)Nzcalling-command.*)�_sessionr�generate_json_skeletonrr
�_register_argument_action)r)rr
rr @s
z5GenerateCliSkeletonArgument._register_argument_actioncsdd|j}||kr`|j|�}y||ddkr2dSWntk
rHYnXtt|�j||f|�dS)Nz--�r)r�index�
IndexErrorrr
�override_required_args)rr�argsrZarg_nameZarg_location)rr
rr$Es


z2GenerateCliSkeletonArgument.override_required_argscKs�t|dd�r�|jdk}|j}|rD|jj}|j}t|j�j||||�St	�}	|j
}
|
dkr^i}n
|	j|
�}tj
jtj|dtd��tj
jd�dSdS)N�generate_cli_skeletonr�)�indent�default�
r)�getattrr&r�
service_model�service_namer�StubbedCLIOperationCallerrZinvokerZinput_shape�generate_skeleton�sys�stdout�write�json�dumpsr)rZcall_parametersZparsed_args�parsed_globalsrZ
for_outputrr-�operation_name�argument_generatorZoperation_input_shapeZskeletonr
r
rrUs&

z2GenerateCliSkeletonArgument.generate_json_skeleton)
�__name__�
__module__�__qualname__�__doc__ZARG_DATArr r$r�
__classcell__r
r
)rrr
&sr
c@seZdZdZdd�ZdS)r.z�A stubbed CLIOperationCaller

    It generates a fake response and uses the response and provided parameters
    to make a stubbed client call for an operation command.
    c

Csft|�}|jjj|�}i}|jr6tdd�}|j|j�}t|��}	|	j||�t	||�f|�SQRXdS)NT)Zuse_member_names)
r�metar,rZoutput_shaperr/rZadd_responser+)
rZclientr6Z
parametersr5Zmethod_namerZ
fake_responser7Zstubberr
r
r�_make_client_call{s

z+StubbedCLIOperationCaller._make_client_callN)r8r9r:r;r>r
r
r
rr.usr.)r3r0ZbotocorerZ
botocore.stubrZbotocore.utilsrZawscli.clidriverrZawscli.customizations.argumentsrZawscli.utilsrrr	r
r.r
r
r
r�<module>
s	O