
    r                         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rS rS rS rS rS rS rS rS rg)z%Utils for Config Controller commands.    )absolute_import)division)unicode_literals)api_adapter)util)apis)concepts)concept_parsers)logzNConfig Controller {0} is not running. The kubernetes API may not be available.c                      g)z.Sets default location to '-' for list command.- r       @lib/googlecloudsdk/command_lib/anthos/config/controller/utils.pySetLocationr       s    	r   c                  ,    [         R                  " SSS9$ )Nnamez+The name of the Config Controller instance.r   	help_textr	    ResourceParameterAttributeConfigr   r   r   InstanceAttributeConfigr   %   s    		2	2=
? ?r   c                  ,    [         R                  " SSS9$ )Nlocationa  The name of the Config Controller instance location. Currently, only ``us-central1'', ``us-east1'', ``us-east4'', ``us-east5'', ``us-west2'', ``northamerica-northeast1'', ``northamerica-northeast2'', ``europe-north1'', ``europe-west1'', ``europe-west3'', ``europe-west6'', ``australia-southeast1'', ``australia-southeast2'', ``asia-northeast1'', ``asia-northeast2'' and ``asia-southeast1'' are supported.r   r   r   r   r   LocationAttributeConfigr   +   s    		2	24
 r   c           
      r    [         R                  " SSU [        5       [        5       [         R                  SS9$ )Nz,krmapihosting.projects.locations.krmApiHostsinstanceF)resource_nameapi_versionkrmApiHostsIdlocationsId
projectsIddisable_auto_completers)r	   ResourceSpecr   r    DEFAULT_PROJECT_ATTRIBUTE_CONFIG)r   s    r   GetInstanceResourceSpecr&   :   s6    			4+-)+::#
% %r   c                 t    [         R                  R                  S[        U5      SSS9R	                  U 5        g )Nr   z0The identifier for a Config Controller instance.T)required)r
   ConceptParserForResourcer&   AddToParser)parserr   s     r   AddInstanceResourceArgr-   E   s8    ++k*8	 ,  ![(r   c                 \   SU -   nUnSn[         R                  " S5      n[        R                  R	                  S5        UR                  X#U5      nUR                  U5      nUR                  U5      (       d3  [        R                  " [        R                  UR                  5      5        Xv4$ )zLFetches the information about the GKE cluster backing the Config Controller.zkrmapihost-Nv1z(Fetching cluster endpoint and auth data.)container_api_adapterNewAPIAdapterr   statusPrintParseCluster
GetCluster	IsRunningwarningNOT_RUNNING_MSGformat	clusterId)r   r   
cluster_idlocation_idprojectgke_apicluster_refclusters           r   GetGKEClusterrA   M   s     t#*+'!//5'**=>$$ZgF+{+'			7	#	#KK&&{'<'<=>		r   c                     [         R                  R                  SR                  U R                  U R                  5      5        U $ )z&Print log messages for async commands.z
      Check operation [{}] for status.
      To describe the operation, run:

        $ gcloud anthos config operations describe {})r   r2   r3   r9   r   )	operations    r   AsyncLogrD   _   s7    **9
 vinninn-/ 
r   c                    U R                   R                  R                  5       n[        R                  " SUR                  5       R                  5      n[        R                  " UR                  5       5      n/ nUR                  5       nUR                  UR                  5       S9nU R                  (       a,  UR                  S5        U R                  UR                  l        UR"                  R$                  (       aJ  UR'                  5       nU R(                  (       a"  U R(                  Ul        UR                  S5        Xul        OIUR-                  5       nU R(                  (       a"  U R(                  Ul        UR                  S5        Xl        UR1                  UUS9n	UR3                  U	UR                  5       SR5                  U5      S9$ )	z,Construct a patch request based on the args.krmapihosting)configControllerConfigz=bundles_config.config_controller_config.experimental_featuresz2management_config.full_management_config.man_blockz6management_config.standard_management_config.man_block)managementConfigbundlesConfig,)
krmApiHostr   
updateMask)CONCEPTSr   Parser   GetMessagesModuleGetCollectionInfor   r   GetKrmApiHostRelativeNameManagementConfigBundlesConfigConfigControllerConfigexperimental_featuresappendrG   experimentalFeaturesrH   fullManagementConfigFullManagementConfig	man_blockmanBlockStandardManagementConfigstandardManagementConfig
KrmApiHost5KrmapihostingProjectsLocationsKrmApiHostsPatchRequestjoin)
argsr   messagescurrentupdate_masksmanagement_configbundles_configfull_management_configstandard_management_configpatchs
             r   PatchRequestrk   k   s   ]]%%'(##O$,$>$>$@$L$LN(
 x4467' ,//1))%<<> * @.	GIAEA[A[N))>22%::<~~(,%NO-C*!)!B!B!D~~,0NN )
BD1K.


/@,:  <%		G	G  ",' 
H 
) )r   N)__doc__
__future__r   r   r    googlecloudsdk.api_lib.containerr   r0   $googlecloudsdk.api_lib.krmapihostingr   googlecloudsdk.api_lib.utilr    googlecloudsdk.calliope.conceptsr	   (googlecloudsdk.command_lib.util.conceptsr
   googlecloudsdk.corer   r8   r   r   r   r&   r-   rA   rD   rk   r   r   r   <module>rt      sT    , &  ' Q 5 , 5 D #>
?%)$	')r   