
                             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r\R                    " S S\R"                  5      5       rg)zCancel build command.    )absolute_import)division)unicode_literals)cloudbuild_util)base)flags)log)
properties)	resourcesNc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g)	Cancel   zCancel an ongoing build.z
            To cancel a build `123-456-789`:

                $ {command} '123-456-789'

            You may also cancel multiple builds at the same time:

                $ {command} '123-456-789', '987-654-321'
            )DESCRIPTIONEXAMPLESc                     [         R                  " U 5        U R                  S[         R                  SSS9  U R                  R                  S 5        g )Nbuilds+zIDs of builds to cancel)	completernargshelp)r   AddRegionFlagadd_argumentBuildsCompleterdisplay_info	AddFormat)parsers    lib/surface/builds/cancel.pyArgsCancel.Args0   sK    	
''&	  (
 !!$'    c           	         UR                   =(       dI    [        R                  R                  R                   R	                  5       =(       d    [
        R                  n[
        R                  " 5       n[
        R                  " 5       n/ nUR                   H  n[        R                  R                  U[        R                  R                  R                  R                  UUS.SS9nUR                  R!                  UR#                  UR%                  5       UR&                  UR(                  S95      n[*        R,                  R/                  SR1                  [2        R4                  " U5      S95        UR7                  U5        M     U$ )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.
)
projectsIdlocationsIdbuildsIdz$cloudbuild.projects.locations.builds)params
collection)name	projectIdidzCancelled [{r}].
)r)regionr
   VALUESr   Getr   DEFAULT_REGIONGetClientInstanceGetMessagesModuler   REGISTRYParsecoreproject	GetOrFailprojects_locations_buildsr   CancelBuildRequestRelativeNamer"   r$   r	   statuswriteformatsix	text_typeappend)	selfargsbuild_regionclientmessages	cancelledbuild	build_refcancelled_builds	            r   Run
Cancel.Run:   sF    	 	*##**..0	*))  ..0F002HI$$**
&--22::DD)
 < + =i 88??

%
%))+!,,## & o 
jj+22S]]95M2NO'! " r     N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   rH   __static_attributes__rJ   r    r   r   r      s/      %- ( (%r    r   )rO   
__future__r   r   r   !googlecloudsdk.api_lib.cloudbuildr   googlecloudsdk.callioper   !googlecloudsdk.command_lib.buildsr   googlecloudsdk.corer	   r
   r   r<   UniverseCompatibleCommandr   rJ   r    r   <module>rZ      sP     &  ' = ( 3 # * ) 
 @T\\ @ @r    