
    f                        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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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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$ " S S\%5      r& " S S\RN                  \RP                  5      r) " S S\RT                  \)5      r+ " S S\+5      r,S  r- " S! S"\+5      r.S# r/ " S$ S%\+5      r0S& r1 " S' S(\Rd                  5      r3 " S) S*\+5      r4S+ r5 " S, S-\45      r6S. r7 " S/ S0\Rp                  \)5      r9S1 r:\Rv                  " S25      r<S3 r=S4 r>S5 r?S6 r@S7 rAS8 rBg)9z/Base classes for abstracting away common logic.    )absolute_import)division)unicode_literalsN)base_api)base_classes_resource_registry)client_adapter)	constants)lister)property_selector)request_helper)resource_specs)scope_prompter)utils)arg_parsers)base)
completers)
exceptions)
properties)	resources)yaml)textc                   B    \ rS rSrSrSS jr\S 5       r\S 5       rSr	g)	ComputeApiHolder1   z@Convenience class to hold lazy initialized client and resources.c                     U[         R                  R                  :X  a  SU l        O-U[         R                  R                  :X  a  SU l        OSU l        S U l        S U l        X l        g )Nalphabetav1)r   ReleaseTrackALPHA_api_versionBETA_client
_resources_no_http)selfrelease_trackno_https      2lib/googlecloudsdk/api_lib/compute/base_classes.py__init__ComputeApiHolder.__init__4   sU    ))///!d	$++00	0 ddDLDOM    c                     U R                   c0  [        R                  " U R                  U R                  5      U l         U R                   $ zSpecifies the compute client.)r#   r   ClientAdapterr!   r%   r&   s    r)   clientComputeApiHolder.client?   s9     ||#11


T]],dl<<r,   c                     U R                   cI  [        R                  R                  5       U l         U R                   R	                  SU R
                  5        U R                   $ )5Specifies the resources parser for compute resources.compute)r$   r   REGISTRYCloneRegisterApiByNamer!   r0   s    r)   r   ComputeApiHolder.resourcesG   sH     !**002do
oo''	43D3DE??r,   )r!   r#   r%   r$   N)F)
__name__
__module____qualname____firstlineno____doc__r*   propertyr1   r   __static_attributes__ r,   r)   r   r   1   s2    H	    r,   r   c                      ^  \ rS rSrSrU 4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 rSrU =r$ )BaseCommandP   z'Base class for all compute subcommands.c                    > [         [        U ]
  " U0 UD6  S U l        [        R
                  R                  R                  R                  SS9U l	        [        U R                  5       5      U l        g )NT)required)superrC   r*   _BaseCommand__resource_specr   VALUEScoreprojectGet_projectr   r   _compute_holder)r&   argskwargs	__class__s      r)   r*   BaseCommand.__init__S   s\    	+t%t6v6D%%**22666EDM+D,=,=,?@Dr,   c                     U R                   (       d  g U R                  cE  [        R                  " U R                   U R                  U R
                  R                  5      U l        U R                  $ N)resource_typerH   r   GetSpecmessagescompute_clientapi_versionr0   s    r)   _resource_specBaseCommand._resource_specZ   sY    # ,33


