CURRENT PATH:
/
opt
/
gsutil
/
gslib
/
commands
/
__pycache__
/
[ ⬅ KEMBALI ]
|
[ HOME ]
Upload File:
Upload Ke Sini
Dir Baru
File Baru
Editing:
autoclass.cpython-39.pyc
a +(Wg�# � @ s4 d Z ddlmZ ddlmZ ddlZddlmZ ddlmZ ddl m Z ddlmZ dd l mZ dd l mZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ dZdZee�d� ZdZ dZ!de! e Z"eee"�Z#eee �Z$eee!�Z%de�&� d d d d d d Z'G dd� de�Z(dS ) z5This module provides the autoclass command to gsutil.� )�absolute_import)�print_functionN)�metrics)�Command)�CommandArgument)�ApiSelector)�CommandException)�NO_URLS_MATCHED_TARGET)�CreateHelpText)�storage_v1_messages)� text_util)�NO_MAX)�GcloudStorageMap)� shim_utilz7 gsutil autoclass set (on|off) gs://<bucket_name>... z. gsutil autoclass get gs://<bucket_name>... � z� <B>SET</B> The ``set`` sub-command requires an additional sub-command, either ``on`` or ``off``, which enables or disables Autoclass for the specified bucket(s). a+ <B>GET</B> The ``get`` sub-command gets the current Autoclass configuration for a bucket. The returned configuration has the following fields: ``enabled``: a boolean field indicating whether the feature is on or off. ``toggleTime``: a timestamp indicating when the enabled field was set. z� The `Autoclass <https://cloud.google.com/storage/docs/autoclass>`_ feature automatically selects the best storage class for objects based on access patterns. This command has two sub-commands, ``get`` and ``set``. z--format=value[separator="z"](zformat("gs://{}:", name),z format(" Enabled: {}",z&autoclass.enabled.yesno(True, False)),z format(" Toggle Time: {}",zautoclass.toggleTime))c @ s� e Zd ZdZejdg ededdddej gej e �d�ge ddd gd �e �� gd�d�Z ejdg d deeed�d�Zeedddedgi dd�eeg d�i d�eg d�i d�d�i d�d�i d�Zdd� Zdd� Zdd� Zd d!� Zd"S )#�AutoclassCommandz(Implements the gsutil autoclass command.� autoclass� � F� �mode�on�off)�choices��get�set)�command_name_aliases�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_helpzConfigure Autoclass feature)� help_name�help_name_aliases� help_type�help_one_line_summary� help_text�subcommand_help_text�storage�buckets�listz--rawT)�gcloud_command�flag_map�supports_output_translation)r/ r0 �updatez--enable-autoclass)r2 r3 )r/ r0 r5 z--no-enable-autoclass)r r c C sn |j }| jj|jdg|jd�}t|��d�}|jrPt|jdd�}t|jdd�}nd}d}t d� |||�� dS ) z(Gets the autoclass setting for a bucket.r ��fields�provider�/�enabledF� toggleTimeNz#{}: Enabled: {} Toggle Time: {})�storage_url� gsutil_api� GetBucket�bucket_name�scheme�str�rstripr �getattr�print�format)�self�blr� bucket_url�bucket_metadata�bucketr: Ztoggle_time� rK �'/opt/gsutil/gslib/commands/autoclass.py�_get_autoclass� s ��zAutoclassCommand._get_autoclassc C s^ |j }tj�� }|dk|_tj|d�}td|t|��d�f � | jj |j |dg|jd� dS )z'Turns autoclass on or off for a bucket.r )r zSetting Autoclass %s for %sr9 r r6 r )r<