
    Z                         S r SSKJr  SSKJr  SSKJr  SSKJr  \R                  \R                  " \R                  R                  5       " S S\R                  5      5       5       rg)	z8Implements commands for the GOAUTH environment variable.    )base)endpoint_util)go_util)logc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
Auth   aJ  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                 l    U R                  SSSS9  U R                  SSSSS	9  U R                  S
SSS9  g)zPSet 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_KEYzThe 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Args	Auth.Args7   sa     >  
 D	   (	      c                 ~   [         R                  " UR                  SSSS9n[        R                  " UR
                  5      n[        R                  R                  U5        [        R                  R                  S5        [        R                  R                  U5        [        R                  R                  S5        g)zRun the go goauth command.goFhttps)repprotocol N)	r   ArtifactRegistryDomainEndpointlocationr   AuthorizationHeaderjson_keyr   outPrint)selfargsurl_lineheader_lines       r   RunAuth.RunV   sw     ;;tH --dmm<KGGMM(GGMM"GGMM+GGMM"r    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r+   __static_attributes__r-   r   r   r   r      s1      	-  <
r   r   N)r2   googlecloudsdk.callioper   $googlecloudsdk.command_lib.artifactsr   r   googlecloudsdk.corer   DefaultUniverseOnlyReleaseTracksReleaseTrackGACommandr   r-   r   r   <module>r>      s]    ? ( > 8 # D%%(()G4<< G * Gr   