dmmT-@-@-L-LNdr,   c                 R    U R                   (       a  U R                   R                  $ g rT   )rZ   transformationsr0   s    r)   r]   BaseCommand.transformationse   s       000r,   c                     g)z<Specifies the name of the collection that should be printed.NrA   r0   s    r)   rU   BaseCommand.resource_typel   s     r,   c                 B    U R                   R                  R                  $ )z2Specifies the http client to be used for requests.)rX   apitools_clienthttpr0   s    r)   rc   BaseCommand.httpq   s     ..333r,   c                     U R                   $ )zSpecifies the user's project.)rM   r0   s    r)   rK   BaseCommand.projectv   s     ==r,   c                 .    U R                   R                  $ )zSpecifies the API batch URL.)rX   	batch_urlr0   s    r)   rh   BaseCommand.batch_url{   s     (((r,   c                 .    U R                   R                  $ r.   )rN   r1   r0   s    r)   rX   BaseCommand.compute_client   s     &&&r,   c                 .    U R                   R                  $ r.   )rX   rb   r0   s    r)   r5   BaseCommand.compute   s     ...r,   c                 .    U R                   R                  $ )r4   )rN   r   r0   s    r)   r   BaseCommand.resources   s     )))r,   c                 .    U R                   R                  $ )z"Specifies the API message classes.)rX   rW   r0   s    r)   rW   BaseCommand.messages   s     '''r,   c                 F    U R                   (       a  SU R                   -   $ S$ )z%Returns the resource collection path.zcompute.NrU   r0   s    r)   
CollectionBaseCommand.Collection   s     .2.@.@:***JdJr,   )__resource_specrN   rM   )r:   r;   r<   r=   r>   r*   r?   rZ   r]   rU   rc   rK   rh   rX   r5   r   rW   rt   r@   __classcell__)rQ   s   @r)   rC   rC   P   s    /A         4 4   ) ) ' ' / / * * ( (K Kr,   rC   c                       \ rS rSrSrSrSrSrSr\	S 5       r
\S 5       r\R                  S 5       rS rS rS	 rS
 rS rS rSrg)
BaseLister   z$Base class for the list subcommands.Nc           	      j    U R                  SSS/ [        R                  SS9  U R                  SSSS	9  g )
NnamesNAME*zKIf provided, show details for the specified names and/or URIs of resources.)metavarnargsdefault	completerhelpz--regexpz-rz        Regular expression to filter the names of the results on. Any names
        that do not match the entire regular expression will be filtered out.
        )r   )add_argumentr   InstancesCompleterparsers    r)   ArgsBaseLister.Args   sN    
//    D  r,   c                     U R                   /$ )z=The list of resource types that can be provided to filtering.rs   r0   s    r)   allowed_filtering_types"BaseLister.allowed_filtering_types   s     r,   c                     g)z8Returns a generator of JSON-serializable resource dicts.NrA   r&   rO   errorss      r)   GetResourcesBaseLister.GetResources       r,   c                 \    UR                   (       a  SR                  UR                   5      $ g)z4Returns a filter expression if --regexp is provided.zname eq {0}N)regexpformatr&   rO   s     r)   GetFilterExprBaseLister.GetFilterExpr   s!    {{!!$++..r,   c           	      v   U R                    Vs/ s H  nSR                  U5      PM     nnUR                   H  n U R                  R	                  U5      nUR                  5       U;  aJ  [        R                  " SR                  SR                  S U 5       5      UR                  5       5      5      eU R                  R                  UR                  5       5        U R                  R                  U5        M     gs  snf ! [        R                   a     Of = fU R                  R                  U5        GM  )z7Processes the positional arguments for later filtering.zcompute.{0}z1Resource URI must be of type {0}. Received [{1}]. or c              3   D   #    U  H  nS R                  U5      v   M     g7f)z[{0}]Nr   ).0
collections     r)   	<genexpr>ABaseLister.PopulateResourceFilteringStructures.<locals>.<genexpr>   s$      E0C* &nnZ880Cs    N)r   r   r|   r   Parsert   compute_exceptionsInvalidResourceErrorjoin
self_linksaddSelfLinkresource_refsappend	UserError)r&   rO   rU   allowed_collectionsnamerefs         r)   #PopulateResourceFilteringStructures.BaseLister.PopulateResourceFilteringStructures   s    150L0LN0L} )//>0L  N

nn""4(>>#66"77AHH++ E0CE E.."$% % 	CLLN+!!#& N      jjnnTs   C>B=DDDc              #      #    U HF  nUR                   (       d  Uv   M  US   U R                  ;   d  US   U R                   ;   d  MB  Uv   MH     g7f)z)Filters the list results by name and URI.selfLinkr   N)r|   r   )r&   rO   itemsitems       r)   FilterResultsBaseLister.FilterResults   sB     ZZ
 
t.$v,$**2L
 s   AA	Ac                 
    UnU$ z?Computes dynamic properties, which are not returned by GCE API.rA   r&   rO   r   _s       r)   ComputeDynamicProperties#BaseLister.ComputeDynamicProperties       ALr,   c                     UR                  S5      (       dX  UR                  (       dG  U R                  5       (       a2  [        R                  U R                  5          nUR
                  Ul        U R                  U5      $ )Nr   )IsSpecifiedurirt   resource_registryRESOURCE_REGISTRYlist_formatr   _Run)r&   rO   rs      r)   RunBaseLister.Run   sW    
 H%%dhh4??;L;L

