File: //usr/lib/google-cloud-sdk/lib/surface/artifacts/go/__pycache__/auth.cpython-312.pyc
�
��Z
� �� � d Z ddlmZ ddlmZ ddlmZ ddlmZ ej ej ej j � G d� dej � � � Z
y) z8Implements commands for the GOAUTH environment variable.� )�base)�
endpoint_util)�go_util)�logc �0 � e Zd ZdZddd�Zed� � Zd� Zy)�Autha\ Print authentication commands for the GOAUTH environment variable.
This command implements the GOAUTH credential provider command introduced in
Go 1.24. For more details about the GOAUTH environment variable, see
https://pkg.go.dev/cmd/go#hdr-GOAUTH_environment_variable. When you configure
the GOAUTH environment variable for repositories, Artifact Registry looks for
credentials in the following order:
* Application Default Credentials (ADC)
* Credentials provided by the Google Cloud CLI, including user credentials
from the command `gcloud auth application-default login`.
z
{description}a� To configure the GOAUTH environment variable for repositories in `us-central1` and use your credentials:
$ export GOAUTH="{command} --location=us-central1"
To configure the GOAUTH environment variable for repositories in `us-central1` and use the credentials from a service account:
$ export GOAUTH="{command} --location=us-central1 --json-key=path/to/key.json"
)�DESCRIPTION�EXAMPLESc �~ � | j ddd�� | j dddd� � | j d
dd�
� y)z\Set up arguements for this command.
Args:
parser: An argparse.ArgumentPaser.
�url�*z/A URL generated by Go to set up authentication.)�nargs�helpz
--location�LOCATIONTz5The location of the repository to print commands for.)�metavar�requiredr z
--json-key�JSON_KEYz�The path to the JSON key file to use for authentication. If not specified, the authentication commands printed will use the token from the logged in user.)r r N)�add_argument)�parsers � lib/surface/artifacts/go/auth.py�Argsz Auth.Args7 sa � � ���
��
>� � �
������
D� � � �����
(� � � c � � t j |j ddd�� }t j |j
� }t j j |� t j j d� t j j |� t j j d� y)zRun the go goauth command.�goF�https)�rep�protocol� N) r �ArtifactRegistryDomainEndpoint�locationr �AuthorizationHeader�json_keyr �out�Print)�self�args�url_line�header_lines r �RunzAuth.RunV sw � � �;�;��
�
�t����H� �-�-�d�m�m�<�K��G�G�M�M�(���G�G�M�M�"���G�G�M�M�+���G�G�M�M�"�r N)�__name__�
__module__�__qualname__�__doc__�
detailed_help�staticmethodr r) � r r r r s1 � �� ��
�-� �� ��<
r r N)r- �googlecloudsdk.callioper �$googlecloudsdk.command_lib.artifactsr r �googlecloudsdk.corer �DefaultUniverseOnly�
ReleaseTracks�ReleaseTrack�GA�Commandr r0 r r �<module>r9 s_ �� ?� (� >� 8� #� �������D�%�%�(�(�)�G�4�<�<� G� *� �Gr