
    C1                         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
\R                  5      r " S S\5      r " S S\5      r " S S\5      rg)z=Base class for gkemulticloud API clients for Azure resources.    )absolute_import)division)unicode_literals)client)update_mask)resource_args)flagsc                   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g)_AzureClientBase   z/Base class for Azure gkemulticloud API clients.c                    [        US5      (       a:  UR                  S5      (       a$  [        R                  " U5      R	                  5       OS nU R
                  R                  nU R                  X$5      U R                  U5      UU R                  U5      [        R                  " U5      U R                  U5      [        R                  " U5      U R                  U5      [        R                  " U5      [        R                   " U5      UR"                  U R%                  U5      [        R&                  " U5      S.n[)        UR+                  5       5      (       a  U R
                  R                  " S0 UD6$ S $ )Nr   )annotationsauthorizationazureClientazureServicesAuthenticationazureRegioncontrolPlanedescriptionfleetloggingConfigmonitoringConfigname
networkingresourceGroupId )hasattrIsSpecifiedr   ParseAzureClientResourceArgRelativeName	_messages&GoogleCloudGkemulticloudV1AzureCluster_Annotations_Authorization_AzureServicesAuthenticationr	   GetAzureRegion_ControlPlaneGetDescription_Fleet
GetLoggingGetMonitoringConfigazureClustersId_ClusterNetworkingGetResourceGroupIdanyvalues)selfcluster_refargsazure_clientcluster_typekwargss         ;lib/googlecloudsdk/api_lib/container/gkemulticloud/azure.py_Cluster_AzureClientBase._Cluster   s7    4""t'7'7'A'A 	11$7DDF 
 >>HHL((<,,T2#'+'H'H'N++D1**40++D1T"))$/!55d;++--d3 33D9F" v}} 	==GG     c                     [         R                  " U5      [         R                  " U5      S.n[        UR	                  5       5      (       d  g U R
                  R                  " S0 UD6$ )N)applicationIdtenantIdr   )r	   GetAzureApplicationIDGetAzureTenantIDr.   r/   r    5GoogleCloudGkemulticloudV1AzureServicesAuthenticationr0   r2   r5   s      r6   r$   -_AzureClientBase._AzureServicesAuthentication:   sZ    44T:**40F v}}>>OO 
 r9   c                     [        USS 5      UR                  [        USS 5      S.n[        UR                  5       5      (       a  U R                  R
                  " S0 UD6$ S $ )Napp_id	tenant_id)r;   r   r<   r   )getattrazureClientsIdr.   r/   r    %GoogleCloudGkemulticloudV1AzureClient)r0   
client_refr2   r5   s       r6   _Client_AzureClientBase._ClientE   sc     x6))D+t4F v}} 	<<FvF r9   c                    U R                   R                  nU R                  X#5      U R                  U5      [        R
                  " U5      U R                  U5      U R                  U5      U R                  U5      UR                  [        R                  " U5      [        R                  " U5      S.	n[        UR                  5       5      (       a  U R                   R                  " S0 UD6$ S $ )N)	r   autoscalingazureAvailabilityZoneconfig
managementmaxPodsConstraintr   subnetIdversionr   )r    'GoogleCloudGkemulticloudV1AzureNodePoolr"   _Autoscalingr	   GetAzureAvailabilityZone_NodeConfig_NodeManagement_MaxPodsConstraintazureNodePoolsIdGetSubnetIDGetNodeVersionr.   r/   )r0   node_pool_refr2   nodepool_typer5   s        r6   	_NodePool_AzureClientBase._NodePoolQ   s    NNJJM((=((.!&!?!?!E""4(**40!44T:..%%d+''-
F v}} 	>>HH r9   c                     0 nUS:X  a  [         R                  " U5      US'   OUS:X  a  [         R                  " U5      US'   [        UR	                  5       5      (       a  U R
                  R                  " S0 UD6$ S $ )NrootsizeGibmainr   )r	   GetRootVolumeSizeGetMainVolumeSizer.   r/   r    +GoogleCloudGkemulticloudV1AzureDiskTemplate)r0   r2   kindr5   s       r6   _DiskTemplate_AzureClientBase._DiskTemplated   sx    Fv~11$7fY	11$7fY v}} 	BBLVL r9   c                     [         R                  " U5      [         R                  " U5      S.n[        UR	                  5       5      (       a  U R
                  R                  " S0 UD6$ S $ )N)r   secretIdr   )r	   GetProxyResourceGroupIdGetProxySecretIdr.   r/   r    *GoogleCloudGkemulticloudV1AzureProxyConfigr@   s      r6   _ProxyConfig_AzureClientBase._ProxyConfigp   s^     88>**40F v}} 	AAKFK r9   c                     [         R                  " U5      [         R                  " U5      S.n[        UR	                  5       5      (       a  U R
                  R                  " S0 UD6$ S $ )N)keyId	publicKeyr   )r	   GetConfigEncryptionKeyIdGetConfigEncryptionPublicKeyr.   r/   r    /GoogleCloudGkemulticloudV1AzureConfigEncryptionr@   s      r6   _ConfigEncryption"_AzureClientBase._ConfigEncryption{   s^    //577=F v}} 	FFPP r9   c                    [         R                  " U5      n[         R                  " U5      nU(       d  U(       d  g 0 nU(       a-  U Vs/ s H  nU R                  R	                  US9PM     snUS'   U(       a-  U Vs/ s H  nU R                  R                  US9PM     snUS'   [        UR                  5       5      (       d  g U R                  R                  " S0 UD6$ s  snf s  snf )N)username
adminUsers)groupadminGroupsr   )	r	   GetAdminUsersGetAdminGroupsr    *GoogleCloudGkemulticloudV1AzureClusterUser+GoogleCloudGkemulticloudV1AzureClusterGroupr.   r/   ,GoogleCloudGkemulticloudV1AzureAuthorization)r0   r2   admin_usersadmin_groupsr5   ugs          r6   r#   _AzureClientBase._Authorization   s    %%d+K''-L|F
 	 a ..
C
C D  	f\   a ..
D
D1
D
Mf] v}}CC 	
	
