
    g                     
	   S r SSKJr  SSKJr  SSKJr  SSKrSSKrSSKrSSKrSSK	J
r
  SSKrSSKrSSKrSSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKr \R
                  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+Sr,S r-S!r.S"r/S#r0S$r1S%r2S&r3S'r4S(r5S)r6S*r7S+r8S,r9S-r:S.r;S/r<S0r=S1r>S2r?S,r9S3r@S4rAS5rBS6rCS7rDS8rES9rFS:rG " S; S<\R                  5      rI\R                   " S= S>\R                  5      5       rL " S? S@\R                  " \R                  \O5      5      rP " SA SB\P5      rQ " SC SD\P5      rRSErS\R" SFSGS\SSHSI9rT\R" SJSKS\R                  " 5       \SSLSM9rV\R" SNS\SSOR                  SPR                  \R                  " 5       5      5      SQ9rZSRr[\R" SSSTSUSVSW9r\\R" SXSYSZ\[S[S\9r]\R" S]\R                  " S^\R                  S_S`9SZ\[SaSb9r`\R" Sc\R                  " S^\R                  S_S`9SZ\[SdSb9ra\R" SeSf\R                  " 5       SZ\[SgSh9rb\R" SiSTSZ\[SjSk9rcSlrd\R" SmS_STSZ\dSnSo9re " Sp Sq\R                  " \R                  \O5      5      rf " Sr Ss\f5      rg " St Su\R                  " \R                  \f5      5      rh " Sv Sw\R                  " \R                  \h5      5      ri " Sx Sy\R                  " \R                  \h5      5      rj " Sz S{\R                  " \R                  \h5      5      rk " S| S}\R                  " \R                  \h5      5      rl " S~ S\R                  " \R                  \h5      5      rm " S S\R                  " \R                  \h5      5      rn " S S\R                  " \R                  \h5      5      ro " S S\R                  " \R                  \h5      5      rp " S S\R                  " \R                  \p5      5      rq " S S\p\j5      rr " S S\p\j5      rs " S S\p\j5      rt " S S\j5      ruS rvS rwS rxS ryS rzS r{S r|S r}S r~S rS r   SS jrS rS r        SS jr\GR
                  S 5       rS rS rS rS rS rS rS rS rS rS rS rg! \ a    \r GNf = f)z.Base classes for calliope commands and groups.    )absolute_import)division)unicode_literalsNwraps)arg_parsers)display)
exceptions)log)
properties)resource_printerBackupRestorezAI and Machine Learningz	Vertex AIzAI Platform TensorboardzAPI Platform and Ecosystemsz
Anthos CLIzAnthos Authz
App EngineBatchComposerComputezData Analytics	Databasesz	GDCc ZonezIdentity and SecurityzInternet of ThingszManagement ToolsMobile
NetworkingzNetwork Securityz	SDK ToolsDisksInfo	InstanceszLoad BalancingToolsStorageTransferBillingSecurityIdentityzBig DatazCI/CD
Monitoring	Solutions
ServerlessOtherCommercezDeclarative Resource ManagementMicroservicesWeb3SaaS*_`c                       \ rS rSrSrSrg)DeprecationExceptiona   z=An exception for when a command or group has been deprecated. N__name__
__module____qualname____firstlineno____doc____static_attributes__r-       #lib/googlecloudsdk/calliope/base.pyr+   r+   a   s    Er5   r+   c                       \ rS rSrSrS rS r\S 5       rSr	SSR                  \5      S	4rS
SR                  \5      S4rSSR                  \5      S4r\S 5       r\S 5       r\S 5       rSrg)ReleaseTracke   a:  An enum representing the release track of a command or command group.

The release track controls where a command appears.  The default of GA means
it will show up under gcloud.  If you enable a command or group for the alpha,
beta, or preview tracks, those commands will be duplicated under those groups
as well.
c                 (    Xl         X l        X0l        g N)prefixhelp_tag	help_note)selfr<   r=   r>   s       r6   __init__ReleaseTrack.__init__o   s    KMNr5   c                     U R                   $ r;   namer?   s    r6   __str__ReleaseTrack.__str__t   s    99r5   c                     U R                   $ r;   rC   rE   s    r6   idReleaseTrack.idw   s    99r5   )NNNpreviewz{0}(PREVIEW){0} zThis command is currently in DEVELOPER PREVIEW and may change without notice. If this command fails with API permission errors despite specifying the correct project, you might be trying to access an API with an invitation-only early access allowlist.betaz{0}(BETA){0} zBThis command is currently in beta and might change without notice.alphaz{0}(ALPHA){0} zThis command is currently in alpha and might change without notice. If this command fails with API permission errors despite specifying the correct project, you might be trying to access an API with an invitation-only early access allowlist.c                       [        [        5      $ )zFGets all possible enum values.

Returns:
  list, All the enum values.
)listr8   r-   r5   r6   	AllValuesReleaseTrack.AllValues   s     r5   c                 F    [          H  nUR                  U :X  d  M  Us  $    g)zGets a ReleaseTrack from the given release track prefix.

Args:
  prefix: str, The prefix string that might be a release track name.

Returns:
  ReleaseTrack, The corresponding object or None if the prefix was not a
  valid release track.
N)r8   r<   )r<   tracks     r6   
FromPrefixReleaseTrack.FromPrefix   s$     		  r5   c                 f     [         U    $ ! [         a    [        SR                  U 5      5      ef = f)zGets a ReleaseTrack from the given release track prefix.

Args:
  id: str, The id string that must be a release track name.

Raises:
  ValueError: For unknown release track ids.

Returns:
  ReleaseTrack, The corresponding object.
zUnknown release track id [{}].)r8   KeyError
ValueErrorformat)rI   s    r6   FromIdReleaseTrack.FromId   s;    D" D7>>rBCCDs    %0)r>   r=   r<   N)r/   r0   r1   r2   r3   r@   rF   propertyrI   GArY   MARKDOWN_BOLDPREVIEWBETAALPHAstaticmethodrP   rT   rZ   r4   r-   r5   r6   r8   r8   e   s    
   "
 .K		' ]+J