-
-doo.?
@aMMdk99T?r,   c              #     #    [        5       U l        [        5       U l        / U l        [        R
                  " SU R                  S9n/ nU R                  U5        U R                  XR                  X5      5      n[        R                  " UUS9nU R                  X5      nU H  nUv   M	     U(       a  [        R                  " U5        gg7f)z:Yields JSON-serializable dicts of resources or self links.N)r   r]   )r   field_selector)setr   r|   r   r   PropertySelectorr]   r   r   r   r
   ProcessResultsr   r   RaiseToolException)r&   rO   r   r   r   r   s         r)   r   BaseLister._Run   s      eDODJD
 '77,,.N F,,T2-/E!!%'E ))$6Ej  v& s   C
C)r|   r   r   )r:   r;   r<   r=   r>   r   r|   r   servicestaticmethodr   r?   r   abcabstractmethodr   r   r   r   r   r   r   r@   rA   r,   r)   ry   ry      sy    ,*
%-' "     C C.

'r,   ry   c                       \ rS rSrSrS rSrg)GlobalListeri  z(Base class for listing global resources.c           	          [         R                  " U R                  U R                  U R	                  U5      U R
                  U R                  US9$ )N)r   rK   filter_exprrc   rh   r   )r
   GetGlobalResourcesDictsr   rK   r   rc   rh   r   s      r)   r   GlobalLister.GetResources  sB    ))&&t,YY.. r,   rA   N)r:   r;   r<   r=   r>   r   r@   rA   r,   r)   r   r     s
    0r,   r   c                     U S:X  a(  SU -   SR                  U 5      SR                  U 5      S.nO'SU -   SR                  U 5      SR                  U 5      S.nU S	:X  a  US
==   SR                  U 5      -  ss'   U$ )z9Returns the detailed help dict for a global list command.routesz'List non-dynamic Google Compute Engine aZ  
*{{command}}* displays all custom static, subnet, and peering {0} in
VPC networks in a project.

To list custom dynamic routes learned by Cloud Routers, query the
status of the Cloud Router that learned the route using
`gcloud compute routers get-status`. For more details, refer
to https://cloud.google.com/vpc/docs/using-routes#listingroutes.
z
To list all non-dynamic {0} in a project in table form, run:

    $ {{command}}

To list the URIs of all non-dynamic {0} in a project, run:

    $ {{command}} --uri
briefDESCRIPTIONEXAMPLESList Google Compute Engine zD
*{{command}}* displays all Google Compute Engine {0} in a project.

To list all {0} in a project in table form, run:

  $ {{command}}

To list the URIs of all {0} in a project, run:

  $ {{command}} --uri
imagesr   z
To list the names of {0} older than one year from oldest to newest
(`-P1Y` is an [ISO8601 duration](https://en.wikipedia.org/wiki/ISO_8601)):

  $ {{command}} --format="value(NAME)" --filter="creationTimestamp < -P1Y"
r   )resourcedetailed_helps     r)   GetGlobalListerHelpr   "  s    :XE F8 F8'M. /9
F8 F8M * "
 F8 
r,   c                   .    \ rS rSrSr\S 5       rS rSrg)RegionalListeriT  z*Base class for listing regional resources.c           	      x    [         R                  U 5        U R                  SSS[        R                  " SS9/ S9  g )N	--regionsREGIONz?If provided, only resources from the given regions are queried.   
min_length)r   r   typer   )ry   r   r   r   ArgListr   s    r)   r   RegionalLister.ArgsW  s;    OOF
N  A.  r,   c           
         UR                    Vs/ s H!  nU R                  USS9R                  5       PM#     nn[        R                  " U R
                  U R                  UU R                  U5      U R                  U R                  US9$ s  snf )Nregionsrs   )r   rK   requested_regionsr   rc   rh   r   )
