
    [                     D   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SKJr  SSKJr  SSKJr  SSKJr  \R*                  " \R,                  R.                  5      \R0                   " S S\R2                  5      5       5       rS rg)zCreate worker pool command.    )absolute_import)division)unicode_literals)cloudbuild_exceptions)workerpool_config)client_util)
input_util)waiter)base)
exceptions)log)
properties)	resourcesc                   .    \ rS rSrSr\S 5       rS rSrg)CreateAlpha!   z-Create a private pool for use by Cloud Build.c                     U R                  SSSS9  U R                  SSS9  U R                  SS	[        S
S9  U R                  R                  S5        g)zRegister flags for this command.

Args:
  parser: An argparse.ArgumentParser-like object. It is mocked out in order
    to capture some information, but behaves like an ArgumentParser.
z--fileTz;The YAML file to use as the worker pool configuration file.)requiredhelpz--regionzRegion for Cloud Build.)r   --generation   zGeneration of the worker pool.)defaulttyper   z
          table(
            name.segment(-1),
            createTime.date('%Y-%m-%dT%H:%M:%S%Oz', undefined='-'),
            state
          )
        N)add_argumentintdisplay_info	AddFormat)parsers    (lib/surface/builds/worker_pools/apply.pyArgsCreateAlpha.Args&   sx     J  L &  ( .	   !! #     c                     UR                   S:X  a  [        R                  " SS5      eUR                   S:X  a  [        U5      $ [        R                  " SS5      e)zThis is what gets called when the user runs this command.

Args:
  args: an argparse namespace. All the arguments that were provided to this
    command invocation.

Returns:
  Some value that we want to have printed later.
   r   zzfor generation=1 please use the gcloud commands "gcloud builds worker-pools create" or "gcloud builds worker-pools update"r   z=please use one of the following valid generation values: 1, 2)
generationr   InvalidArgumentException_CreateWorkerPoolSecondGen)selfargss     r   RunCreateAlpha.RunC   s^     !//
I 
 !'--

-
-G r"    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr    r*   __static_attributes__r,   r"   r   r   r   !   s     6 8r"   r   c           	      p   U R                   nU(       d2  [        R                  R                  R                   R	                  5       n[
        R                  " 5       nUR                  n [        R                  " U R                  UR                  5      nUR                  bd  UR                  R                  bM  UR                  R                  R                  (       a(  UR                  R                  c  SUR                  l        [*        R,                  " U R                  5      nUS   n[.        R0                  R3                  SS[
        R4                  [        R                  R6                  R8                  R;                  SS9UUS.S9n[
        R<                  " U5      n	UR?                  URA                  5       US	RC                  U	5      SS
9n
URD                  RG                  U
5      n[.        R0                  RI                  URJ                  SS9n[L        RN                  " [L        RP                  " URD                  URR                  5      USRU                  U R                  URA                  5       S95      nU$ ! [         R"                   a&  n[$        R&                  R)                  S5        UeSnAff = f)zCreates a worker pool second generation.

Args:
  args: an argparse namespace. All the arguments that were provided to the
      create command invocation.

Returns:
  A worker pool second generation resource.
NTz
Failed to parse configuration from file. If you were a Private Preview user, note that the format for this file has changed slightly for GA.
namez1cloudbuild.projects.locations.workerPoolSecondGen)r   )
projectsIdlocationsIdworkerPoolSecondGenId)
collectionapi_versionparams,)r5   workerPoolSecondGen
updateMaskallowMissingz(cloudbuild.projects.locations.operations)r9   z0Applying {file} as worker pool second gen {name})filer5   )+regionr   VALUESbuilds	GetOrFailcloudbuild_v2_utilGetClientInstanceMESSAGES_MODULEr   LoadWorkerpoolConfigFromPathr@   WorkerPoolSecondGennetworkprivateServiceConnectrouteAllTrafficpublicIpAddressDisabledr   ParseProtoExceptionr   errPrintr	   LoadYamlFromPathr   REGISTRYParseGA_API_VERSIONcoreprojectGetMessageToFieldPaths:CloudbuildProjectsLocationsWorkerPoolSecondGenPatchRequestRelativeNamejoin&projects_locations_workerPoolSecondGenPatchParseRelativeNamer5   r
   WaitForCloudOperationPollerprojects_locations_operationsformat)r)   	wp_regionclientmessageswpsgrO   	yaml_dataworkerpoolsecondgen_idwp_resourceupdate_maskreq
updated_opop_resource
updated_wps                 r   r'   r'   ]   sL    kk)	!!((//99;I//1&##(99		8//D 	 LL..:LL..>>LL008-1dll* ))$))4)$V,""((
D$33"))..66::D:I"#9	 ) 	+ #66t<+KK##%+&	 	L 	# <<BB3G*""44oo"L 5 + ~~!!

7
7

.
. 8??yy{779 @ 	* 
] 
	2	2 GGMM	/0 Is   (BI; ;J5!J00J5N)r1   
__future__r   r   r   !googlecloudsdk.api_lib.cloudbuildr   r   $googlecloudsdk.api_lib.cloudbuild.v2r   rE   r	   googlecloudsdk.api_lib.utilr
   googlecloudsdk.callioper   r   googlecloudsdk.corer   r   r   ReleaseTracksReleaseTrackALPHAUniverseCompatibleCreateCommandr   r'   r,   r"   r   <module>rz      s~    " &  ' C ? R ; . ( . # * ) D%%++,7$$$ 7  -7tLr"   