s   	#C!=#C&c                 &   [         R                  " U5      [         R                  " U5      [         R                  " U5      [         R                  " U5      S.n[        UR                  5       5      (       d  g U R                  R                  " S0 UD6$ )N)podAddressCidrBlocksserviceAddressCidrBlocksserviceLoadBalancerSubnetIdvirtualNetworkIdr   )	r	   GetPodAddressCidrBlocksGetServiceAddressCidrBlocksGetServiceLoadBalancerSubnetId	GetVnetIdr.   r/   r    0GoogleCloudGkemulticloudV1AzureClusterNetworkingr@   s      r6   r,   #_AzureClientBase._ClusterNetworking   sy     % = =d C$)$E$Ed$K','K'K(
 "OOD1F v}}>>JJ 
 r9   c                 b   U R                   R                  nU R                  U5      U R                  U5      [        R
                  " U5      U R                  US5      U R                  U5      [        R                  " U5      U R                  US5      U R                  U5      [        R                  " U5      U R                  X5      [        R                  " U5      [        R                  " U5      S.n[        UR                  5       5      (       a  U R                   R                  " S0 UD6$ S $ )Nrc   ra   )configEncryptiondatabaseEncryptionendpointSubnetId
mainVolumeproxyConfigreplicaPlacements
rootVolume	sshConfigrQ   tagsrR   vmSizer   )r    +GoogleCloudGkemulticloudV1AzureControlPlanerw   _DatabaseEncryptionr	   GetEndpointSubnetIdrh   ro   GetReplicaPlacements
_SshConfigrZ   _TagsGetClusterVersion	GetVMSizer.   r/   )r0   r2   control_plane_typer5   s       r6   r&   _AzureClientBase._ControlPlane   s    BB  !2248"66t<!55d;((v6((."77=((v6__T*%%d+

44**40//$'F  v}} 	BBLVL r9   c                     S[         R                  " U5      0n[        UR                  5       5      (       a  U R                  R
                  " S0 UD6$ S $ )NauthorizedKeyr   )r	   GetSSHPublicKeyr.   r/   r    (GoogleCloudGkemulticloudV1AzureSshConfigr@   s      r6   r   _AzureClientBase._SshConfig   sR    ..t4F
 v}} 	??I&I r9   c                     S[         R                  " U5      0n[        UR                  5       5      (       d  g U R                  R
                  " S0 UD6$ )Nrr   r   )r	   GetDatabaseEncryptionKeyIdr.   r/   r    1GoogleCloudGkemulticloudV1AzureDatabaseEncryptionr@   s      r6   r   $_AzureClientBase._DatabaseEncryption   sN    11$7F v}}>>KK 
 r9   c                     [         R                  " U5      [         R                  " U5      S.n[        UR	                  5       5      (       d  g U R
                  R                  " S0 UD6$ )N)minNodeCountmaxNodeCountr   )r	   GetMinNodesGetMaxNodesr.   r/   r    2GoogleCloudGkemulticloudV1AzureNodePoolAutoscalingr@   s      r6   rT   _AzureClientBase._Autoscaling   sZ    ))$/))$/F v}}>>LL 
 r9   c                    U R                   R                  nU R                  U5      [        R                  " U5      U R                  X5      U R                  U5      U R                  US5      U R                  U5      U R                  X5      [        R                  " U5      [        R                  " U5      S.	n[        UR                  5       5      (       a  U R                   R                  " S0 UD6$ S $ )Nra   )	r   	imageTypelabelsr   r   r   r   taintsr   r   )r    )GoogleCloudGkemulticloudV1AzureNodeConfigrw   r	   GetImageType_Labelsro   rh   r   r   GetNodeTaintsr   r.   r/   )r0   r2   node_config_typer5   s       r6   rV   _AzureClientBase._NodeConfig   s    ~~OO 2248''-,,t6((.((v6__T*

42%%d+//$'
F v}} 	@@J6J r9   c                     S[         R                  " U5      0n[        UR                  5       5      (       a  U R                  R
                  " S0 UD6$ S $ )N
autoRepairr   )r	   GetAutoRepairr.   r/   r    -GoogleCloudGkemulticloudV1AzureNodeManagementr@   s      r6   rW    _AzureClientBase._NodeManagement   sR    e))$/F
 v}} 	DDNvN r9   r   N)__name__