r   CreateGlobalReferenceNamer
   GetRegionalResourcesDictsr   rK   r   rc   rh   )r&   rO   r   regionregion_namess        r)   r   RegionalLister.GetResourcesa  s     ll$"F 	""6"CHHJ"  $ ++&&&t,YY.. 	$   (B
rA   N	r:   r;   r<   r=   r>   r   r   r   r@   rA   r,   r)   r   r   T  s    2 r,   r   c                 P    SU -   SR                  U 5      SR                  U 5      S.$ )z;Returns the detailed help dict for a regional list command.r   z
*{{command}}* displays all Google Compute Engine {0} in a project.

By default, {0} from all regions are listed. The results can be
narrowed down using a filter: `--filter="region:( REGION ... )"`.
a  
To list all {0} in a project in table form, run:

  $ {{command}}

To list the URIs of all {0} in a project, run:

  $ {{command}} --uri

To list all {0} in the ``us-central1'' and ``europe-west1'' regions,
run:

  $ {{command}} --filter="region:( us-central1 europe-west1 )"
r   r   r   s    r)   GetRegionalListerHelpr   p  8     -x7
 F8 F8+
 r,   c                   .    \ rS rSrSr\S 5       rS rSrg)ZonalListeri  z'Base class for listing zonal resources.c           	          [         R                  U 5        U R                  SSS[        R                  " SS9[
        R                  / S9  g )N--zonesZONEz=If provided, only resources from the given zones are queried.r   r   )r   r   r   r   r   )ry   r   r   r   r   r   ZonesCompleterr   s    r)   r   ZonalLister.Args  sD    OOF
L  A.++  r,   c           
         UR                    Vs/ s H!  nU R                  USS9R                  5       PM#     nn[        R                  " U R
                  U R                  UU R                  U5      U R                  U R                  US9$ s  snf )Nzonesrs   )r   rK   requested_zonesr   rc   rh   r   )
r  r   r   r
   GetZonalResourcesDictsr   rK   r   rc   rh   )r&   rO   r   zone
zone_namess        r)   r   ZonalLister.GetResources  s     JJ D 	""4w"?DDF    (("&&t,YY..  r   rA   Nr   rA   r,   r)   r   r     s    / r,   r   c                 P    SU -   SR                  U 5      SR                  U 5      S.$ )z8Returns the detailed help dict for a zonal list command.r   z
*{{command}}* displays all Google Compute Engine {0} in a project.

By default, {0} from all zones are listed. The results can be narrowed
down using a filter: `--filter="zone:( ZONE ... )"`.
a  
To list all {0} in a project in table form, run:

  $ {{command}}

To list the URIs of all {0} in a project, run:

  $ {{command}} --uri

To list all {0} in the ``us-central1-b'' and ``europe-west1-d'' zones,
run:

  $ {{command}} --filter="zone:( us-central1-b europe-west1-d )"