$ m,5		%     D Dr5   r8   c                   ^    \ rS rSrSrS r\S 5       r\R                  S 5       r
S rS rSrg	)
Action   zBA class that allows you to save an Action configuration for reuse.c                     Xl         X l        g)zCreates the Action.

Args:
  *args: The positional args to parser.add_argument.
  **kwargs: The keyword args to parser.add_argument.
Nargskwargs)r?   rh   ri   s      r6   r@   Action.__init__   s     IKr5   c                      U R                   S   $ Nr   )rh   rE   s    r6   rD   Action.name   s    99Q<r5   c                     g)zAdds this Action to the given parser.

Args:
  parser: The argparse parser.

Returns:
  The result of adding the Action to the parser.
Nr-   r?   parsers     r6   AddToParserAction.AddToParser   s     	r5   c                     g)zQRemoves this Action from the given parser.

Args:
  parser: The argparse parser.
Nr-   ro   s     r6   RemoveFromParserAction.RemoveFromParser   s     	r5   c                     g)zSets the default value for this Action in the given parser.

Args:
  parser: The argparse parser.
  default: The default value.
Nr-   )r?   rp   defaults      r6   
SetDefaultAction.SetDefault        	r5   rg   N)r/   r0   r1   r2   r3   r@   r\   rD   abcabstractmethodrq   rt   rx   r4   r-   r5   r6   rd   rd      sB    J   		 				r5   rd   c                   >   ^  \ rS rSrSrU 4S jrS rS rS rSr	U =r
$ )ArgumentGroup   zJA class that allows you to save an argument group configuration for reuse.c                 <   > [         [        U ]
  " U0 UD6  / U l        g r;   )superr~   r@   	argumentsr?   rh   ri   	__class__s      r6   r@   ArgumentGroup.__init__   s    	-'88DNr5   c                 :    U R                   R                  U5        g r;   )r   append)r?   args     r6   AddArgumentArgumentGroup.AddArgument   s    NN#r5   c                 p    U R                  U5      nU R                   H  nUR                  U5        M     U$ )zAdds this argument group to the given parser.

Args:
  parser: The argparse parser.

Returns:
  The result of parser.add_argument().
)_CreateGroupr   rq   )r?   rp   groupr   s       r6   rq   ArgumentGroup.AddToParser   s3     f%E~~	ooe Lr5   c                 N    UR                   " U R                  0 U R                  D6$ r;   )	add_grouprh   ri   ro   s     r6   r   ArgumentGroup._CreateGroup  s     TYY6$++66r5   )r   )r/   r0   r1   r2   r3   r@   r   rq   r   r4   __classcell__r   s   @r6   r~   r~      s    R7 7r5   r~   c                   6    \ rS rSrSrS rS rS rS rS r	Sr
g	)
Argumenti  zDA class that allows you to save an argument configuration for reuse.c                     [         R                  " UR                  UR                  5       H!  nU R                  UR
                  ;   d  M  Us  $    g)z"Returns the flag object in parser.N)	itertoolschain	flag_argsancestor_flag_argsrD   option_strings)r?   rp   flags      r6   	__GetFlagArgument.__GetFlag  s@     0 0&2K2KL	d))	) M r5   c                 N    UR                   " U R                  0 U R                  D6$ )zAdds this argument to the given parser.

Args:
  parser: The argparse parser.

Returns:
  The result of parser.add_argument().
)add_argumentrh   ri   ro   s     r6   rq   Argument.AddToParser  s"     		9T[[99r5   c                    U R                  U5      nU(       GaR  UR                  S   nX24/nSUSS -   n[        R                  " UR                  UR
                  5       H&  nXVR                  ;   d  M  UR                  XV45        M(     UR                  R                  X$5        U H  u  prUR                  R                  UR                  S5        UR                  UR                  ;   a%  UR                  R                  UR                  5        X!R                  ;   a  UR                  R                  U5        X!R                  ;   d  M  UR                  R                  U5        M     gg)zORemoves this flag from the given parser.

Args:
  parser: The argparse parser.
r   z--no-   N)_Argument__GetFlagr   r   r   r   r   r   	container_handle_conflict_resolvedefaultspopdestdestsremover   )r?   rp   r   rD   	conflictsno_nameno_flagr(   s           r6   rt   Argument.RemoveFromParser%  s$    >>&!D  #d<.i$qr("g__


F55' ,,,


G-
.	 nn--d>'!DIIt,99$
,,

dii
(###



!
!$
'###



!
!$
'  r5   c                 ~   U R                  U5      nU(       a  UR                  U0nUR                  " S0 UD6  UR                  n[        R
                  " SU[        R                  5      nU(       a1  SR                  UR                  S5      X&R                  S5      5      nOUSR                  U5      -   nXsl        gg)zSets the default value for this flag in the given parser.

Args:
  parser: The argparse parser.
  default: The default flag value.
z%(.*The default is ).*?(\.([ \t\n].*))z{}*{}*{}   r   z The default is *{}*.Nr-   )	r   r   set_defaultshelpresearchDOTALLrY   r   )r?   rp   rw   r   ri   original_helpmatchnew_helps           r6   rx   Argument.SetDefaultB  s     >>&!D		7#f#F# iimii
2M299e 
$$U[[^Wkk!nM #:#A#A'#JJi r5   c                 2    [        U R                  S   5      $ )Nhidden)boolri   rE   s    r6   IsHiddenArgument.IsHiddenY  s    H%&&r5   r-   N)r/   r0   r1   r2   r3   r   rq   rt   rx   r   r4   r-   r5   r6   r   r     s    L	:(:.'r5   r   zCOMMONLY USEDz--flags-file	YAML_FILEaS          A YAML or JSON file that specifies a *--flag*:*value* dictionary.
        Useful for specifying complex flag values with special characters
        that work with any command interpreter. Additionally, each
        *--flags-file* arg is replaced by its constituent flags. See
        $ gcloud topic flags-file for more information.)metavarrw   categoryr   z	--flattenKEYa          Flatten _name_[] output resource slices in _KEY_ into separate records
        for each item in each slice. Multiple keys and slices may be specified.
        This also flattens keys for *--format* and *--filter*. For example,
        *--flatten=abc.def* flattens *abc.def[].ghi* references to
        *abc.def.ghi*. A resource record containing *abc.def[]* with N elements
        will expand to N records in the flattened output. This allows us to
        specify what `resource-key` the `filter` will operate on. This flag
        interacts with other flags that are applied in this order: *--flatten*,
        *--sort-by*, *--filter*, *--limit*.)r   rw   typer   r   z--formata          Sets the format for printing command output resources. The default is a
        command-specific human-friendly output format. If both `core/format` and
        `--format` are specified, `--format` takes precedence. `--format`
        and `core/format` both take precedence over `core/default_format`. The
        supported formats are limited to: `{0}`. For more details run $ gcloud
        topic formats. Run `$ gcloud config set --help` to see more information
        about `core/format`z`, `)rw   r   r   zLIST COMMANDz--async
