OXIESEC PANEL
- Current Dir:
/
/
opt
/
gsutil
/
gslib
/
commands
/
__pycache__
Server IP: 2a02:4780:11:1594:0:ef5:22d7:a
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/11/2025 08:19:49 AM
rwxr-xr-x
📄
__init__.cpython-39.pyc
323 bytes
02/11/2025 08:19:49 AM
rw-r--r--
📄
acl.cpython-39.pyc
18.76 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
autoclass.cpython-39.pyc
6.01 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
bucketpolicyonly.cpython-39.pyc
6.75 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
cat.cpython-39.pyc
4.17 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
compose.cpython-39.pyc
4.57 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
config.cpython-39.pyc
40.97 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
cors.cpython-39.pyc
6.56 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
cp.cpython-39.pyc
42.21 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
defacl.cpython-39.pyc
11.25 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
defstorageclass.cpython-39.pyc
5.78 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
du.cpython-39.pyc
8.47 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
hash.cpython-39.pyc
7.87 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
help.cpython-39.pyc
6.41 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
hmac.cpython-39.pyc
12.39 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
iam.cpython-39.pyc
24.6 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
kms.cpython-39.pyc
14.88 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
label.cpython-39.pyc
10.46 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
lifecycle.cpython-39.pyc
6.37 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
logging.cpython-39.pyc
9.04 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
ls.cpython-39.pyc
18.81 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
mb.cpython-39.pyc
12.23 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
mv.cpython-39.pyc
5.06 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
notification.cpython-39.pyc
25.47 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
pap.cpython-39.pyc
6.53 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
perfdiag.cpython-39.pyc
62.18 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rb.cpython-39.pyc
3.78 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
requesterpays.cpython-39.pyc
5.53 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
retention.cpython-39.pyc
20.02 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rewrite.cpython-39.pyc
16.12 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rm.cpython-39.pyc
10.86 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rpo.cpython-39.pyc
5.96 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rsync.cpython-39.pyc
53.86 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
setmeta.cpython-39.pyc
11.25 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
signurl.cpython-39.pyc
20.99 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
stat.cpython-39.pyc
5.04 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
test.cpython-39.pyc
17.73 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
ubla.cpython-39.pyc
6.96 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
update.cpython-39.pyc
12.26 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
version.cpython-39.pyc
5.25 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
versioning.cpython-39.pyc
5.51 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
web.cpython-39.pyc
7.63 KB
02/11/2025 08:19:49 AM
rw-r--r--
Editing: rpo.cpython-39.pyc
Close
a +(Wgc � @ s2 d Z ddlmZ ddlmZ ddlZddlmZ ddlmZ ddl m Z ddlmZ dd l mZ dd l mZ ddlmZ ddlmZ dd lmZ ddlmZ dZd�d�e��Zd�e�ZdZee�d� Z dZ!dZ"de" e! Z#ee e#�Z$eee!�Z%eee"�Z&eg d�i d�Z'eg d�i d�Z(G dd� de�Z)dS )z/This module provides the rpo command to gsutil.� )�absolute_import)�print_functionN)�metrics)�Command)�CommandArgument)�ApiSelector)�CommandException)�NO_URLS_MATCHED_TARGET)�CreateHelpText)�storage_v1_messages)�NO_MAX)�GcloudStorageMap)ZASYNC_TURBO�DEFAULTz({})�|z+ gsutil rpo set {} gs://<bucket_name>... z( gsutil rpo get gs://<bucket_name>... � am <B>SET</B> The ``rpo set`` command configures turbo replication for dual-region Google Cloud Storage buckets. <B>SET EXAMPLES</B> Configure your buckets to use turbo replication: gsutil rpo set ASYNC_TURBO gs://redbucket gs://bluebucket Configure your buckets to NOT use turbo replication: gsutil rpo set DEFAULT gs://redbucket gs://bluebucket z� <B>GET</B> The ``rpo get`` command returns the replication setting for the specified Cloud Storage buckets. <B>GET EXAMPLES</B> Check if your buckets are using turbo replication: gsutil rpo get gs://redbucket gs://bluebucket a The ``rpo`` command is used to retrieve or configure the `replication setting <https://cloud.google.com/storage/docs/availability-durability#cross-region-redundancy>`_ of dual-region Cloud Storage buckets. This command has two sub-commands: ``get`` and ``set``. )�storage�buckets�listzL--format=value[separator=": "](format("gs://{}", name),rpo.yesno(no="None"))z--raw��gcloud_command�flag_map)r r �updatez--recovery-point-objectivec @ s� e Zd ZdZejdg ededdddej gej e �d�ge dee �d�e �� gd �d �Zejdg ddeeed �d �Zeeed �i d�Zdd� Zdd� Zdd� Zdd� Zdd� ZdS )� RpoCommandz"Implements the gsutil rpo command.�rpo� � F� �mode)�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 replication)� help_name�help_name_aliases� help_type�help_one_line_summary� help_text�subcommand_help_textr c C s |j jdkrtd| j ��d S )N�gsz7The %s command can only be used with gs:// bucket URLs.)�storage_url�schemer �command_name)�self�blr� r: �!/opt/gsutil/gslib/commands/rpo.py�,_ValidateBucketListingRefAndReturnBucketName� s ��z7RpoCommand._ValidateBucketListingRefAndReturnBucketNamec C sF |j }| jj|jdg|jd�}|j}t|��d�}td||f � dS )z"Gets the rpo setting for a bucket.r ��fields�provider�/z%s: %sN) r5 � gsutil_api� GetBucket�bucket_namer6 r �str�rstrip�print)r8 r9 � bucket_url�bucket_metadatar �bucketr: r: r; �_GetRpo� s �zRpoCommand._GetRpoc C sh |j }|}|tvr td�t���tj|d�}| j�d|t |�� d�f � | jj|j |dg|jd� dS )z"Sets the rpo setting for a bucket.z.Invalid value for rpo set. Should be one of {})r zSetting rpo %s for %sr@ r r= r )r5 �VALID_RPO_VALUESr �format�VALID_RPO_VALUES_STRING�apitools_messages�Bucket�logger�inforD rE rA �PatchBucketrC r6 )r8 r9 Z rpo_valuerG Zformatted_rpo_valuerH r: r: r; �_SetRpo� s$ ��� �zRpoCommand._SetRpoc C s | j �d�}|dvrtd��d}g }|dkr4| j}n$|dkrX| j}| j �d�}|�|� | j�d�tj kr�td� t�d | j ����d }| j }|s�| �� |D ]\}| �|�}|D ]H} | j�| jj�tj kr�td� t�d| j ����d}|| g|�R � q�q�|�sttt|� ��dS ) z-Handles rpo command on Cloud Storage buckets.r r zrpo only supports get|setNr r! r4 r z=The "%s" command can only be with the Cloud Storage JSON API.Fz2The "%s" command can only be used for GCS buckets.T)�args�popr rJ rS �appendrA �GetApiSelectorr �JSON�join�textwrap�wrapr7 �$RaiseWrongNumberOfArgumentsException�GetBucketUrlIterFromArgr5 r6 r r ) r8 � subcommand�subcommand_func�subcommand_args�setting_arg�some_matched�url_args�url_str�bucket_iter�bucket_listing_refr: r: r; �_Rpo� sN �� ����zRpoCommand._Rpoc C sZ | j d }| jdd� |dks&|dkrJtj| jd� tj|gd� | �� S td| ��d S ) z(Command entry point for the rpo command.r T)� check_argsr r! )�sub_opts)�subcommandsz-Invalid subcommand "%s", use get|set instead.N)rT �ParseSubOptsr �LogCommandParamsri rg r )r8 �action_subcommandr: r: r; � RunCommand� s �zRpoCommand.RunCommandN)�__name__� __module__�__qualname__�__doc__r �CreateCommandSpec� _SYNOPSISr r rX r �MakeNCloudURLsArgumentr rK �%MakeZeroOrMoreCloudBucketURLsArgument�command_spec�HelpSpec�_DETAILED_HELP_TEXT�_get_help_text�_set_help_text� help_specr �GET_COMMAND�SET_COMMAND�gcloud_storage_mapr<