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

  $ {command} my-nodePool --cluster=<my-cluster> --location=us-central1 --node-location=<my-node-location> --node-count=3

To create a node pool called `my-nodePool`, containing 3 nodes in region `us-central1`,
using only machine names matching a specific pattern, run:

  $ {command} my-nodePool --cluster=<my-cluster> --location=us-central1 --node-location=<my-node-location> --node-count=3 --machine-filter="name:<name>"

To create a node pool called `my-nodePool`, containing 3 nodes in region `us-central1`,
using only machine names NOT matching a specific pattern, run:

  $ {command} my-nodePool --cluster=<my-cluster> --location=us-central1 --node-location=<my-node-location> --node-count=3 --machine-filter="NOT name:<name>"
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)Create#Create an Edge Container node pool.API)EXAMPLESAPI REFERENCEc                    t        j                  | d       t        j                  |        t        j                  |        t        j
                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  j                  |        y )Nz	to create)r	   AddNodePoolResourceArgcontainer_flagsAddNodeCountAddNodeLocationAddNodeStorageSchemaAddMachineFilterAddLocalDiskKMSKeyAddLROMaximumTimeoutAddNodeLabelsForCreateNodePoolr
   AddCreateLabelsFlagsr   
ASYNC_FLAGAddToParser)parsers    >lib/surface/edge_cloud/container/clusters/node_pools/create.pyArgszCreate.ArgsA   s     ((=  (##F+((0$$V,&&v.((0226:$$V,OO'    c                 P   t        j                  |      }t        j                  || j                               }t	        j
                  | j                               }|j                  j                  |      }t        j                  j                  |j                  d      }t        j                  j                  dj                  |j                                t#        j$                  |d      sdj                  |j'                               }t	        j(                  |j                  |j*                        }t,        }	t#        j$                  |d      rt/        |j0                        }	t3        j4                  ||||		      }
t        j                  j                  d
j                  |j                                t7        j8                  |
d       S t        j                  j                  dj                  |j'                                      t7        j8                  |d       S )Nz+edgecontainer.projects.locations.operations)
collectionz'Create request issued for: [{nodePool}])nodePoolasync_z/Waiting for operation [{operation}] to complete)	operationlro_timeout)max_wait_mszCreated node pool [{nodePool}].z)Check operation [{operation}] for status.)r   GetNodePoolReferenceGetNodePoolCreateRequestReleaseTrackr   GetClientInstance%projects_locations_clusters_nodePoolsr   r   REGISTRYParseRelativeNamenamer   statusPrintformatnodePoolsIdr   FlagIsExplicitlySetRelativeNameOperationPollerprojects_locations_operations_LRO_MAXIMUM_TIMEOUT_intr*   r   WaitForr   PrintWarning)selfargsnode_pool_refreqclientopop_refprogress_stringoperation_pollerlro_maximum_timeoutresponses              r"   Runz
Create.RunO   s   11$7M

+
+D$2C2C2E
FC##D$5$5$78F		5	5	<	<S	AB11
I 2 F JJ188".. 	9 	

 $$T84
;
B
B++- C  
 --

6
6

.
. 2		"	"4	7!$"2"23


)	h 
jj
+
2
2$00 3 
 ''$77JJ3::))+ 	; 	

 %%b$//r$   N)__name__
__module____qualname____doc__	_EXAMPLES_API_REFERENCE_r6   r   VERSION_MAPgetr   r.   GAdetailed_helpstaticmethodr#   rK    r$   r"   r   r   5   s_     , &--""4#4#4#7#78 . - ( (-0r$   r   c                   L    e Zd ZdZeej                  j                  fd       Zy)CreateAlphar   c                     t         j                  t        j                  j	                  |            t
        j                  d<   t
        j                  |        t        j                  |        y)z-Registers alpha track flags for this command.r   r   N)
rQ   r6   r   rR   rS   r   rU   r#   r   AddNodeSystemPartitionSize)r!   tracks     r"   r#   zCreateAlpha.Args   sU     -<,B,B  ' -C -F) KK..v6r$   N)	rL   rM   rN   rO   rV   r   r.   ALPHAr#   rW   r$   r"   rY   rY      s&    +**00 7 7r$   rY   N)rO   +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   rP   rQ   r<   DefaultUniverseOnlyReleaseTracksr.   rT   CreateCommandr   r]   rY   rW   r$   r"   <module>rh      s    5 @ < . ( T I I 0 < # )	 
 !  D%%(()E0T E0 * E0P D%%++,
7& 
7 -
7r$   