
    K                        S 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  \	R(                  " \	R*                  R,                  5       " S S\R.                  5      5       rS rS rS rg)zDThe command to describe the status of the Config Management Feature.    )absolute_import)division)unicode_literals)util)base)	resources)utils)log)yaml)semverc                   2    \ rS rSrSrSr\S 5       rS rSr	g)Fetch   a3  Prints the Config Management configuration applied to the given membership.

The output is in the format that is used by the apply subcommand. The fields
that have not been configured will be shown with default values.

## EXAMPLES

To fetch the applied Config Management configuration, run:

  $ {command}
configmanagementc                 0    [         R                  " U5        g N)r   AddMembershipResourceArg)clsparsers     @lib/surface/container/fleet/config_management/fetch_for_apply.pyArgs
Fetch.Args/   s    &&v.    c                 x   [         R                  " USSSS9nU R                  5       nS n[        R                  " X25      nU R
                  R                  UR                  5      R                  5        HF  u  pg[        R                  " U5      [        R                  " U5      :X  d  M5  Uc  M:  UR                  nMH     Uc.  [        R                  R                  SR                  U5      5        [         R"                  " [        R$                  5      nUS   n	['        XIU5        [)        XIU5        [+        XI5        U$ )NT)prompt
autoselectsearchzMembership {} not initializedspec)r   ParseMembership
GetFeaturer	   !get_backfill_version_from_feature	hubclientToPyDictmembershipSpecsitemsr   MembershipPartialNamer   r
   statusPrintformatr   loadAPPLY_SPEC_VERSION_1merge_config_syncmerge_policy_controllermerge_hierarchy_controller)
selfargs
membershipfmembership_specversion	full_namer   templatefull_configs
             r   Run	Fetch.Run3   s   %%Td4J 	AO55aDG>>2213D3DEKKM	

$
$Y
/''
34// N 	jj6==jIJ yy334H6"KoG<O'B<Or    N)
__name__
__module____qualname____firstlineno____doc__feature_nameclassmethodr   r8   __static_attributes__r:   r   r   r   r      s%    
 $,/ /r   r   c                 <   U (       a  U R                   (       d  gU[        R                     nU R                   R                  nU R                   R                  nU R                   R
                  b  U R                   R
                  US'   O5U(       a  UR                  (       d  U(       a  UR                  (       a  SUS'   U R                   R                  (       a  U R                   R                  US'   U(       a<  [        R                  " U5      [        R                  " [        R                  5      :  a5  U R                   R                  (       a  U R                   R                  US'   OUS	 U(       d  U(       d  gU(       a<  [        R                  " U5      [        R                  " [        R                  5      :  a  U(       a  SUS'   OU(       a  SUS'   OUS	 US   (       a`  US   S:X  aW  UR                  (       a  UR                  US	'   S
 H0  n[        XV5      (       d  M  [        XV5      c  M#  [        XV5      X6'   M2     gUR                  (       a  UR                  US	'   S H0  n[        XF5      (       d  M  [        XF5      c  M#  [        XF5      X6'   M2     g)  Merge configSync set in feature spec with the config template.

ConfigSync has nested object structs need to be flatten.

Args:
  spec: the ConfigManagementMembershipSpec message
  config: the dict loaded from full config template
  version: the version string of the membership
NenabledTsourceFormatpreventDriftgit
sourceTypeocisyncWait)	policyDir
secretTypesyncRepogcpServiceAccountEmail)rL   
httpsProxyrM   
syncBranchrN   syncRevrO   )
configSyncr	   CONFIG_SYNCrH   rJ   rE   rN   rF   r   SemVerPREVENT_DRIFT_VERSIONrG   OCI_SUPPORT_VERSIONsyncWaitSecshasattrgetattr)r   configr4   csrH   rJ   fields          r   r,   r,   P   s    
T__
e "##	__(OO++ByM 	##,,bm	__!!55B~	FMM'*fmm!!/  ##??77b
>	S
	FMM'*fmm/  b	b
<"\*e3
''bn 
		!4!@C'	 ''bn 
		!4!@C'	r   c                 H   U (       a  U R                   (       d  gU[        R                     n[        U[        R                     5       HQ  n[	        U R                   U5      (       d  M   [        U R                   U5      c  M9  [        U R                   U5      X4'   MS     U(       + =(       d;    [        R                  " U5      [        R                  " [        R                  5      :  nU R                   R                  nU(       d  UR                  SS5        gU(       a  XcS'   gg)rD   N
monitoring)policyControllerr	   POLICY_CONTROLLERlistrY   rZ   r   rU   MONITORING_VERSIONr_   pop)r   r[   r4   cr]   valid_versionspec_monitorings          r   r-   r-      s     
T**
U$$%!F52234e%%u--D))51=..6ah 5 + w!76==< "- ))44/	EE,%lO r   c                 >   U (       a  U R                   (       d  g U[        R                     n[        U[        R                     5       HQ  n[	        U R                   U5      (       d  M   [        U R                   U5      c  M9  [        U R                   U5      X#'   MS     g r   )hierarchyControllerr	   HNCrb   rY   rZ   )r   r[   re   r]   s       r   r.   r.      sp    	T--
UYY!F599%&e((%00D,,e4@1159ah 'r   N)r?   
__future__r   r   r   &googlecloudsdk.api_lib.container.fleetr   googlecloudsdk.callioper   calliope_base*googlecloudsdk.command_lib.container.fleetr   <googlecloudsdk.command_lib.container.fleet.config_managementr	   3googlecloudsdk.command_lib.container.fleet.featuresgooglecloudsdk.corer
   r   googlecloudsdk.core.utilr   ReleaseTracksReleaseTrackALPHADescribeCommandr   r,   r-   r.   r:   r   r   <module>rx      sv    K &  ' 7 9 @ N D # $ + ]77==>-D   - ?-`D(N&<	:r   