r   r   r   s    r)   GetZonalListerHelpr    r   r,   c                   $    \ rS rSrSrSrSrSrSrg)	ScopeTypei  zScope type of compute resource.r         rA   N)	r:   r;   r<   r=   r>   global_scoperegional_scopezonal_scoper@   rA   r,   r)   r  r    s    ',.+r,   r  c                       \ rS rSrSr\S 5       r\R                  S 5       r	\R                  S 5       r
\R                  S 5       r\R                  S 5       rS rS	rg
)MultiScopeListeri  5Base class for listing global and regional resources.c                    [         R                  U 5        U R                  5       n[        R                  U;   a%  UR                  SSS[        R                  " 5       S9  [        R                  U;   a%  UR                  SSS[        R                  " 5       S9  [        R                  U;   a  UR                  SS	S
SS9  g g )Nr  r  zvIf provided, only zonal resources are shown. If arguments are provided, only resources from the given zones are shown.)r   r   r   r   r   z{If provided, only regional resources are shown. If arguments are provided, only resources from the given regions are shown.z--global
store_truez-If provided, only global resources are shown.F)actionr   r   )
ry   r   add_mutually_exclusive_groupr  r  r   r   r   r  r  )r   scopesscopes      r)   AddScopeArgsMultiScopeLister.AddScopeArgs  s    OOF//1E&
# ""$  & 6)
% ""$  & '
>	   (r,   c                     g)z*The service used to list global resources.NrA   r0   s    r)   global_serviceMultiScopeLister.global_service  r   r,   c                     gz,The service used to list regional resources.NrA   r0   s    r)   regional_service!MultiScopeLister.regional_service  r   r,   c                     gr$  rA   r0   s    r)   zonal_serviceMultiScopeLister.zonal_service  r   r,   c                     g)z5The service used to get aggregated list of resources.NrA   r0   s    r)   aggregation_service$MultiScopeLister.aggregation_service  r   r,   c                 |  ^  [        USS5      n[        USS5      n[        USS5      nU(       + =(       a    U(       + =(       a    U(       + n/ nT R                  U5      nUR                  b%  [        UR                  [        R
                  5      n	O[        R
                  n	T R                  n
U(       aP  T R                  (       a?  UR                  T R                  ST R                  R                  S5      " UU	U
S945        GOUbf  [        U 4S jU 5       5      n[        U5       HA  nUR                  T R                  ST R                  R                  S5      " UU	UU
S	945        MC     OUbf  [        U 4S
 jU 5       5      n[        U5       HA  nUR                  T R                  ST R                  R                  S5      " UU	UU
S945        MC     O=UR                  T R                  ST R                  R                  S5      " UU	U
S945        [        R                   " UT R"                  T R$                  US9$ )zReturns zonal, regional and/or global resources.

Args:
  args: argparse.Namespace, Parsed arguments
  errors: list, Errors will be returned in this list

Returns:
  Zonal, regional and/or global resources.
r   Nr  globalAggregatedList)filter
maxResultsrK   c              3   `   >#    U  H#  nTR                  US S9R                  5       v   M%     g7f)r   rs   Nr   r   )r   r   r&   s     r)   r   0MultiScopeLister.GetResources.<locals>.<genexpr>  s4      !f 
$
$V9
$
E
J
J
L
L   +.List)r0  r1  r   rK   c              3   `   >#    U  H#  nTR                  US S9R                  5       v   M%     g7f)r  rs   Nr3  )r   r	  r&   s     r)   r   r4  -  s4      d 
$
$T
$
A
F
F
H
Hr5  )r0  r1  r	  rK   requestsrc   rh   r   )getattrr   	page_sizeminr	   MAX_RESULTS_PER_PAGErK   r+  r   GetRequestTyper   sortedr%  r(  r!  r   ListJsonrc   rh   )r&   rO   r   r   r  
global_argno_scope_flagsr9  r   max_resultsrK   r   region_namer
  	zone_names   `              r)   r   MultiScopeLister.GetResources  s*    dIt,GD'4(Ex.J ![AYAz>NH$$T*K~~!	(F(FGk22kllG
 $22oo####223CD!% !" 
	 !! !l  -+""""11&9#'# 	"#	$ . 
	  j j))..v6#' 	"#	$ * oo--f5!% !" ""YY..	 r,   rA   N)r:   r;   r<   r=   r>   r   r  r   abstractpropertyr!  r%  r(  r+  r   r@   rA   r,   r)   r  r    s    = 8 5 5 7 7 7 7 @ @Or,   r  c                    SnSnSn/ n/ n[         R                  U;   a%  UR                  S5        UR                  SU -   5        [         R                  U;   a%  UR                  S5        UR                  U S-   5        [         R                  U;   a%  UR                  S5        UR                  U S	-   5        S
R                  USS 5      S-   US   -   nS
R                  USS 5      S-   US   -   nSU -   SR                  XU5      S[         R                  U;   a  UOS-   [         R                  U;   a  UOS-   [         R                  U;   a  UOS-   R                  U 5      S.$ )zFReturns the detailed help dict for a global and regional list command.z
To list all {0} in zones ``us-central1-b''
and ``europe-west1-d'', given they are zonal resources, run:

  $ {{command}} --filter="zone:( europe-west1-d us-central1-b )"
z
To list all {0} in the ``us-central1'' and ``europe-west1'' regions,
given they are regional resources, run:

  $ {{command}} --filter="region:( europe-west1 us-central1 )"
zE
To list all global {0} in a project, run:

  $ {{command}} --global
z``--global''zglobal z``--regions''z from all regionsz``--zones''z from all zonesz, Nr   z and r   z
*{{command}}* displays all Google Compute Engine {0} in a project.

By default, {1} are listed. The results can be narrowed down by
providing the {2} flag.
r    r   )r  r  r   r  r  r   r   )	r   r  zone_example_textregion_example_textglobal_example_textallowed_flagsdefault_resultallowed_flags_textdefault_result_texts	            r)   GetMultiScopeListerHelprR  K  s    -.v%()h./')(%889f$'(%667 iicr"#f,}R/@@  iis#$w.1CC  -x7
 F8*<= #//69 *?A
C #11V; *ACE #..&8 (>@B 6(#/
 r,   c                   x    \ rS rSrSr\R                  \R                  /r\	S 5       r
\S 5       r\S 5       rSrg)GlobalRegionalListeri  r  c                 L    [         R                  U [        R                  5        g rT   )r  r  rT  SCOPESr   s    r)   r   GlobalRegionalLister.Args  s    !!&*>*E*EFr,   c                     U R                   $ rT   )r%  r0   s    r)   r+  (GlobalRegionalLister.aggregation_service  s       r,   c                     g rT   rA   r0   s    r)   r(  "GlobalRegionalLister.zonal_service  s    r,   rA   N)r:   r;   r<   r=   r>   r  r  r  rV  r   r   r?   r+  r(  r@   rA   r,   r)   rT  rT    sW    =$$i&<&<=&G G ! !  r,   rT  c                 6    [        U [        R                  5      $ rT   )rR  rT  rV  r   s    r)   GetGlobalRegionalListerHelpr]    s    	 +?+F+F	GGr,   c                       \ rS rSrSrSr\SS j5       r\SS j5       r\	S 5       r
S r\R                  S 5       rS	 rS
 rS rSrg)BaseDescriberi  z(Base class for the describe subcommands.Nc                 .    [         R                  X5        g rT   )r_  AddArgsr   r   s     r)   r   BaseDescriber.Args  s    &+r,   c                 &    U R                  SSSS9  g )Nr   r}   z"The name of the resource to fetch.)r   r   )r   rb  s     r)   ra  BaseDescriber.AddArgs  s    
1  3r,   c                     g)NrL   rA   r0   s    r)   methodBaseDescriber.method  s    r,   c                     g)z9Adds a zone or region to the request object if necessary.NrA   )r&   r   requests      r)   ScopeRequestBaseDescriber.ScopeRequest  r   r,   c                     g rT   rA   r   s     r)   CreateReferenceBaseDescriber.CreateReference  s    r,   c                     U R                   R                  U R                  5      R                  S   n[	        X#UR                  5       5        g)zBSets the field in the request that corresponds to the object name.rI  N)r   GetMethodConfigrg  ordered_paramssetattrr   )r&   r   rj  
name_fields       r)   SetNameFieldBaseDescriber.SetNameField  s5    --dkk:II"MJG,r,   c                 
    UnU$ r   rA   r   s       r)   r   &BaseDescriber.ComputeDynamicProperties  r   r,   c                    U R                  U5      nU R                  R                  U R                  5      nU" [	        USU R
                  5      S9nU R                  X$5        U R                  X$5        U R                  U R                  U4n/ n[        R                  " U/U R                  U R                  US9n[        R                  " USS9n[        U R                  X5      5      nU(       a  [         R"                  " USS9  US   $ )	z,Yields JSON-serializable dicts of resources.rK   )rK   r8  N)r   zCould not fetch resource:)error_messager   )rn  r   r>  rg  r:  rK   ru  rk  r   MakeRequestsrc   rh   r
   r   listr   r   r   )	r&   rO   r   get_request_classrj  get_requestr   objectsresource_lists	            r)   r   BaseDescriber.Run  s    


t
$C33DKK@Y(MNGc#c#<<g6KF))YY..	G ))'$GM66tKLM
35 r,   rA   rT   )r:   r;   r<   r=   r>   r   r   r   ra  r?   rg  rk  r   r   rn  ru  r   r   r@   rA   r,   r)   r_  r_    ss    0', , 3 3  D 	 	-

r,   r_  c                 0   [         R                  " U 5      nSnSnSnSR                  X 5      SR                  X 5      [        R                  U;   a  UOS[        R
                  U;   a  UOS-   [        R                  U;   a  UOS-   R                  U 5      S.$ )zReturns the detailed help dict for a multiscope describe command.

Args:
  resource: resource name, singular form with no preposition
  scopes: global/regional/zonal or mix of them

Returns:
  Help for multi-scope describe command.
zlTo get details about a zonal {0} in the ``us-central1-b'' zone, run:

  $ {{command}} --zone=us-central1-b

zpTo get details about a regional {0} in the ``us-central1'' regions, run:

  $ {{command}} --region=us-central1

zCTo get details about a global {0}, run:

  $ {{command}} --global

z*Display detailed information about {0} {1}zG
*{{command}}* displays all data associated with {0} {1} in a project.
rJ  r   )r   
GetArticler   r  r  r  r  )r   r  articlerK  rL  rM  s         r)   GetMultiScopeDescriberHelpr    s     OOH%' =*
F7"+"8"8F"B$-$<$<$F BP"+"7"76"ArK 6(#
 r,   a      You can edit the resource below. Lines beginning with "#" are
    ignored.

    If you introduce a syntactic error, you will be given the
    opportunity to edit the file again. You can abort by closing this
    file without saving it.

    At the bottom of this file, you will find an example resource.

    Only fields that can be modified are shown. The original resource
    with all of its fields is reproduced in the comment section at the
    bottom of this document.
    c                     US:X  a?  [         R                  " [        R                  " U SS[	        S5      [	        S5      4S95      $ [         R                  " [
        R                  " U 5      5      $ )z(Serializes value to either JSON or YAML.jsonr  T,z: )indent	sort_keys
separators)six	text_typer  dumpsstrr   dumpvaluefmts     r)   SerializeDictr    sY    F]==

!tS3t98M	OP P ==5)**r,   c                 f    US:X  a  [         R                  " U 5      $ [        R                  " U 5      $ )z$Parses the given JSON or YAML value.r  )r  loadsr   loadr  s     r)   DeserializeValuer  (  s'    F]::e99Ur,   c                    UR                  S5        UR                  U5        UR                  S5        UR                  S[        U5      -  5        UR                  S5        U R                  5        HP  nUR                  S5        U(       d  M  UR                  S5        UR                  U5        UR                  S5        MR     g)	z;Outputs a comment block with the given serialized resource.z# z
# -z
#
#z   
N)writelen
splitlines)serialized_resourcetitlebuflines       r)   WriteResourceInCommentBlockr  0  s    ))D/))E))F))C#e*))G!,,.dIIcNt	ii	iio	iio /r,   c                      [         R                  R                  R                  R	                  5       [         R                  R                  R                  R
                  :H  $ )z7Outputs whether it is running against default universe.)r   rI   rJ   universe_domainrL   r   rA   r,   r)   IsDefaultUniverser  ?  sG     ,,002						/	/	7	78r,   c                      [        5       $ )z*Outputs whether connectivity is supported.)r  rA   r,   r)   SupportNetworkConnectivityTestr  G  s    		r,   c                      g)z!Outputs whether IAP is supported.TrA   rA   r,   r)   
SupportIAPr  L  s    	r,   )Cr>   
__future__r   r   r   r   argparser  textwrapapitools.base.pyr   enumgooglecloudsdk.api_lib.computer   r   r   r	   r
   r   r   r   r   r   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer   r   r   googlecloudsdk.corer   r   r   googlecloudsdk.core.utilr   r  objectr   CommandScopePrompterrC   ListCommandry   r   r   r   r   r   r  Enumr  r  rR  rT  r]  DescribeCommandr_  r  dedentHELPr  r  r  r  r  r  rA   r,   r)   <module>r     sU    6 &  ' 
    %  ^ 9 4 1 < 9 9 9 0 / ( 9 O * ) $ ) 
v >FK$,, < < FKRy'!!; y'x
: 
/dZ 86* 86		 z D>B+ "H?D((+ ?D(V   	 +
r,   