File: //lib/google-cloud-sdk/lib/surface/storage/__pycache__/du.cpython-312.pyc
�
��� � �� � d Z ddlmZ ddlmZ ddlmZ ddlZddlZddlmZ ddl m
Z
ddlmZ dd lm
Z
dd
lmZ ddlmZ ddlmZ dd
lmZ dZdZdZe
j, e
j. e
j0 j2 � G d� de
j4 � � � Ze
j, e
j. e
j0 j8 � G d� de� � � Zy)zCImplementation of Unix-like du command for cloud storage providers.� )�absolute_import)�division)�unicode_literalsN)� cloud_api)�base)�du_command_util)�errors)�flags)�
regex_util)�storage_url)�filesa�
Displays the amount of space in bytes used by the objects in a bucket,
subdirectory, or project. This command calculates the current space usage
by making a series of object listing requests, which can take a long time
for large buckets. If your bucket contains hundreds of thousands of
objects, or if you want to monitor your bucket size over time, use
Monitoring instead, as described in [Get bucket size](https://cloud.google.com/storage/docs/getting-bucket-size)
aM
To list the size of each object in a bucket:
$ {command} gs://bucketname
To list the size of each object in the prefix subdirectory:
$ {command} gs://bucketname/prefix/*
To print the total number of bytes in a bucket in human-readable form:
$ {command} -c gs://bucketname
To see a summary of the total number of bytes in two given buckets:
$ {command} -s gs://bucket1 gs://bucket2
To list the size of each object in a bucket with Object Versioning
enabled, including noncurrent objects:
$ {command} -a gs://bucketname
To list the size of each object in a bucket, except objects that end in
".bak", with each object printed ending in a null byte:
$ {command} -e "*.bak" -0 gs://bucketname
To list the size of each bucket in a project and the total size of the
project:
$ {command} --summarize --readable-sizes --total
z�
The following command summarizes the size of objects that match the specified
filter.
$ {command} gs://my-bucket --metadata-filter='contexts."foo"="bar"' --summarize
c �0 � e Zd ZdZeed�Zed� � Zd� Z y)�Du�@Displays the amount of space in bytes used by storage resources.��DESCRIPTION�EXAMPLESc � � |j ddd�� |j dddd� � |j d
ddd� � |j d
ddd� � |j dddg d�� |j dddd� � |j dddd� � |j ddd�� t j |� | j � t j j
k( rt j |� y y )N�url�*zThe url of objects to list.)�nargs�helpz-0z--zero-terminator�
store_truezpEnds each output line with a 0 byte rather than a newline. You can use this to make the output machine-readable.)�actionr z-az--all-versionsz�Includes noncurrent object versions for a bucket with Object Versioning enabled. Also prints the generation and metageneration number for each listed object.z-cz--totalz+Includes a total size of all input sources.z-ez--exclude-name-pattern�appendz~Exclude a pattern from the report. Example: `-e "*.o"` excludes any object that ends in ".o". Can be specified multiple times.)r �defaultr z-rz--readable-sizeszSPrints object sizes in human-readable format. For example, 1 KiB, 234 MiB, or 2GiB.z-sz--summarizez,Displays only the summary for each argument.z-Xz--exclude-name-pattern-filezpSimilar to -e, but excludes patterns from the given file. The patterns to exclude should be listed one per line.)r )�add_argumentr
�add_additional_headers_flag�ReleaseTrackr �ALPHA�add_metadata_filter_flag)�cls�parsers �lib/surface/storage/du.py�ArgszDu.Args\ sJ � �
����S�/L��M�
������
A� � � ������*� � +� ������
:� � � ���� ���
N�
� � ������
!� � � ������
;� � � ����%�
F� � �
�%�%�f�-�
����T�.�.�4�4�4��$�$�V�,� 5� c �� � t j |� }t |dd � }|j r�g }|j D ]� }t j
|� }t
|t j � s.t j dj |j � � �|�2|j t j k7 rt j d� �|j! |� �� n$t j t j � g}|j"