CURRENT PATH:
/
opt
/
gsutil
/
gslib
/
commands
/
__pycache__
/
[ ⬅ KEMBALI ]
|
[ HOME ]
Upload File:
Upload Ke Sini
Dir Baru
File Baru
Editing:
label.cpython-39.pyc
a +(Wg\? � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlZddlZddl Z ddl mZ ddlm Z dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddlm!Z! ddl"m#Z# ddl$m%Z% ddl$m&Z& ddl'm(Z( dZ)dZ*dZ+dZ,dZ-dZ.e)e*�/d� e+�/d� d Z0d e, e- e. Z1ee0e1�Z2ee*e,�Z3ee)e-�Z4ee+e.�Z5G d!d"� d"e�Z6dS )#z<Implementation of label command for cloud storage providers.� )�absolute_import)�print_function)�division)�unicode_literalsN)�metrics)�PreconditionException)� Preconditions)�Command)�CommandArgument)�ApiSelector)�CommandException)�NO_URLS_MATCHED_TARGET)�CreateHelpText)�storage_v1_messages)� shim_util)�NO_MAX)�UTF8)�Retry)�GcloudStorageFlag)�GcloudStorageMap)�LabelTranslationz< gsutil label set <label-json-file> gs://<bucket_name>... z' gsutil label get gs://<bucket_name> z� gsutil label ch <label_modifier>... gs://<bucket_name>... where each <label_modifier> is one of the following forms: -l <key>:<value> -d <key> z� <B>GET</B> The "label get" command gets the `labels <https://cloud.google.com/storage/docs/tags-and-labels#bucket-labels>`_ applied to a bucket, which you can save and edit for use with the "label set" command. ah <B>SET</B> The "label set" command allows you to set the labels on one or more buckets. You can retrieve a bucket's labels using the "label get" command, save the output to a file, edit the file, and then use the "label set" command to apply those labels to the specified bucket(s). For example: gsutil label get gs://bucket > labels.json Make changes to labels.json, such as adding an additional label, then: gsutil label set labels.json gs://example-bucket Note that you can set these labels on multiple buckets at once: gsutil label set labels.json gs://bucket-foo gs://bucket-bar al <B>CH</B> The "label ch" command updates a bucket's label configuration, applying the label changes specified by the -l and -d flags. You can specify multiple label changes in a single command run; all changes will be made atomically to each bucket. <B>CH EXAMPLES</B> Examples for "ch" sub-command: Add the label "key-foo:value-bar" to the bucket "example-bucket": gsutil label ch -l key-foo:value-bar gs://example-bucket Change the above label to have a new value: gsutil label ch -l key-foo:other-value gs://example-bucket Add a new label and delete the old one from above: gsutil label ch -l new-key:new-value -d key-foo gs://example-bucket <B>CH OPTIONS</B> The "ch" sub-command has the following options -l Add or update a label with the specified key and value. -d Remove the label with the specified key. � z ag Gets, sets, or changes the label configuration (also called the tagging configuration by other storage providers) of one or more buckets. An example label JSON document looks like the following: { "your_label_key": "your_label_value", "your_other_label_key": "your_other_label_value" } The label command has three sub-commands: c @ s� e Zd ZdZejdededdddej ej gej e�d�e� � ge�d�ge� � gd�d�Zejdg d d eeeed�d�Zeeg d �i d�eg d�i d�eg d�edejjd�edejjd�d�d�d�i d�Zdd� Zdd� Zdd� Zdd� Z dd� Z!dS ) �LabelCommandz'Implementation of gsutil label command.�label� zl:d:F� )�set�get�ch) �usage_synopsis�min_args�max_args�supported_sub_args�file_url_ok�provider_url_ok�urls_start_arg�gs_api_support�gs_default_api�argparse_arguments�command_helpz8Get, set, or change the label configuration of a bucket.)r r r )� help_name�help_name_aliases� help_type�help_one_line_summary� help_text�subcommand_help_text)�storage�buckets�describezj--format=gsutiljson[key=labels,empty=' has no label configuration.',empty_prefix_key=storage_url,indent=2])�gcloud_command�flag_map)r0 r1 �updatez --labels-file)r0 r1 r5 z--remove-labels)�repeat_typez--update-labels)�-d�-lc C s( | j s| �� | j d �� dkr$dS dS )Nr r r r )�args�$RaiseWrongNumberOfArgumentsException�lower��self� r>