__module____qualname____firstlineno____doc__r7   r$   rI   r^   rh   ro   rw   r#   r,   r&   r   r   rT   rV   rW   __static_attributes__r   r9   r6   r   r      sP    78	
&
		40	&r9   r   c                   >   ^  \ rS rSrSrU 4S jrS rS rS rSr	U =r
$ )ClustersClienti  z3Client for Azure Clusters in the gkemulticloud API.c                 r   > [         [        U ]
  " S0 UD6  U R                  R                  U l        SU l        g )NazureClustersr   )superr   __init___client projects_locations_azureClusters_service_list_result_fieldr0   r5   	__class__s     r6   r   ClustersClient.__init__  s.    	.$(262LLAADM-Dr9   c                    U R                   R                  UR                  U R                  X5      UR	                  5       R                  5       [        R                  " U5      S9nU R                  R                  U5      $ )z&Creates a new Anthos cluster on Azure.)azureClusterId&googleCloudGkemulticloudV1AzureClusterparentvalidateOnly)
r    8GkemulticloudProjectsLocationsAzureClustersCreateRequestr+   r7   Parentr   r	   GetValidateOnlyr   Creater0   r1   r2   reqs       r6   r   ClustersClient.Create  su     	OO&6637==4 %%'446..t4 	P 	
  ==$$r9   c                     U R                   R                  S5      " UR                  5       S9nU R                   R                  U5      $ )z/Generates an access token for an Azure cluster.GenerateAzureAccessToken)azureCluster)r   GetRequestTyper   r   )r0   r1   r   s      r6   GenerateAccessToken"ClustersClient.GenerateAccessToken  s?    