store_trueasync_zV    Return immediately, without waiting for the operation in progress to
    complete.)actionr   r   z--filter
EXPRESSIONFa`      Apply a Boolean filter _EXPRESSION_ to each resource item to be listed.
    If the expression evaluates `True`, then that item is listed. For more
    details and examples of filter expressions, run $ gcloud topic filters. This
    flag interacts with other flags that are applied in this order: *--flatten*,
    *--sort-by*, *--filter*, *--limit*.)r   require_coverage_in_testsr   r   z--limitr   T)	unlimitedz    Maximum number of resources to list. The default is *unlimited*.
    This flag interacts with other flags that are applied in this order:
    *--flatten*, *--sort-by*, *--filter*, *--limit*.
    )r   r   r   r   z--page-sizeaM      Some services group resource list output into pages. This flag specifies
    the maximum number of resources per page. The default is determined by the
    service if it supports paging, otherwise it is *unlimited* (no paging).
    Paging may be applied before or after *--filter* and *--limit* depending
    on the service.
    z	--sort-byFIELDa%      Comma-separated list of resource field key names to sort by. The
    default order is ascending. Prefix a field with ``~'' for descending
    order on that field. This flag interacts with other flags that are applied
    in this order: *--flatten*, *--sort-by*, *--filter*, *--limit*.
    )r   r   r   r   r   z--uria      Print a list of resource URIs instead of the default output, and change the
    command output to a list of URIs. If this flag is used with *--format*,
    the formatting is applied on this URI list. To display URIs alongside other
    keys instead, use the *uri()* transform.
    )r   r   r   r   zBINARY BACKED COMMANDz--show-exec-errorz^If true and command fails, print the underlying command that was executed and its exit status.)r   r   requiredr   r   c                   R   \ 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S jr\S 5       r\S 5       r\S	 5       r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\SS j5       r\S 5       r\S 5       r \S 5       r!\S 5       r"Sr#g)_Commoni  z!Base class for Command and Group.NFTc                     SU l         Xl        g rl   	exit_codeis_group)r?   r   s     r6   r@   _Common.__init__  s    DNMr5   c                     g)zPSet up arguments for this command.

Args:
  parser: An argparse.ArgumentParser.
Nr-   rp   s    r6   Args_Common.Args  rz   r5   c                     g)zIAdds subclass flags.

Args:
  parser: An argparse.ArgumentParser object.
Nr-   r   s    r6   _Flags_Common._Flags  rz   r5   c                     U R                   $ r;   
_is_hiddenclss    r6   r   _Common.IsHidden  s    >>r5   c                     U R                   $ )z?Returns whether or not this command or group is auto generated._is_auto_generatedr   s    r6   IsAutoGenerated_Common.IsAutoGenerated  s     !!!r5   c                     U R                   $ r;   _universe_compatibler   s    r6   IsUniverseCompatible_Common.IsUniverseCompatible  s    ###r5   c                     U R                   $ r;   )_default_universe_compatibler   s    r6   IsDefaultUniverseCompatible#_Common.IsDefaultUniverseCompatible!  s    +++r5   c                 F    [         R                  (       a  U R                  $ gNT)sixPY2_is_unicode_supportedr   s    r6   IsUnicodeSupported_Common.IsUnicodeSupported%  s    
ww&&&r5   c                     U R                   $ r;   )_release_trackr   s    r6   r8   _Common.ReleaseTrack,      r5   c                     U R                   $ r;   )_valid_release_tracksr   s    r6   ValidReleaseTracks_Common.ValidReleaseTracks0  s    $$$r5   c                 P   [          H  nX0R                  ;  a  M  / nUR                  US-   UR                  -   5        UR                  (       a!  UR                  US-   UR                  -   5        U H"  n[        X5      (       d  M  [        X5      s  s  $    M     [        XS5      $ )zGets the attribute value from obj for tracks.

The values are checked in ReleaseTrack order.

Args:
  obj: The object to extract attribute from.
  attribute: The attribute name in object.

Returns:
  The attribute value from obj for tracks.
r(   N)r8   r   r   rI   r<   hasattrgetattr)r   obj	attributerS   namesrD   s         r6   GetTrackedAttribute_Common.GetTrackedAttribute4  s     	//	/ell9s?UXX-.	Y_u||34$3#
#   34((r5   c                     U R                   $ r;   _noticesr   s    r6   Notices_Common.NoticesM  s    <<r5   c                 ~    U R                   (       d  0 U l         XR                   ;   a  U(       a  g X R                   U'   g r;   r  )r   tagmsgpreserve_existings       r6   	AddNotice_Common.AddNoticeQ  s,    <<cl
ll0LLr5   c                     U R                   $ r;   _is_deprecatedr   s    r6   
Deprecated_Common.DeprecatedY  r   r5   c                     Xl         g r;   r  )r   is_deprecateds     r6   SetDeprecated_Common.SetDeprecated]  s    &r5   c                 R    U R                   (       a  U R                   R                  $ g)zGet a generator function that can be used to execute a gcloud command.

Returns:
  A bound generator function to execute a gcloud command.
N)_cli_generatorGenerater   s    r6   GetCLIGenerator_Common.GetCLIGeneratora  s"     (((r5   c                 0   [         R                  R                  R                  R	                  5       (       a  gU R                  5       (       aI  U R                  5       U;   a4  [         R                  R                  R                  R                  S5        ggg)a  Enable self signed jwt feature for the given tracks.

The feature can be disabled manually by running
`gcloud config set auth/service_account_use_self_signed_jwt false`.

Args:
  tracks: [base.ReleaseTrack], A list of release tracks where self signed
    jwt feature is enabled.
NT)r   VALUESauth#service_account_use_self_signed_jwtIsExplicitlySetr8   Set)r   trackss     r6   EnableSelfSignedJwtForTracks$_Common.EnableSelfSignedJwtForTracksl  so     	BBRRTT
c..0F:@@DDTJ ;r5   r   )F)$r/   r0   r1   r2   r3   r   r  r   r   r   r   r   r   r   r  r  r@   rb   r   r   classmethodr   r   r   r   r   r8   r   r  r	  r  r  r  r  r&  r4   r-   r5   r6   r   r     s   )(.*.!%(. 	 	 	 	   " " $ $ , ,     % % ) )0       ' '   K Kr5   r   c                   6   ^  \ rS rSrSrSrU 4S jrS rSrU =r	$ )Groupi  z.Group is a base class for groups to implement.Tc                 (   > [         [        U ]  SS9  g )NTr   )r   r*  r@   )r?   r   s    r6   r@   Group.__init__  s    	%.r5   c                     g)a"  Modify the context that will be given to this group's commands when run.

Args:
  context: {str:object}, A set of key-value pairs that can be used for
    common initialization among commands.
  args: argparse.Namespace: The same namespace given to the corresponding
    .Run() invocation.
Nr-   )r?   contextrh   s      r6   FilterGroup.Filter  s     	r5   r-   )
r/   r0   r1   r2   r3   IS_COMMAND_GROUPr@   r0  r4   r   r   s   @r6   r*  r*    s    6/		 		r5   r*  c                      ^  \ rS rSrSrSrU 4S jr\S 5       rS r	\
S 5       r\R                  S 5       rS	 rS
 rS rSrU =r$ )Commandi  a  Command is a base class for commands to implement.

Attributes:
  _cli_do_not_use_directly: calliope.cli.CLI, The CLI object representing this
    command line tool. This should *only* be accessed via commands that
    absolutely *need* introspection of the entire CLI.
  context: {str:object}, A set of key-value pairs that can be used for common
    initialization among commands.
  _uri_cache_enabled: bool, The URI cache enabled state.
Tc                 N   > [         [        U ]  SS9  Xl        X l        SU l        g )NFr,  )r   r4  r@   _cli_do_not_use_directlyr/  _uri_cache_enabled)r?   clir/  r   s      r6   r@   Command.__init__  s(    	'4!5!1$'!L#Dr5   c                     U R                   $ r;   )r6  rE   s    r6   _cli_power_users_onlyCommand._cli_power_users_only  s    (((r5   c                 6    U R                   R                  USS9$ )a0  Execute a command using the given CLI.

Do not introduce new invocations of this method unless your command
*requires* it; any such new invocations must be approved by a team lead.

Args:
  args: list of str, the args to Execute() via the CLI.

Returns:
  pass-through of the return value from Execute()
F)call_arg_complete)r;  Executer?   rh   s     r6   ExecuteCommandDoNotUseCommand.ExecuteCommandDoNotUse  s      %%--de-LLr5   c                     U R                   R                  [        R                  R                  R
                  R                  5       5        g)zFSets the default output format.

Args:
  parser: The argparse parser.
N)display_info	AddFormatr   r   coredefault_formatGetr   s    r6   r   Command._Flags  s3     !!*"3"3"8"8"G"G"K"K"MNr5   c                     g)zRuns the command.

Args:
  args: argparse.Namespace, An object that contains the values for the
    arguments specified in the .Args() method.

Returns:
  A resource object dispatched by display.Displayer().
Nr-   r@  s     r6   RunCommand.Run  s     	r5   c                     Ung)Called after resources are displayed if the default format was used.

Args:
  resources_were_displayed: True if resources were displayed.
Nr-   )r?   resources_were_displayedr(   s      r6   EpilogCommand.Epilog  s	     	!Ar5   c                 L    [         R                  " XS5      R                  5       $ )zFReturns the key names referenced by the filter and format expressions.N)r	   	DisplayerGetReferencedKeyNamesr@  s     r6   rT  Command.GetReferencedKeyNames  s    T.DDFFr5   c                     g)zReturns a function that transforms a command resource item to a URI.

Returns:
  func(resource) that transforms resource into a URI.
Nr-   rE   s    r6   
GetUriFuncCommand.GetUriFunc  s     r5   )r6  r7  r/  )r/   r0   r1   r2   r3   
IS_COMMANDr@   r\   r;  rA  rb   r   r{   r|   rK  rP  rT  rW  r4   r   r   s   @r6   r4  r4    ss    	 *$ ) )M O O 
	 
	!G r5   r4  c                       \ rS rSrSrS rSrg)TopicCommandi  z2A command that displays its own help on execution.c                 H    U R                  UR                  SS  S/-   5        g )Nr   z--document=style=topic)rA  command_pathr@  s     r6   rK  TopicCommand.Run  s.    !"!9 :: r5   r-   N)r/   r0   r1   r2   r3   rK  r4   r-   r5   r6   r[  r[    s
    :r5   r[  c                   (    \ rS rSrSr\S 5       rSrg)SilentCommandi  z"A command that produces no output.c                 :    U R                   R                  S5        g )Nnone)rD  rE  r   s    r6   r   SilentCommand._Flags  s    
!!&)r5   r-   N)r/   r0   r1   r2   r3   rb   r   r4   r-   r5   r6   r`  r`    s    ** *r5   r`  c                       \ rS rSrSrSrg)DescribeCommandi  z;A command that prints one resource in the 'default' format.r-   Nr.   r-   r5   r6   re  re        Cr5   re  c                       \ rS rSrSrSrg)ImportCommandi  z5A command that imports one resource from yaml format.r-   Nr.   r-   r5   r6   rh  rh    s    =r5   rh  c                       \ rS rSrSrSrg)ExportCommandi   z;A command that outputs one resource to file in yaml format.r-   Nr.   r-   r5   r6   rj  rj     rf  r5   rj  c                       \ rS rSrSrSrg)DeclarativeCommandi  z<Command class for managing gcp resources as YAML/JSON files.r-   Nr.   r-   r5   r6   rl  rl    s    Dr5   rl  c                   8    \ rS rSrSr\S 5       r\S 5       rSrg)BinaryBackedCommandi  z-A command that wraps a BinaryBackedOperation.c                 .    [         R                  U 5        g r;   )SHOW_EXEC_ERROR_FLAGrq   r   s    r6   r   BinaryBackedCommand._Flags  s    $$V,r5   c                    U R                   (       a   [        R                  " U R                   5        U R                  (       a)  [        R                  R                  U R                  5        U R
                  (       a  gU R                   $ )z-Process results of BinaryOperation Execution.N)stdoutr   Printstderrstatusfailed)responses    r6    _DefaultOperationResponseHandler4BinaryBackedCommand._DefaultOperationResponseHandler  sL     	ii 	jjx'??r5   r-   N)	r/   r0   r1   r2   r3   rb   r   ry  r4   r-   r5   r6   rn  rn    s+    5- -  r5   rn  c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )CacheCommandi  z.A command that affects the resource URI cache.c                 <   > [         [        U ]
  " U0 UD6  SU l        g r   )r   r|  r@   r7  r   s      r6   r@   CacheCommand.__init__!  s    	,&77"Dr5   )r7  )r/   r0   r1   r2   r3   r@   r4   r   r   s   @r6   r|  r|    s    6# #r5   r|  c                   .    \ rS rSrSr\S 5       rS rSrg)ListCommandi&  z+A command that pretty-prints all resources.c                 l   [         R                  U 5        [        R                  U 5        [        R                  U 5        [        R                  U 5        [
        R                  U 5        U R                  R                  [        R                  R                  R                  R                  5       5        g)z[Adds the default flags for all ListCommand commands.

Args:
  parser: The argparse parser.
N)FILTER_FLAGrq   
LIMIT_FLAGPAGE_SIZE_FLAGSORT_BY_FLAGURI_FLAGrD  rE  r   r   rF  rG  rH  r   s    r6   r   ListCommand._Flags)  sy     F#6"v&V$ 
!!*"3"3"8"8"G"G"K"K"MNr5   c                 R    U(       d   [         R                  R                  S5        gg)rN  zListed 0 items.N)r   rv  rt  )r?   rO  s     r6   rP  ListCommand.Epilog8  s     $	jj() $r5   r-   N)	r/   r0   r1   r2   r3   rb   r   rP  r4   r-   r5   r6   r  r  &  s    3O O*r5   r  c                       \ rS rSrSrSrg)CreateCommandiB  z!A command that creates resources.r-   Nr.   r-   r5   r6   r  r  B      )r5   r  c                       \ rS rSrSrSrg)DeleteCommandiF  z!A command that deletes resources.r-   Nr.   r-   r5   r6   r  r  F  r  r5   r  c                       \ rS rSrSrSrg)RestoreCommandiJ  z"A command that restores resources.r-   Nr.   r-   r5   r6   r  r  J  s    *r5   r  c                       \ rS rSrSrSrg)UpdateCommandiN  z!A command that updates resources.r-   Nr.   r-   r5   r6   r  r  N  s    )r5   r  c                     SU l         U $ )a1  Decorator for hiding calliope commands and groups.

