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

<�^?�@s�ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZe�d�Zdd	�Zd
d�ZGdd
�d
e
�ZGdd�de
�ZGdd�de
�ZGdd�de
�ZdS)�N)�	SigV4Auth)�
AWSRequest)�urlsplit)�BasicCommand)�NonTranslatedStdoutzbotocore.credentialscCs|�dt�dS)z3
    The entry point for the credential helper
    z!building-command-table.codecommitN)�register�inject_commands)Zcli�r	�B/usr/lib/python3/dist-packages/awscli/customizations/codecommit.py�
initializesrcKst|�|d<dS)z>
    Injects new commands into the codecommit subcommand.
    �credential-helperN)�CodeCommitCommand)Z
command_table�session�kwargsr	r	r
r%src@s(eZdZdZdZdZdZdZdd�ZdS)	�CodeCommitNoOpStoreCommand�storezAThis operation does nothing, credentials are calculated each timez&aws codecommit credential-helper store�TcCsdS�Nrr	��self�args�parsed_globalsr	r	r
�	_run_main4sz$CodeCommitNoOpStoreCommand._run_mainN�	�__name__�
__module__�__qualname__�NAME�DESCRIPTION�SYNOPSIS�EXAMPLESZ
_UNDOCUMENTEDrr	r	r	r
r,src@s(eZdZdZdZdZdZdZdd�ZdS)	�CodeCommitNoOpEraseCommand�erasez;This operation does nothing, no credentials are ever storedz&aws codecommit credential-helper eraserTcCsdSrr	rr	r	r
r@sz$CodeCommitNoOpEraseCommand._run_mainNrr	r	r	r
r!8sr!csneZdZdZdZdZdZdddddd	�gZ�fd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Z�ZS)�CodeCommitGetCommand�getz�get a username SigV4 credential pair based on protocol, host and path provided from standard in. This is primarily called by git to generate credentials to authenticate against AWS CodeCommitz$aws codecommit credential-helper getz�echo -e "protocol=https\\npath=/v1/repos/myrepo\\nhost=git-codecommit.us-east-1.amazonaws.com" | aws codecommit credential-helper getzignore-host-check�
store_trueFzTOptional. Generate credentials regardless of whether the domain is an Amazon domain.)�name�action�defaultZ
group_nameZ	help_textcstt|��|�dS)N)�superr#�__init__)rr��	__class__r	r
r*]szCodeCommitGetCommand.__init__cCsV|��}d|dks&d|dks&|jrR|�|�}|�||�}|�||�}|�|�dS)Nz
amazon.com�hostz
amazonaws.comr)�read_git_parametersZignore_host_check�extract_url�extract_region�sign_request�write_git_parameters)rrrZgit_parametersZtheUrl�region�	signaturer	r	r
r`s
��

zCodeCommitGetCommand._run_mainc	Cs�|j��j}|j��jdk	r0|d|j��j7}t��F}|�d�|��t�d|�|�d�|��|�	�t�d|�W5QRXdS)N�%z
username={0}
zusername
%sz
password={0}
zsignature
%s)
�_session�get_credentialsZ
access_key�tokenr�write�format�logger�debug�flush)rr4ZusernameZ
binary_stdoutr	r	r
r2ksz)CodeCommitGetCommand.write_git_parameterscCs8i}tjD](}|��}|r
|�dd�\}}|||<q
|S)N�=�)�sys�stdin�strip�split)rZparsed�line�key�valuer	r	r
r.zs

z(CodeCommitGetCommand.read_git_parameterscCsd�|d|d|d�}|S)Nz
{0}://{1}/{2}Zprotocolr-�path)r:)r�
parameters�urlr	r	r
r/�s

�z CodeCommitGetCommand.extract_urlcCsBt�d|d�}|dk	r"|�d�S|jdk	r2|jS|j�d�SdS)NzD(vpce-.+\.)?git-codecommit(-fips)?\.([^.]+)\.(vpce\.)?amazonaws\.comr-�r3)�re�match�groupr3r6Zget_config_variable)rrHrrLr	r	r
r0�s�

z#CodeCommitGetCommand.extract_regioncCs�|j��}t|d|�}t�}||_d|_tj��}|�d�|j	d<t
|j�}|j�d�d}d�
|j|j|�}	t�d�t�d	|	�|�||	�}
t�d
|
�|�|
|�}t�d|�d�
|j	d|�S)
NZ
codecommitZGITz
%Y%m%dT%H%M%SZ	timestamp�:rz{0}
{1}

host:{2}

host
z$Calculating signature using v4 auth.zCanonicalRequest:
%szStringToSign:
%sz
Signature:
%sz{0}Z{1})r6r7rrrI�method�datetimeZutcnow�strftime�contextrZnetlocrCr:rGr;r<�string_to_signr4)rr3Zurl_to_signZcredentialsZsignerZrequestZnowrCZhostnameZcanonical_requestrSr4r	r	r
r1�s*


�
z!CodeCommitGetCommand.sign_request)rrrrrrr Z	ARG_TABLEr*rr2r.r/r0r1�
__classcell__r	r	r+r
r#Ds$��
	
r#c@s@eZdZdZdZdZded�ded�ded�gZ	dZ
d	d
�ZdS)r
rz aws codecommit credential-helperrr$)r&Z
command_classrr"a#Provide a SigV4 compatible user name and password for git smart HTTP  These commands are consumed by git and should not used directly. Erase and Store are no-ops. Get is operation to generate credentials to authenticate AWS CodeCommit. Run "aws codecommit credential-helper help" for detailscCstd��dS)Nziusage: aws [options] codecommit credential-helper <subcommand> [parameters]
aws: error: too few arguments)�
ValueErrorrr	r	r
r�szCodeCommitCommand._run_mainN)rrrrrr r#rr!ZSUBCOMMANDSrrr	r	r	r
r
�s�	r
)�osrKr@ZloggingZ	fileinputrPZ
botocore.authrZbotocore.awsrequestrZbotocore.compatrZawscli.customizations.commandsrZ
awscli.compatrZ	getLoggerr;rrrr!r#r
r	r	r	r
�<module>s"
g