
    d9                     V   S r SSKJr  SSKJr  SSKJr  SSSSS	.rS0S
 jr    S1S jrS2S jr	    S1S jr
S rS rS2S jrS rS rS rS rS r    S3S jrS rS rS rS rS r     S4S jrS rS rS  rS! rS" rS# rS$ r S% r!S& r"S' r#S( r$S) r%S* r&S+ r'S, r(S- r)S. r*S/ r+g)5z'Command line flags for Anthos commands.    )arg_parsers)base)fileszpperform a structural comparison of the original/updated Resources, and merge the changes into the local package.zMfail without updating if the local package was modified since it was fetched.zuse 'git format-patch' and 'git am' to apply a patch of the changes between the source version and destination version. Requires the local package to have been committed to a local git repo.zThis will wipe all local changes to the package. Deletes the contents of local package from PACKAGE_DIR and replace them with the remote )zresource-mergezfast-forwardzalpha-git-patchzforce-delete-replacec                    U R                  SS5      R                  5       nU(       a  UnUR                  SS5        O/SR                  U R                  SS5      R	                  5       5      nU(       d  X2S'   [
        R                  " U40 UD6$ )z9Return argument called name as either flag or positional.-_requiredNz--{}dest)replaceupperpopformatlowerr   Argument)name
positionalkwargsr
   flags        .lib/googlecloudsdk/command_lib/anthos/flags.pyGetFlagOrPositionalr   &   sq    	c3		%	%	'$D
JJz4 ==c3/5578D	6N	t	&v	&&    Nc                 D    U=(       d    SnU(       d  Sn[        SU UUUS9$ )zGet REPO_URI flag.a        Git repository URI containing 1 or more packages as where:

      * REPO_URI - URI of a git repository containing 1 or more packages as
        subdirectories. In most cases the .git suffix should be specified to
        delimit the REPO_URI from the PKG_PATH, but this is not required for
        widely recognized repo prefixes.  If REPO_URI cannot be parsed then
        an error will be printed an asking for '.git' to be specified
        as part of the argument. e.g. https://github.com/kubernetes/examples.git

      * PKG_PATH (optional) - Path to Git subdirectory containing Anthos package files.
       Uses '/' as the path separator (regardless of OS). e.g. staging/cockroachdb.
       Defaults to the root directory.

      * GIT_REF (optional)- A git tag, branch, ref or commit for the remote version of the
        package to fetch. Defaults to the repository default branch e.g. @main
  z#REPO_URI[.git]/[PKG_PATH][@GIT_REF]repo_urir   r   r	   helpmetavarr   r   r	   help_overrider   help_txts        r   GetRepoURIFlagr!   3   s9    
   (" 
3G	
 r   c                     [        SSSSU S9$ )Npackage_pathFz      Path to remote subdirectory containing Kubernetes Resource configuration
      files or directories.
      Defaults to the root directory.
      Uses '/' as the path separator (regardless of OS).
      e.g. staging/cockroachdb
      r   r   )r   s    r   GetPackagePathFlagr$   S   s"    	
 
 r   c           	      <    U=(       d    Sn[        SU U[        UUS9$ )z!Get Local Package directory flag.a        The local directory to fetch the package to.
      e.g. ./my-cockroachdb-copy
      * If the directory does NOT exist: create the specified directory
        and write the package contents to it

      * If the directory DOES exist: create a NEW directory under the
        specified one, defaulting the name to the Base of REPO/PKG_PATH

      * If the directory DOES exist and already contains a directory with
        the same name of the one that would be created: fail
      	LOCAL_DIR)r   r   r	   typer   r   r   ExpandLocalDirAndVersionr   s        r   GetLocalDirFlagr*   b   s4    
  
 
( 
#
 r   c                      [        SSSSS9$ )NpatternFz      Pattern to use for writing files. May contain the following formatting
      verbs %n: metadata.name, %s: metadata.namespace, %k: kind
      (default "%n_%k.yaml")
      )r   r   r	   r   r    r   r   GetFilePatternFlagr.   |   s    	
	
 r   c                  8    [         R                  " SS[        SS9$ )Nz
--strategyFz6Controls how changes to the local package are handled.)r	   choicesr   )r   r   _MERGE_STRATEGIESr-   r   r   GetStrategyFlagr2      s!    	C	
E Er   c                 F    U =(       d    Sn[         R                  " SSSUS9$ )Nz]If true and command fails print the underlying command that was executed and its exit status.z	--dry-run
store_trueFactionr	   r   r   r   )r   r    s     r   GetDryRunFlagr8      s/     3  2( 
,X
G Gr   c                  .    [         R                  " SSSS9$ )Nz--descriptionFzDescription of the Package.r	   r   r7   r-   r   r   GetDescriptionFlagr;      s    	,I
K Kr   c                  .    [         R                  " SSSS9$ )Nz--nameFzName of the package.r:   r7   r-   r   r   GetNameFlagr=      s    	x%6L	MMr   c                  X    [         R                  " SS[        R                  " 5       SSS9$ )Nz--tagsFz	TAG=VALUEzTags for the package.)r	   r'   r   r   )r   r   r   ArgDictr-   r   r   GetTagsFlagr@      s+    	 "
$ $r   c                  .    [         R                  " SSSS9$ )Nz
--info-urlFz%Url with more info about the package.r:   r7   r-   r   r   GetInfoUrlFlagrB      s    	2
4 4r   c                     U (       a  U R                  S5      OSn[        R                  " US   5      n[        U5      S:X  a  USUS   -   -  nU$ )zExpand HOME relative (~) directory with optional git_ref.

Args:
    directory: str, directory path in the format PATH[/][@git_ref].

Returns:
    str, expanded full directory path with git_ref (if provided)
@ r         )splitr   ExpandHomeDirlen)	directorypathfull_dirs      r   r)   r)      sL     "+	$  a)(Y!^d1gH	/r   c                 2    U=(       d    Sn[        SU UUUS9$ )z#Anthos operation cluster name flag.zpCluster to authenticate against. If no cluster is specified, the command will print a list of available options.CLUSTERr   r   r   s        r   GetClusterFlagrP      s1    
  8  7( 

 r   c                  .    [         R                  " SSSS9$ )Nz--login-configFzMSpecifies the configuration yaml file for login. Can be a file path or a URL.r:   r7   r-   r   r   GetLoginConfigFlagrR      s    	5
6 6r   c                  8    [         R                  " SS[        SS9$ )Nz--login-config-certFzuSpecifies the CA certificate file to be added to trusted pool for making HTTPS connections to a `--login-config` URL.r	   r'   r   r   r   r)   r-   r   r   GetLoginConfigCertFlagrV      s$    	#@	
A Ar   c                  .    [         R                  " SSSS9$ )N--userFzyIf configuring multiple user accounts in the same kubecconfig file, you can specify a user to differentiate between them.r:   r7   r-   r   r   GetUserFlagrY      s!    	D
E Er   c                  0    [         R                  " SSSSS9$ )Nz--set-preferred-authFr4   zCIf set, forces update of preferred authentication for given cluster)r	   r6   r   r7   r-   r   r   !GetSetPreferredAuthenticationFlagr[      s!    	)	
* *r   c                  .    [         R                  " SSSS9$ )Nz--serverFzGSpecifies the URL of API server of the cluster to authenticate against.r:   r7   r-   r   r   GetServerFlagr]      s    		
 r   c           
      >    U=(       d    Sn[        SU U[        UUUS9$ )z-Anthos operation local output directory flag.z[The output directory of the cluster resources. If empty will export files to ./CLUSTER_NAMEOUTPUT_DIRECTORY)r   r   r	   r'   r   defaultr   r(   )r   r	   r   r   r`   r    s         r   GetOutputDirFlagra      s7      P  O(	#
 r   c                  .    [         R                  " SSSS9$ )zAnthos location flag.z
--locationFzgSpecifies the Google Cloud location to use. If notspecified will use the current compute/zone property.r:   r7   r-   r   r   GetLocationFlagrc     s    	>
? ?r   c                  .    [         R                  " SSSS9$ )z+Anthos create-login-config Merge-From flag.z--merge-fromFzNSpecifies the file path of an existing login configuration file to merge with.r:   r7   r-   r   r   GetMergeFromFlagre     s    	*
+ +r   c                  8    [         R                  " SS[        SS9$ )z'Anthos create-login-config output flag.z--outputFzXDestination to write login configuration file. Defaults to "kubectl-anthos-config.yaml".rT   rU   r-   r   r   GetConfigOutputFileFlagrg   $  s!    	#2	
3 3r   c                  4    [         R                  " SSSS/SS9$ )zGAnthos auth token type flag, specifies the type of token to be created.z--typeTawsoidczType of token to be created.)r	   r0   help_str)r   ChoiceArgumentr-   r   r   GetTypeFlagrm   /  s%    			fo-	
/ /r   c                  .    [         R                  " SSSS9$ )zhAnthos auth token aws-sts-region flag, specifies the region for AWS STS endpoint for creating AWS token.z--aws-sts-regionFzRegion for AWS STS endpoint.r:   r7   r-   r   r   GetAwsStsRegionFlagro   8  s    	5/M
O Or   c                  .    [         R                  " SSSS9$ )zNAnthos auth token cluster flag, specifies cluster name for creating AWS token.z	--clusterFz/Name of the cluster for which token is created.r:   r7   r-   r   r   GetTokenClusterFlagrq   >  s    	<
> >r   c                  .    [         R                  " SSSS9$ )zqAnthos auth token id-token flag, specifies the ID Token received from identity provider after authorization flow.z
--id-tokenFzBID Token received from identity provider after authorization flow.r:   r7   r-   r   r   GetIdTokenFlagrs   F  s    	O
Q Qr   c                  .    [         R                  " SSSS9$ )zyAnthos auth token access-token flag, specifies the Access Token received from identity provider after authorization flow.z--access-tokenFzFAccess Token received from identity provider after authorization flow.r:   r7   r-   r   r   GetAccessTokenFlagru   N  s    		
 r   c                  .    [         R                  " SSSS9$ )zAnthos auth token access-token-expiry flag, specifies the Expiration time of access token received from identity provider after authorization flow.z--access-token-expiryFzExpiration time of access token received from identity provider after authorization flow. The expected format is the number of seconds elapsed since January 1, 1970 UTC.r:   r7   r-   r   r   GetAccessTokenExpiryFlagrw   Z  s    	8	
 r   c                  .    [         R                  " SSSS9$ )z{Anthos auth token refresh-token flag, specifies the Refresh Token received from identity provider after authorization flow.z--refresh-tokenFzGRefresh Token received from identity provider after authorization flow.r:   r7   r-   r   r   GetRefreshTokenFlagry   g  s    		
 r   c                  .    [         R                  " SSSS9$ )z_Anthos auth token client-id flag, specifies the ClientID is the id for OIDC client application.z--client-idFz/ClientID is the id for OIDC client application.r:   r7   r-   r   r   GetClientIdFlagr{   s  s    	<
> >r   c                  .    [         R                  " SSSS9$ )zAnthos auth token client-secret flag, specifies the Client Secret is the shared secret between OIDC client application and OIDC provider.z--client-secretFzUClient Secret is the shared secret between OIDC client application and OIDC provider.r:   r7   r-   r   r   GetClientSecretFlagr}   {  s    	 	
 r   c                  .    [         R                  " SSSS9$ )zAnthos auth token idp-certificate-authority-data flag, specifies the PEM-encoded certificate authority certificate for OIDC provider.z --idp-certificate-authority-dataFz@PEM-encoded certificate authority certificate for OIDC provider.r:   r7   r-   r   r   "GetIdpCertificateAuthorityDataFlagr     s    	(M
O Or   c                  .    [         R                  " SSSS9$ )zOAnthos auth token idp-issuer-url flag, specifies the URI for the OIDC provider.z--idp-issuer-urlFzeURI for the OIDC provider. This URI should point to the level below .well-known/openid-configuration.r:   r7   r-   r   r   GetIdpIssuerUrlFlagr     s    	/	
 r   c                  .    [         R                  " SSSS9$ )zAnthos auth token kubeconfig-path flag, specifies the Path to the kubeconfig path that would be updated with ID and access token on expiry.z--kubeconfig-pathFzUPath to the kubeconfig path that would be updated with ID and access token on expiry.r:   r7   r-   r   r   GetKubeconfigPathFlagr     s    		
 r   c                  .    [         R                  " SSSS9$ )zCAnthos auth token user flag, specifies the User used in kubeconfig.rX   FzUser used in kubeconfig.r:   r7   r-   r   r   GetTokenUserFlagr     s    	%?
 r   c                  0    [         R                  " SSSSS9$ )zuUsed to start authentication on a device without a browser in order to perform login on a second device with browser.z--no-browserr4   Fz^Option to indicate login completion on a second device with browser.Used with `server` option.r5   r7   r-   r   r   GetNoBrowserFlagr     s!    	'
 r   c                  .    [         R                  " SSSS9$ )z|Used to complete authentication that was started on a remote device without a browser, on the current device with a browser.z--remote-bootstrapFzsOption to complete login that was started using `no-browser` optionon a remote device that does not have a browser.r:   r7   r-   r   r   GetRemoteBootstrapFlagr     s    	=	
 r   )F)TTNN)N)FFNN)FFNz
OUTPUT-DIRN),__doc__googlecloudsdk.callioper   r   googlecloudsdk.core.utilr   r1   r   r!   r$   r*   r.   r2   r8   r;   r=   r@   rB   r)   rP   rR   rV   rY   r[   r]   ra   rc   re   rg   rm   ro   rq   rs   ru   rw   ry   r{   r}   r   r   r   r   r   r   r-   r   r   <module>r      s1   . 0 ( *1.CM  
' # !%@  $!"& 4	EGK
N$4$ $!!% 6AE* !&##')!	$?+3/O>Q	
	>	O		
	r   