
    b                         d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z
  ej                  ddd	      Z ej                  ej                  j                         G d
 dej                               Zy)z)Command to list Container Registry usage.    N)	gcr_utils)base)flags)utilsz{description}aG           To list Container Registry usage in a project:

          $ {command} --project=my-proj

        To list Container Registry usage in an organization:

          $ {command} --organization=my-org

        To list Container Registry usage in a folder:

          $ {command} --folder=my-folder

        To list all active Container Registry usage in an organization:

          $ {command} --organization=my-org --filter="usage=ACTIVE"

        To list all projects that aren't redirected yet:

          $ {command} --organization=my-org --filter="usage!=REDIRECTED"
        )DESCRIPTIONEXAMPLESc                   *    e Zd ZdZeZed        Zd Zy)ListGCRUsagea  List Container Registry usage.

  List Container Registry usage for all projects in the specified scope
  (project/organization/folder). Caller must have
  `cloudasset.assets.searchAllResources` permission on the requested scope and
  `storage.objects.list permission` on the Cloud Storage buckets used by
  Container Registry.

  The tool returns the following lists of usage states:

  ACTIVE: Container Registry usage has occurred in the last 30 days. The host
  location and project are not redirected.

  INACTIVE: No Container Registry usage has occurred in the last 30 days. The
  host location and project are not redirected.

  REDIRECTED: The project has been redirected to Artifact Registry but still has
  Container Registry Cloud Storage buckets. This project will continue to
  function after Container Registry is turned down and no further action is
  required. You can reduce costs by deleting the Container Registry Cloud
  Storage buckets.

  REDIRECTION_INCOMPLETE: Requests are redirected to Artifact Registry, but data
  is still being copied from Container Registry.

  LEGACY: Container Registry usage is unknown. This state is caused by legacy
  Container Registry projects that store container image metadata files in Cloud
  Storage buckets. For more information on legacy Container Registry projects,
  see
  https://cloud.google.com/container-registry/docs/deprecations/feature-deprecations#container_image_metadata_storage_change.
  c                 r    t        j                  | ddd       t        j                  j	                  |        y )NzProject ID.zOrganization ID.z
Folder ID.)asset_flagsAddParentArgsr   URI_FLAGRemoveFromParser)parsers    .lib/surface/container/images/list_gcr_usage.pyArgszListGCRUsage.ArgsW   s0    	 	MM""6*    c              #      K   t        j                  |j                  |j                  |j                        }t        j                  |      }|D ]  }t        j                  |        y w)N)asset_utilsGetParentNameForExportorganizationprojectfolderr   ListGCRReposCheckGCRUsage)selfargsparent	gcr_reposgcr_repos        r   RunzListGCRUsage.Runa   sZ     //F
 &&v.I##H-- s   A*A,N)	__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpstaticmethodr   r!    r   r   r
   r
   3   s&    @ !-+ +.r   r
   )r%   
frozendict'googlecloudsdk.api_lib.container.imagesr   googlecloudsdk.callioper    googlecloudsdk.command_lib.assetr   r   r   r   r&   ReleaseTracksReleaseTrackGAListCommandr
   r)   r   r   <module>r2      st     0  = ( A A '&&"( 4 D%%(()5.4## 5. *5.r   