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__/codecommit.cpython-310.pyc
o

.&�a?�@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)�cli�r
�B/usr/lib/python3/dist-packages/awscli/customizations/codecommit.py�
initialize�rcKst|�|d<dS)z>
    Injects new commands into the codecommit subcommand.
    �credential-helperN)�CodeCommitCommand)�
command_table�session�kwargsr
r
rr%r
rc@�(eZdZdZdZdZdZdZdd�ZdS)	�CodeCommitNoOpStoreCommand�storezAThis operation does nothing, credentials are calculated each timez&aws codecommit credential-helper store�TcC�dS�Nrr
��self�args�parsed_globalsr
r
r�	_run_main4�z$CodeCommitNoOpStoreCommand._run_mainN�	�__name__�
__module__�__qualname__�NAME�DESCRIPTION�SYNOPSIS�EXAMPLES�
_UNDOCUMENTEDrr
r
r
rr,�rc@r)	�CodeCommitNoOpEraseCommand�erasez;This operation does nothing, no credentials are ever storedz&aws codecommit credential-helper eraserTcCrrr
rr
r
rr@rz$CodeCommitNoOpEraseCommand._run_mainNrr
r
r
rr)8r(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�default�
group_name�	help_textcstt|��|�dS)N)�superr+�__init__)rr��	__class__r
rr4]szCodeCommitGetCommand.__init__cCsV|��}d|dvsd|dvs|jr)|�|�}|�||�}|�||�}|�|�dS)Nz
amazon.com�hostz
amazonaws.comr)�read_git_parameters�ignore_host_check�extract_url�extract_region�sign_request�write_git_parameters)rrr�git_parameters�theUrl�region�	signaturer
r
rr`s�

zCodeCommitGetCommand._run_maincCs�|j��j}|j��jdur|d|j��j7}t��)}|�d�|��t�d|�|�d�|��|�	�t�d|�Wd�dS1sGwYdS)N�%z
username={0}
zusername
%sz
password={0}
zsignature
%s)
�_session�get_credentials�
access_key�tokenr�write�format�logger�debug�flush)rrA�username�
binary_stdoutr
r
rr=ks"�z)CodeCommitGetCommand.write_git_parameterscCs8i}tjD]}|��}|r|�dd�\}}|||<q|S)N�=�)�sys�stdin�strip�split)r�parsed�line�key�valuer
r
rr8zs
�z(CodeCommitGetCommand.read_git_parameterscCsd�|d|d|d�}|S)Nz
{0}://{1}/{2}�protocolr7�path)rH)r�
parameters�urlr
r
rr:�s

�z CodeCommitGetCommand.extract_urlcCs>t�d|d�}|dur|�d�S|jdur|jS|j�d�S)NzD(vpce-.+\.)?git-codecommit(-fips)?\.([^.]+)\.(vpce\.)?amazonaws\.comr7�r@)�re�match�groupr@rC�get_config_variable)rrZrr^r
r
rr;�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)
N�
codecommit�GITz
%Y%m%dT%H%M%S�	timestamp�:rz{0}
{1}

host:{2}

host
z$Calculating signature using v4 auth.zCanonicalRequest:
%szStringToSign:
%sz
Signature:
%sz{0}Z{1})rCrDrrr[�method�datetime�utcnow�strftime�contextr�netlocrSrHrYrIrJ�string_to_signrA)rr@�url_to_sign�credentials�signer�request�nowrS�hostname�canonical_requestrkrAr
r
rr<�s*


�
z!CodeCommitGetCommand.sign_request)r r!r"r#r$r%r&�	ARG_TABLEr4rr=r8r:r;r<�
__classcell__r
r
r5rr+Ds&��
	
r+c@s@eZdZdZdZdZded�ded�ded�gZ	dZ
d	d
�ZdS)rrz aws codecommit credential-helperrr,)r.�
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 detailscCstd��)Nziusage: aws [options] codecommit credential-helper <subcommand> [parameters]
aws: error: too few arguments)�
ValueErrorrr
r
rr�szCodeCommitCommand._run_mainN)r r!r"r#r%r&r+rr)�SUBCOMMANDSr$rr
r
r
rr�s�	r)�osr]rP�logging�	fileinputrf�
botocore.authr�botocore.awsrequestr�botocore.compatr�awscli.customizations.commandsr�
awscli.compatr�	getLoggerrIrrrr)r+rr
r
r
r�<module>s$

g