
                         ,   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  \R                  " \R                  R                  \R                  R                  \R                  R                   5       " S	 S
\R"                  5      5       rg)z,Delete an Artifact Registry container image.    )absolute_import)division)unicode_literals)base)docker_util)flags)logc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
Delete   a"  Delete an Artifact Registry container image.

A valid container image has the format of

  LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY-ID/IMAGE

A valid container image that can be referenced by tag or digest, has the
format of

  LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY-ID/IMAGE:tag
  LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY-ID/IMAGE@sha256:digest

This command can fail for the following reasons:
  * Trying to delete an image by digest when the image is still tagged. Add
  --delete-tags to delete the digest and the tags.
  * Trying to delete an image by tag when the image has other tags. Add
  --delete-tags to delete all tags.
  * A valid repository format was not provided.
  * The specified image does not exist.
  * The active account does not have permission to delete images.
z{description}a      To delete image `busy-box` in `us-west1` and all of its digests and tags:

        $ {command} us-west1-docker.pkg.dev/my-project/my-repository/busy-box

    To delete image digest `abcxyz` under image `busy-box`:

        $ {command} us-west1-docker.pkg.dev/my-project/my-repository/busy-box@sha256:abcxyz

    To delete image digest `abcxyz` under image `busy-box` while there're other tags associate with the digest:

        $ {command} us-west1-docker.pkg.dev/my-project/my-repository/busy-box@sha256:abcxyz --delete-tags

    To delete an image digest and its only tag `my-tag` under image `busy-box`:

        $ {command} us-west1-docker.pkg.dev/my-project/my-repository/busy-box:my-tag
    )DESCRIPTIONEXAMPLESc                     [         R                  R                  U 5        [        R                  " 5       R                  U 5        [        R
                  " 5       R                  U 5        g )N)r   
ASYNC_FLAGAddToParserr   GetDeleteTagsFlagGetImageRequiredArg)parsers    -lib/surface/artifacts/docker/images/delete.pyArgsDelete.ArgsK   sB    OO'	))&1	++F3    c                 b   [         R                  " U5      nUR                  (       a9  [        R                  R                  SR                  UR                  5      5        g[        R                  R                  S5        [         R                  " USR                  UR                  5      5        g)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:
  DeleteVersion operation.
z7Delete request issued.
Check operation [{}] for status.zDelete request issued.z&Waiting for operation [{}] to completeN)	r   DeleteDockerImageasync_r	   statusPrintformatnameWaitForOperation)selfargsops      r   Run
Delete.RunQ   s{     
	&	&t	,B{{	jj
D
K
Kgg 
jj/0""
6==bggFHr    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r$   __static_attributes__r&   r   r   r   r      s2    0 	-. 4 4
Hr   r   N)r+   
__future__r   r   r   googlecloudsdk.callioper   $googlecloudsdk.command_lib.artifactsr   r   googlecloudsdk.corer	   ReleaseTracksReleaseTrackALPHABETAGACommandr   r&   r   r   <module>r9      sz    3 &  ' ( < 6 # D%%++T->->-C-C%%((*FHT\\ FH*FHr   