--
&
&'A
B --/C ==11#66r9   c                    U R                   R                  U R                  X5      UR                  5       [        R
                  " U[        R                  5      [        R                  " U5      S9nU R                  R                  U5      $ )z#Updates an Anthos cluster on Azure.)r   r   
updateMaskr   )r    7GkemulticloudProjectsLocationsAzureClustersPatchRequestr7   r   r   GetUpdateMask"AZURE_CLUSTER_ARGS_TO_UPDATE_MASKSr	   r   r   Patchr   s       r6   UpdateClustersClient.Update!  s~     	NN37==4 ))+"00kDD ..t4 	O 		
  ==s##r9   r   r   )r   r   r   r   r   r   r   r   r   r   __classcell__r   s   @r6   r   r     s    ;.
%7$ $r9   r   c                   8   ^  \ rS rSrSrU 4S jrS rS rSrU =r	$ )NodePoolsClienti2  z5Client for Azure Node Pools in the gkemulticloud API.c                 r   > [         [        U ]
  " S0 UD6  U R                  R                  U l        SU l        g )NazureNodePoolsr   )r   r   r   r   /projects_locations_azureClusters_azureNodePoolsr   r   r   s     r6   r   NodePoolsClient.__init__5  s.    	/4)3F3LLPPDM.Dr9   c                    U R                   R                  UR                  U R                  X5      UR	                  5       R                  5       [        R                  " U5      S9nU R                  R                  U5      $ )z2Creates a node pool in an Anthos cluster on Azure.)azureNodePoolId'googleCloudGkemulticloudV1AzureNodePoolr   r   )
r    FGkemulticloudProjectsLocationsAzureClustersAzureNodePoolsCreateRequestrY   r^   r   r   r	   r   r   r   r0   nodepool_refr2   r   s       r6   r   NodePoolsClient.Create:  sp    
..
_
_$55041
 ""$113**40 ` C ==$$r9   c                    U R                   R                  U R                  X5      UR                  5       [        R
                  " U[        R                  5      [        R                  " U5      S9nU R                  R                  U5      $ )z2Updates a node pool in an Anthos cluster on Azure.)r   r   r   r   )r    EGkemulticloudProjectsLocationsAzureClustersAzureNodePoolsPatchRequestr^   r   r   r   #AZURE_NODEPOOL_ARGS_TO_UPDATE_MASKSr	   r   r   r   r  s       r6   r   NodePoolsClient.UpdateF  sy    
..
^
^041
 &&(,,+AA
 **40 _ 	C ==s##r9   r   )
r   r   r   r   r   r   r   r   r   r   r   s   @r6   r   r   2  s    =/

%$ $r9   r   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )ClientsClientiU  z2Client for Azure Clients in the gkemulticloud API.c                 r   > [         [        U ]
  " S0 UD6  U R                  R                  U l        SU l        g )NazureClientsr   )r   r	  r   r   projects_locations_azureClientsr   r   r   s     r6   r   ClientsClient.__init__X  s.    	-'1&1LL@@DM,Dr9   c                    U R                   R                  U R                  X5      UR                  UR	                  5       R                  5       [        R                  " U5      S9nU R                  R                  U5      $ )zCreates a new Azure client.)%googleCloudGkemulticloudV1AzureClientazureClientIdr   r   )
r    7GkemulticloudProjectsLocationsAzureClientsCreateRequestrI   rF   r   r   r	   r   r   r   )r0   rH   r2   r   s       r6   r   ClientsClient.Create]  su     	NN26,,3 %33$$&335..t4 	O 	
  ==$$r9   r   )	r   r   r   r   r   r   r   r   r   r   s   @r6   r	  r	  U  s    :-
% %r9   r	  N)r   
__future__r   r   r   .googlecloudsdk.api_lib.container.gkemulticloudr   r   *googlecloudsdk.command_lib.container.azurer   2googlecloudsdk.command_lib.container.gkemulticloudr	   
ClientBaser   r   r   r	  r   r9   r6   <module>r     s^    D &  ' A F D Dfv(( fR+$% +$\ $&  $F%$ %r9   