
                            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
 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 ddlmZ ddlmZ dZdZdZej0                   ej2                  ej4                  j6                         G d dej8                                      Zej0                   ej2                  ej4                  j<                         G d de                    Zy)z.Command to update an Edge Container node pool.    )nodepool)util)waiter)base)flags)print_warning)resource_args)labels_util)log)	resources)resource_printerz
To update the number of nodes in a node pool called `my-node-pool` in region `us-central1`,
run:

  $ {command} my-node-pool --location=us-central1 --cluster=<my-cluster>       --node-count=<new-count>
z
  This command uses the edgecontainer/{API} API. The full documentation for this
  API can be found at: https://cloud.google.com/edge-cloud
ic                       e Zd ZdZeej                  ej                  j                  e
j                  j                              dZed        Zd Zy)Update$Updates an Edge Container node pool.API)EXAMPLESAPI REFERENCEc                    t        j                  | d       t        j                  | d       t        j                  |        t        j
                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  j                  |        y )Nz	to updateF)required)r	   AddNodePoolResourceArgcontainer_flagsAddNodeCountAddMachineFilterAddLROMaximumTimeoutAddNodeLabelsForUpdateNodePoolr
   AddUpdateLabelsFlagsAddLocalDiskKMSKeyAddUseGoogleManagedKeyr   
ASYNC_FLAGAddToParser)parsers    >lib/surface/edge_cloud/container/clusters/node_pools/update.pyArgszUpdate.Args:   s    ((=  %8$$V,((0226:$$V,&&v.**62OO'    c                 T   t        j                  |      }t        j                  | j	                               }t        j
                  || j	                               }|j                  j                  |      }t        j                  || j	                         |      }|j                  j                  |      }t        j                  j                  |j                  d      }t        j                  j!                  dj#                  |j$                               t'        j(                  |d      s$dj#                  |j+                               }	t        j,                  |j                  |j.                        }
t0        }t'        j(                  |d      rt3        |j4                        }t7        j8                  |
||	|	      }|j                  j                  |      }t        j                  j!                  d
j#                  |j$                               t;        j                   |dt        j                         t=        j>                  |d       S t        j                  j!                  dj#                  |j+                                      t=        j>                  |d       S )Nz+edgecontainer.projects.locations.operations)
collectionz'Update request issued for: [{nodePool}])nodePoolasync_z/Waiting for operation [{operation}] to complete)	operationlro_timeout)max_wait_mszUpdated node pool [{nodePool}].json)outz)Check operation [{operation}] for status.) r   GetNodePoolReferencer   GetClientInstanceReleaseTrackGetNodePoolGetRequest%projects_locations_clusters_nodePoolsGetGetNodePoolUpdateRequestPatchr   REGISTRYParseRelativeNamenamer   statusPrintformatnodePoolsIdr   FlagIsExplicitlySetRelativeNameOperationPollerprojects_locations_operations_LRO_MAXIMUM_TIMEOUT_intr+   r   WaitForr   r   PrintWarning)selfargsnode_pool_refclientget_reqexisting_node_pool
update_reqopop_refprogress_stringoperation_pollerlro_maximum_timeoutresponseupdated_node_pools                 r#   Runz
Update.RunF   sM   11$7M##D$5$5$78F,,T43D3D3FGGEEII 22d!#5J 
	5	5	;	;J	GB11
I 2 F JJ188".. 	9 	

 $$T84
;
B
B++- C  
 --

6
6

.
. 2		"	"4	7!$"2"23


)	h !FFJJ
 
jj
+
2
2$00 3 
 .CJJG''$77JJ3::))+ 	; 	

 %%b$//r%   N)__name__
__module____qualname____doc__	_EXAMPLES_API_REFERENCE_r<   r   VERSION_MAPgetr   r1   GAdetailed_helpstaticmethodr$   rT    r%   r#   r   r   .   s_     - &--""4#4#4#7#78 . - 	( 	(70r%   r   c                   L    e Zd ZdZeej                  j                  fd       Zy)UpdateAlphar   c                     t         j                  t        j                  j	                  |            t
        j                  d<   t
        j                  |        y)z-Registers alpha track flags for this command.r   r   N)rZ   r<   r   r[   r\   r   r^   r$   )r"   tracks     r#   r$   zUpdateAlpha.Args   sG     -<,B,B  ' -C -F) KKr%   N)	rU   rV   rW   rX   r_   r   r1   ALPHAr$   r`   r%   r#   rb   rb      s(     -**00  r%   rb   N) rX   +googlecloudsdk.api_lib.edge_cloud.containerr   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   /googlecloudsdk.command_lib.edge_cloud.containerr   r   r   r	   googlecloudsdk.command_lib.run$googlecloudsdk.command_lib.util.argsr
   googlecloudsdk.corer   r   googlecloudsdk.core.resourcer   rY   rZ   rB   DefaultUniverseOnlyReleaseTracksr1   r]   UpdateCommandr   re   rb   r`   r%   r#   <module>rq      s    5 @ < . ( T I I 0 < # ) 9	
 !  D%%(()M0T M0 * M0` D%%++,	& 	 - 	r%   