Decorate a subclass of base.Command or base.Group with this function, and the
decorated command or group will not show up in help text.

Args:
  cmd_class: base._Common, A calliope command or group.

Returns:
  A modified version of the provided class.
Tr   	cmd_classs    r6   Hiddenr  T  s     )	r5   c                     SU l         U $ )au  Decorator for making visible calliope commands and groups.

Decorate a subclass of base.Command or base.Group with this function, and the
decorated command or group will show up in help text. This is the default
for base.Command and base.Group subclasses.

Args:
  cmd_class: base._Common, A calliope command or group.

Returns:
  A modified version of the provided class.
Fr   r  s    r6   Visibler  e  s     )	r5   c                     SU l         U $ )a  Decorator for marking calliope groups as autogenerated.

Decorate a subclass of base.Group with this function, and the decorated
group will be treated as autogenerated.

Args:
  group_class: base.Group, A calliope group.

Returns:
  A modified version of the provided class.
Tr   )group_classs    r6   Autogeneratedr  w  s     $(+ 	r5   c                     SU l         U $ )a  Decorator for marking calliope commands and groups available in universes.

Decorate a subclass of base.Command or base.Group with this function, and the
decorated command or group will display help text with information about
command or group is supported in universes.

Args:
  cmd_class: base._Common, A calliope command or group.

