
                            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  \R&                  " \R(                  R*                  5      \R,                   " S S\R.                  5      5       5       r\R&                  " \R(                  R2                  5       " S S\5      5       r\R&                  " \R(                  R6                  5       " S S\5      5       rS rS rg)zDelete worker pool command.    )absolute_import)division)unicode_literals)cloudbuild_util)client_util)waiter)base)
exceptions)log)
properties)	resourcesc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
Delete   z&Delete a worker pool from Cloud Build.z{description}z          To delete a worker pool named `wp1` in region `us-central1`, run:

            $ {command} wp1 --region=us-central1
          )DESCRIPTIONEXAMPLESc                 D    U R                  SSS9  U R                  SSS9  g)Register 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.
--region*The Cloud region where the worker pool is.helpWORKER_POOL$The ID of the worker pool to delete.N)add_argumentparsers    )lib/surface/builds/worker_pools/delete.pyArgsDelete.Args/   s9     9  ; B  D    c                 6    [        XR                  5       5        g)This 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.
N)_DeleteWorkerPoolFirstGenReleaseTrackselfargss     r   Run
Delete.Run=   s     d$5$5$78r!    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r)   __static_attributes__r+   r!   r   r   r      s3     / 		- D D9r!   r   c                   .    \ rS rSrSr\S 5       rS rSrg)
DeleteBetaK   z-Delete a worker pool from Google Cloud Build.c                 p    U R                  SSS9  U R                  SS[        SS9  U R                  SS	S9  g
r   r   r   r   --generation   zGeneration of the worker pool.)defaulttyper   r   r   Nr   intr   s    r   r   DeleteBeta.ArgsO   Z     9  ; .	  1
 B  Dr!   c                     UR                   S:X  a  [        XR                  5       5        gUR                   S:X  a  [        U5        g[        R
                  " SS5      er#   r:      r9   z=please use one of the following valid generation values: 1, 2N
generationr$   r%   _DeleteWorkerPoolSecondGenr
   InvalidArgumentExceptionr&   s     r   r)   DeleteBeta.Runb   N     !&7&7&9:	A	 &//

I r!   r+   N	r,   r-   r.   r/   r0   r2   r   r)   r3   r+   r!   r   r5   r5   K   s    5D D$r!   r5   c                   .    \ rS rSrSr\S 5       rS rSrg)DeleteAlphax   z5Delete a private worker pool from Google Cloud Build.c                 p    U R                  SSS9  U R                  SS[        SS9  U R                  SS	S9  g
r8   r=   r   s    r   r   DeleteAlpha.Args|   r@   r!   c                     UR                   S:X  a  [        XR                  5       5        gUR                   S:X  a  [        U5        g[        R
                  " SS5      erB   rD   r&   s     r   r)   DeleteAlpha.Run   rI   r!   r+   NrJ   r+   r!   r   rL   rL   x   s    =D D$r!   rL   c           	         [         R                  " 5       nUR                  nU R                  nU(       d2  [        R
                  R                  R                  R                  5       n[        R                  R                  SS[         R                  [        R
                  R                  R                  R                  SS9UU R                  S.S9nUR                   R#                  UR%                  UR'                  5       S95      n[        R                  R)                  UR*                  SS	9n[,        R.                  " [,        R0                  " UR2                  5      US
SS9  [4        R6                  " U5        g)zDeletes a Worker Pool Second Generation.

Args:
  args: an argparse namespace. All the arguments that were provided to the
      delete command invocation.
Nz1cloudbuild.projects.locations.workerPoolSecondGenTrequired)
projectsIdlocationsIdworkerPoolSecondGenId
collectionapi_versionparamsname(cloudbuild.projects.locations.operationsrY   zDeleting worker pool second gen6 max_wait_ms)cloudbuild_v2_utilGetClientInstanceMESSAGES_MODULEregionr   VALUESbuilds	GetOrFailr   REGISTRYParseGA_API_VERSIONcoreprojectGetr   &projects_locations_workerPoolSecondGenr   ;CloudbuildProjectsLocationsWorkerPoolSecondGenDeleteRequestRelativeNameParseRelativeNamer]   r   WaitForCloudOperationPollerNoResourcesprojects_locations_operationsr   DeletedResource)r(   clientmessages	wp_regionwp_resource
deleted_opop_resources          r   rF   rF      sE    //1&##(kk)	!!((//99;I ""((
D$33"))..66::D:I"#'#3#3	 ) 	+ <<CCJJ'') K +,* ""44oo"L 5 N+..,,

.
.01<'	 k"r!   c           	         U R                   nU(       d2  [        R                  R                  R                   R	                  5       n[
        R                  " U5      nUR                  n[        R                  R                  R                  R                  SS9nU R                  n[        R                  R                  SS[
        R                  U   UUUS.S9nUR                   R#                  UR%                  UR'                  5       S95      n[        R                  R)                  UR*                  SS	9n	[,        R.                  " [,        R0                  " UR2                  5      U	S
SS9  [4        R6                  " U5        g)zDeletes a Worker Pool First Generation.

Args:
  args: an argparse namespace. All the arguments that were provided to the
      delete command invocation.
  release_track: The desired value of the enum
    googlecloudsdk.calliope.base.ReleaseTrack.
TrS   Nz)cloudbuild.projects.locations.workerPools)rU   rV   workerPoolsIdrX   r\   r^   r_   zDeleting worker poolr`   ra   )rf   r   rg   rh   ri   r   rd   re   rm   rn   ro   r   r   rj   rk   RELEASE_TRACK_TO_API_VERSIONprojects_locations_workerPoolsr   3CloudbuildProjectsLocationsWorkerPoolsDeleteRequestrr   rs   r]   r   rt   ru   rv   r   rw   )
r(   release_trackrz   rx   ry   parentwp_namer{   r|   r}   s
             r   r$   r$      sV    kk)	!!((//99;I,,];&##(!!))--t-<&' ""((
<!>>}M""	 ) 	+ 44;;BB'') C +,* ""44oo"L 5 N+..,,

.
.01<	 k"r!   N)r0   
__future__r   r   r   !googlecloudsdk.api_lib.cloudbuildr   $googlecloudsdk.api_lib.cloudbuild.v2r   rc   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   r
   googlecloudsdk.corer   r   r   ReleaseTracksr%   GAUniverseCompatibleDeleteCommandr   BETAr5   ALPHArL   rF   r$   r+   r!   r   <module>r      s    " &  ' = R . ( . # * ) D%%(()'9T '9  *'9T D%%**+) ) ,)X D%%++,)& ) -)X&#R,#r!   