
                            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  \	R                  " \	R                   R"                  5      \	R$                   " S
 S\	R&                  5      5       5       r\	R                  " \	R                   R*                  5       " S S\5      5       r\	R                  " \	R                   R.                  5       " S S\5      5       rS rS rg)zDelete worker pool command.    )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)
DeleteBetaH   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.ArgsL   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    r7      r6   z=please use one of the following valid generation values: 1, 2N
generationr!   r"   _DeleteWorkerPoolSecondGenr   InvalidArgumentExceptionr#   s     r   r&   DeleteBeta.Run_   N     !&7&7&9:	A	 &//

I r   r(   N	r)   r*   r+   r,   r-   r/   r   r&   r0   r(   r   r   r2   r2   H   s    5D D$r   r2   c                   .    \ rS rSrSr\S 5       rS rSrg)DeleteAlphau   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
r5   r:   r   s    r   r   DeleteAlpha.Argsy   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r?   rA   r#   s     r   r&   DeleteAlpha.Run   rF   r   r(   NrG   r(   r   r   rI   rI   u   s    =D D$r   rI   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rV   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ParseRelativeNamerZ   r   WaitForCloudOperationPollerNoResourcesprojects_locations_operationsr   DeletedResource)r%   clientmessages	wp_regionwp_resource
deleted_opop_resources          r   rC   rC      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.
TrP   Nz)cloudbuild.projects.locations.workerPools)rR   rS   workerPoolsIdrU   rY   r[   r\   zDeleting worker poolr]   r^   )rc   r	   rd   re   rf   r   ra   rb   rj   rk   rl   r   r
   rg   rh   RELEASE_TRACK_TO_API_VERSIONprojects_locations_workerPoolsr   3CloudbuildProjectsLocationsWorkerPoolsDeleteRequestro   rp   rZ   r   rq   rr   rs   r   rt   )
r%   release_trackrw   ru   rv   parentwp_namerx   ry   rz   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)r-   !googlecloudsdk.api_lib.cloudbuildr   $googlecloudsdk.api_lib.cloudbuild.v2r   r`   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   r   googlecloudsdk.corer   r	   r
   ReleaseTracksr"   GAUniverseCompatibleDeleteCommandr   BETAr2   ALPHArI   rC   r!   r(   r   r   <module>r      s    " > R . ( . # * ) D%%(()'9T '9  *'9T D%%**+) ) ,)X D%%++,)& ) -)X&#R,#r   