Returns:
  A modified version of the provided class.
Tr   r  s    r6   UniverseCompatibler    s     $() 	r5   c                     SU l         U $ )a  Decorator for marking commands & groups available only in default universe.

Decorate a subclass of base.Command or base.Group with this function, and the
decorated command or group will display help text with disclaimer information
about the command or group is not available in universes.

Args:
  cmd_class: base._Common, A calliope command or group.

Returns:
  A modified version of the provided class.
Fr   r  s    r6   DefaultUniverseOnlyr    s     $)) 	r5   c                 "    SU l         SU l        U $ )a  Decorator for marking commands & groups not available in default universe.

Decorate a subclass of base.Command or base.Group with this function, and the
decorated command or group will display help text with disclaimer information
about the command or group is supported only outside the default universe.

Args:
  cmd_class: base._Common, A calliope command or group.

Returns:
  A modified version of the provided class.
TF)r   r   r  s    r6   NonDefaultUniverseOnlyr    s     $() +0)(	r5   c                    ^  U 4S jnU$ )a  Returns decorator that sets regional endpoint mode on commands/groups.

Args:
  mode: Value of properties.VALUES.regional.endpoint_mode to set.
Returns:
  Decorator function that modifies the Filter/Run method to set the given
  endpoint mode for the group/command in question.
