
                         n    d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ  G d dej                        Z
y	)
zCloud vmware Clusters client.    )absolute_import)division)unicode_literals)
list_pager)utilc                   B     e Zd ZdZ fdZd ZddZd Zd Zd Z	 xZ
S )	ClustersClientzcloud vmware Clusters client.c                 `    t         t        |           | j                  j                  | _        y N)superr	   __init__client)projects_locations_privateClouds_clustersservice)self	__class__s    -lib/googlecloudsdk/api_lib/vmware/clusters.pyr   zClustersClient.__init__   s!    	.$(*;;HHDL    c                     | j                   j                  |j                               }| j                  j	                  |      S N)name)messages<VmwareengineProjectsLocationsPrivateCloudsClustersGetRequestRelativeNamer   Getr   resourcerequests      r   r   zClustersClient.Get    s=    mmXX""$ Y &G<<G$$r   c                 L   |j                         j                         }|j                         }t        j                  | j
                  j                  j                  | j
                  j                  |      }| j
                  j                  |      }t        j                  | j
                  j                  | j
                  j                  | j
                  j                  |      |_        | j
                  j                  |||      }| j                  j!                  |      S )N)nodeTypeConfigs)parentcluster	clusterId)Parentr   Namer   #ConstructNodeParameterConfigMessager   ClusterNodeTypeConfigsValueNodeTypeConfig#ConstructAutoscalingSettingsMessageAutoscalingSettingsAutoscalingPolicy
ThresholdsautoscalingSettings?VmwareengineProjectsLocationsPrivateCloudsClustersCreateRequestr   Create)	r   r   nodes_configsautoscaling_settingsr!   
cluster_idnode_type_configsr"   r   s	            r   r0   zClustersClient.Create%   s    __++-FJ@@22$$m5 mm##4E#FG"&"J"J))''  	#G mm[[ \ G
 <<w''r   c                     | j                   j                  |j                               }| j                  j	                  |      S r   )r   ?VmwareengineProjectsLocationsPrivateCloudsClustersDeleteRequestr   r   Deleter   s      r   r7   zClustersClient.Delete:   s=    mm[[""$ \ &G<<w''r   c                     |j                         }| j                  j                  |      }t        j                  | j
                  |dd      S )N)r!   pageSizeclusters)batch_size_attributefield)r   r   =VmwareengineProjectsLocationsPrivateCloudsClustersListRequestr   YieldFromListr   )r   private_cloud_resourceprivate_cloudr   s       r   ListzClustersClient.List?   sR    *779MmmYY Z G ##'	 r   c                 p   d g }}|Lt        j                  | j                  j                  j                  | j                  j
                  |      }dg}|dg}ng }|a|j                  rUt        j                  | j                  j                  | j                  j                  | j                  j                  |      }nd }| j                  j                  ||      }dj                  ||z         }	| j                  j                  |j                         ||	      }
| j                  j                  |
      S )Nznode_type_configs.*.node_countr2   )r    r.   ,)r   r"   
updateMask)r   r&   r   r'   r(   r)   autoscaling_policiesr*   r+   r,   r-   join>VmwareengineProjectsLocationsPrivateCloudsClustersPatchRequestr   r   Patch)r   r   r1   r2   r4   node_type_configs_update_mask autoscaling_settings_update_maskautoscaling_settings_messager"   update_maskr   s              r   UpdatezClustersClient.UpdateJ   s7   7;R4 BB
--


4
4
--
&
&

 (H&H#'*@)A&)+& 	( 55%)%M%M
--
+
+
--
)
)
--
"
"
	&" &*"mm##)8 $ G ((%(HHK mmZZ""$g+ [ G <<g&&r   r   )__name__
__module____qualname____doc__r   r   r0   r7   rA   rM   __classcell__)r   s   @r   r	   r	      s%    %I%
(*(
	)'r   r	   N)rQ   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.vmwarer   VmwareClientBaser	    r   r   <module>rX      s-    $ &  ' ' .Z'T** Z'r   