c                   > [         R                  R                  R                  R	                  5       (       a  U $ U4S jn[        U [        5      (       a  U" U R                  5      U l        U $ U" U R                  5      U l        U $ )Wrapper Function that creates actual decorated class.

Args:
  cmd_class: base.Command or base.Group subclass to be decorated

Returns:
  The decorated class.
c                 4   >^  [        T 5      UU 4S j5       nU$ )Nc                     > [         R                  R                  [         R                  R                  R                  TS 5        T" U 0 UD6$ r;   )r   r   SetInvocationValueregionalendpoint_mode)rh   kwmoderun_funcs     r6   
WrappedRunX_RegionalEndpointMode.<locals>.DecorateCommand.<locals>.RunDecorator.<locals>.WrappedRun  sA    ,,&&44dD	B$$$r5   r   )r  r  r  s   ` r6   RunDecoratorD_RegionalEndpointMode.<locals>.DecorateCommand.<locals>.RunDecorator  s!    X% % r5   )	r   r   r  r  r#  
issubclassr*  r0  rK  )r  r  r  s     r6   DecorateCommand._RegionalEndpointMode.<locals>.DecorateCommand  ss     !!//??AA )U##%i&6&67i  #9==1imr5   r-   )r  r  s   ` r6   _RegionalEndpointModer    s    8 
r5   c                 l    [        [        R                  R                  R                  5      nU" U 5      $ r;   )r  r   r   r  REGIONAL_ONLYr  	decorators     r6   RegionalEndpointsOnlyr    s)    #J$5$5$>$>$L$LM)	9	r5   c                 l    [        [        R                  R                  R                  5      nU" U 5      $ r;   )r  r   r   r  AUTOr  s     r6   RegionalEndpointsPreferredr    s)    #J$5$5$>$>$C$CD)	9	r5   c                     SU l         U $ )ae  Decorator for calliope commands and groups that support unicode.

Decorate a subclass of base.Command or base.Group with this function, and the
decorated command or group will not raise the argparse unicode command line
argument exception.

Args:
  cmd_class: base._Common, A calliope command or group.

Returns:
  A modified version of the provided class.
T)r   r  s    r6   UnicodeIsSupportedr    s     %))!	r5   c                     ^  U 4S jnU$ )zMark this class as the command implementation for the given release tracks.

Args:
  *tracks: [ReleaseTrack], A list of release tracks that this is valid for.

Returns:
  The decorated function.
c                 (   > [        T5      U l        U $ )z#Wrapper function for the decorator.)setr   )r  r%  s    r6   ApplyReleaseTracks)ReleaseTracks.<locals>.ApplyReleaseTracks  s     '*&kI#r5   r-   )r%  r  s   ` r6   ReleaseTracksr    s     
r5   c                    ^ ^^ UU U4S jnU$ )a  Decorator that marks a Calliope command as deprecated.

Decorate a subclass of base.Command with this function and the
decorated command will be modified as follows:

- If is_removed is false, a warning will be logged when *command* is run,
otherwise an *exception* will be thrown containing error message

-Command help output will be modified to include warning/error message
depending on value of is_removed

- Command help text will automatically hidden from the reference documentation
(e.g. @base.Hidden) if is_removed is True


Args:
    is_removed: boolean, True if the command should raise an error when
      executed. If false, a warning is printed
    warning: string, warning message
    error: string, error message

Returns:
  A modified version of the provided class.
c                 t  > T(       a  TnSR                  [        5      nOTnSR                  [        5      nU R                  X!5        U R                  S5        UUU4S jn[	        U [
        5      (       a  U" U R                  5      U l        OU" U R                  5      U l        T(       a  [        U 5      $ U $ )r  z{0}(REMOVED){0} z{0}(DEPRECATED){0} Tc                 8   >^  [        T 5      UUU U4S j5       nU$ )Nc                  d   > T(       a  [        T5      e[        R                  " T5        T" U 0 UD6$ r;   )r+   r   warning)rh   r  error
is_removedr  r  s     r6   r  MDeprecate.<locals>.DeprecateCommand.<locals>.RunDecorator.<locals>.WrappedRunI  s-    $U+
+G$$$r5   r   )r  r  r  r  r  s   ` r6   r  9Deprecate.<locals>.DeprecateCommand.<locals>.RunDecoratorH  s!    X% % r5   )	rY   r^   r  r  r  r*  r0  rK  r  )r  r  deprecation_tagr  r  r  r  s       r6   DeprecateCommand#Deprecate.<locals>.DeprecateCommand5  s     c*11-@oc-44]Co-D! )U##%i&6&67i"9==1imIr5   r-   )r  r  r  r  s   ``` r6   	Deprecater    s    <%N 
r5   c                 B    U R                  SS5      R                  5       $ )a  Returns a function that ensures choice flag values match Cloud SDK Style.

Args:
  value: string, string representing flag choice value parsed from command
    line.

Returns:
     A string value entirely in lower case, with words separated by
     hyphens.
r(   -)replacelowervalues    r6   _ChoiceValueTyper  _  s     
sC	 	&	&	((r5   c                 D    U  Vs/ s H  n[        U5      PM     sn$ s  snf )z4Applies _ChoiceValueType to a collection of choices.)r  )iterablexs     r6   SanitizeChoicesr  m  s     '/	0x!
1
x	00	0s   c
                 
   U(       d  [        S5      e[        U[        R                  5      (       a  [        U[        R
                  5      (       a)  [        SR                  SR                  U5      5      5      e[        R                  " S5      n
U Vs/ s H  oR                  U5      (       a  M  UPM     nnU(       a)  [        SR                  SR                  U5      5      5      e[        U UU[        UUUUUUU	S9$ s  snf )aF  Returns Argument with a Cloud SDK style compliant set of choices.

Args:
  name_or_flag: string, Either a name or a list of option strings, e.g. foo or
    -f, --foo.
  choices: container,  A container (e.g. set, dict, list, tuple) of the
    allowable values for the argument. Should consist of strings entirely in
    lower case, with words separated by hyphens.
  help_str: string,  A brief description of what the argument does.
  required: boolean, Whether or not the command-line option may be omitted.
  action: string or argparse.Action, The basic type of argeparse.action to be
    taken when this argument is encountered at the command line.
  metavar: string,  A name for the argument in usage messages.
  dest: string,  The name of the attribute to be added to the object returned
    by parse_args().
  default: string,  The value produced if the argument is absent from the
    command line.
  hidden: boolean, Whether or not the command-line option is hidden.
  hidden_choices: list, A subset of 'choices' that should be hidden from
    documentation.

Returns:
   Argument object with choices, that can accept both lowercase and uppercase
   user input with hyphens or undersores.

Raises:
   TypeError: If choices are not an iterable container of string options.
   ValueError: If provided choices are not Cloud SDK Style compliant.
zChoices must not be empty.z7Choices must be an iterable container of options: [{}]., z^([a-z0-9]\.?-?)+[a-z0-9]$z^Invalid choices [{}]. Choices must be entirely in lowercase with words separated by hyphens(-))
choicesr   r   r   r   r   r   rw   r   hidden_choices)rX   
isinstancecollections_abcIterabler   string_types	TypeErrorrY   joinr   compiler   r   r  )name_or_flagr  help_strr   r   r   r   rw   r   r  	choice_rer  invalid_choicess                r6   ChoiceArgumentr  r  s    T 

1
22 Wo66
7
7	GS--	.	. AHHIIg	
  jj67) 'B1q/AQ/B
,
&?+
,	  
#
  Cs   D 1D c               #     #    [         R                  R                  5         [         R                  R                  [         R                  R                  R
                  [         R                  R                  R                  S5         Sv   [         R                  R                  5         g! [         R                  R                  5         f = f7f)a  Context where x-goog-user-project header is not populated.

In this context, user's setting of quota_project will be ignored, including
settings in:
- --billing-project
- configuration of billing/quota_project
- CLOUDSDK_BILLING_QUOTA_PROJECT
quota_project settings by the command group's Filter functions will also be
ignored. Use this context when you don't want to send the x-goog-user-project
header.

Yields:
  yield to the surrounded code block.
N)r   r   PushInvocationValuesr  billingquota_projectLEGACYPopInvocationValuesr-   r5   r6   WithLegacyQuotar    s       ((*&&--&&

,	))+J))+s   BCB* C* C

Cc                    ^  [         R                  R                  R                  R	                  5         [         R                  R                  R                  R                  U 4S j5        g )Nc                     > T $ r;   r-   r  s   r6   <lambda>._SetUserProjectQuotaFallback.<locals>.<lambda>  s    er5   )r   r   r  r  ClearCallbackAddCallbackr  s   `r6   _SetUserProjectQuotaFallbackr    sC     ))779))55mDr5   c                  ^    [        [        R                  R                  R                  5        g)aQ  Disable the quota project header.

 This function will set the value for properties.VALUES.billing.quota_project
 which is used to decide if we want to send the quota project header
 x-goog-user-project and what value to put in the header. Gcloud's property
 has multiple layers of fallbacks when resolving its value. Specifically for
 quota_project property:

 L1: invocation stack populated by parsing --billing-project.
 L2: its env variable CLOUDSDK_BILLING_QUOTA_PROJECT
 L3: user configuration or installation configuration from gcloud config set.
 L4: value provided by its fallbacks if exists.
 L5: default value

This function sets the value at L4 (fallbacks). It should be used in command
group's Filter function so that the command group will work in LEGACY mode
(DO NOT send the quota project header). It sets at L4 because:

1. L1-L3 are user settings we want to honor. This func
   cannot operate in L1-L3 because it will mix with user settings.
   Whether the setting is from user is an important information when we decide
   how override works.
2. L4 can override the default value (L5).
N)r  r   r   r  r  r-   r5   r6   DisableUserProjectQuotar    s    2 z0088??@r5   c                  ^    [        [        R                  R                  R                  5        g)af  Enable the quota project header for current project.

The project in core/project will be used to populate the quota project header.
It should be used in command group's Filter function so that commands in the
group will send the current project (core/project) in the quota project
header.

See the docstring of DisableUserProjectQuota for more information.
N)r  r   r   r  CURRENT_PROJECTr-   r5   r6   EnableUserProjectQuotar    s     z0088HHIr5   c                  ^    [        [        R                  R                  R                  5        g)a  Tries the current project and fall back to the legacy mode.

The project in core/project will be used to populate the quota project header.
It should be used in command group's Filter function so that commands in the
group will send the current project (core/project) in the quota project
header. If the user does not have the permission to use the project,
we will retry the request after removing the quota project header.

See the docstring of DisableUserProjectQuota for more information.
N)r  r   r   r  CURRENT_PROJECT_WITH_FALLBACKr-   r5   r6   "EnableUserProjectQuotaWithFallbackr    s!     ==r5   c                      [         R                  R                  R                  R	                  5       [         R                  R                  R
                  :H  $ )z=Returns if the CURRENT_PROJECT_WITH_FALLBACK mode is enabled.)r   r   r  r  rH  r  r-   r5   r6   #UserProjectQuotaWithFallbackEnabledr  #  sB     --113				"	"	@	@Ar5   c                  j    [         R                  R                  R                  R	                  S5        g)zOpts the command group out of using requests to make HTTP requests.

Call this function in the Filter method of the command group
to disable requests.
TN)r   r   	transportopt_out_requestsr$  r-   r5   r6   OptOutRequestsr  +  s$     ..2248r5   c                     [        5       =(       au    [        R                  R                  R                  R                  5       (       + =(       a7    [        R                  R                  R                  R                  5       (       + $ )zReturns True if using requests to make HTTP requests.

transport/disable_requests_override is a global switch to turn off requests in
case support is buggy. transport/opt_out_requests is an internal property
to opt surfaces out of requests.
)UseGoogleAuthr   r   r  r  GetBooldisable_requests_overrider-   r5   r6   UseRequestsr  4  s\     o N))::BBD
DN))CCKKM
Mr5   c                  j    [         R                  R                  R                  R	                  S5        g)zOpt-out the command group to use google auth for authentication.

Call this function in the Filter method of the command group
to opt-out google-auth.
TN)r   r   r!  opt_out_google_authr$  r-   r5   r6   OptOutGoogleAuthr  C  s$     ,,006r5   c                      [         R                  R                  R                  R	                  5       =(       d2    [         R                  R                  R
                  R	                  5       (       + $ )zReturns True if using google-auth to authenticate the http request.

auth/disable_load_google_auth is a global switch to turn off google-auth in
case google-auth is crashing. auth/opt_out_google_auth is an internal property
to opt-out a surface.
)r   r   r!  r  r  disable_load_google_authr-   r5   r6   r
  r
  L  sP     0088: C						8	8	@	@	B
 r5   c           
         [        [        R                  " UR                  5       5      5      nSR	                  U VVs/ s H  u  p4SR                  X45      PM     snn5      n[        R                  " SR                  X5      5        gs  snnf )am  Log (to debug) the command/arguments being run in a standard format.

`gcloud feedback` depends on this format.

Example format is:

    Running [gcloud.example.command] with arguments: [--bar: "baz"]

Args:
  prog: string, the dotted name of the command being run (ex.
    "gcloud.foos.list")
  args: argparse.namespace, the parsed arguments from the command line
r  z{}: "{}"z!Running [{}] with arguments: [{}]N)sortedr   	iteritemsGetSpecifiedArgsr  rY   r   debug)progrh   specified_argskv
arg_strings         r6   
LogCommandr  Y  sh     #--(=(=(?@A.yynMnda*++A1nMN*))/66tHI Ns   B	
c                 \   U R                   (       a6  U R                   R                  5       (       a  [        R                  " S5      eg[        R                  R
                  R                   R                  5       nU(       a,  UR                  5       (       a  [        R                  " S5      egg)zProhibit specifying project as a project number.

Most APIs accept both project number and project id, some of them accept only
project ids.

Args:
   args: argparse.namespace, the parsed arguments from the command line
zlThe value of ``--project'' flag was set to Project number.To use this command, set it to PROJECT ID instead.NzThe value of ``core/project'' property is set to project number.To use this command, set ``--project'' flag to PROJECT ID or set ``core/project'' property to PROJECT ID.)projectisdigitr   InvalidValueErrorr   rF  rH  )rh   projs     r6   RequireProjectIDr#  l  s     
\\||((? 
 !!))--/D((9  tr5   )TzThis command is deprecated.zThis command has been removed.)NFNNNNFN)r3   
__future__r   r   r   r{   collections
contextlibenum	functoolsr   r   r   sysgooglecloudsdk.callioper   r	   googlecloudsdk.corer
   r   r   googlecloudsdk.core.resourcer   r   r  AttributeErrorBACKUP_CATEGORYRESTORE_CATEGORY AI_AND_MACHINE_LEARNING_CATEGORYVERTEX_AI_CATEGORYTENSORBOARD_CATEGORY$API_PLATFORM_AND_ECOSYSTEMS_CATEGORYANTHOS_CLI_CATEGORYANTHOS_AUTH_CATEGORYAPP_ENGINE_CATEGORYBATCH_CATEGORYCOMPOSER_CATEGORYCOMPUTE_CATEGORYDATA_ANALYTICS_CATEGORYDATABASES_CATEGORYGDCC_ZONE_CATEGORYIDENTITY_AND_SECURITY_CATEGORYINTERNET_OF_THINGS_CATEGORYMANAGEMENT_TOOLS_CATEGORYMOBILE_CATEGORYNETWORKING_CATEGORYNETWORK_SECURITY_CATEGORYSDK_TOOLS_CATEGORYDISKS_CATEGORYINFO_CATEGORYINSTANCES_CATEGORYLOAD_BALANCING_CATEGORYTOOLS_CATEGORYSTORAGE_CATEGORYTRANSFER_CATEGORYBILLING_CATEGORYSECURITY_CATEGORYIDENTITY_CATEGORYBIG_DATA_CATEGORYCI_CD_CATEGORYMONITORING_CATEGORYSOLUTIONS_CATEGORYSERVERLESS_CATEGORYUNCATEGORIZED_CATEGORYCOMMERCE_CATEGORY"DECLARATIVE_CONFIGURATION_CATEGORYMICROSERVICES_CATEGORYWEB3_CATEGORYSAAS_CATEGORYr^   MARKDOWN_ITALICMARKDOWN_CODEErrorr+   uniqueEnumr8   with_metaclassABCMetaobjectrd   r~   r   COMMONLY_USED_FLAGSFLAGS_FILE_FLAGArgListFLATTEN_FLAGrY   r  SupportedFormatsFORMAT_FLAGLIST_COMMAND_FLAGS
ASYNC_FLAGr  
BoundedIntmaxsizer  r  r  r  BINARY_BACKED_COMMAND_FLAGSrp  r   r*  r4  r[  r`  re  rh  rj  rl  rn  r|  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  contextmanagerr  r  r  r  r  r  r  r  r  r
  r  r#  r-   r5   r6   <module>rm     s   5 &  ' 
      	 
 / + * # * 9 
 OO/
  #<    0 'D $" $ "   *     !8 2 . " .     *       "   "     %F "(  F:++ F \D499 \D \D~,	SV4 ,	^7F 78J'v J'b &  
; 				 	
/$  
  &v$5578   $ 	
	
 #
+ 			3;;$	?#


 			3;;$	?#
 				#
 #
 6 (	1
 OKc  f5 OKd	G 	(Nc  g6 Nb3%%ckk7; *C&&s{{G< *Dc((g> D>C&&s{{G< >DC&&s{{G< DE++CKKA E#,,S[['B ,#3%%ckk7; #*#$$S[[,? *8*L- **L- *+\= +M "$"$$&&R

$( )
*EP)1 	Qh , ,6EA8
J 97
J&G*   / s    Q6 6RR