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: pap.cpython-39.pyc
Close
a +(Wg% � @ s$ d Z ddlmZ ddlmZ ddlZddlmZ ddlmZ ddl m Z ddlmZ dd l mZ dd l mZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ dZdZee�d� ZdZdZ de e Z!eee!�Z"eee�Z#eee �Z$ej%j&Z&de�'� d d d Z(G dd� de�Z)dS )z/This module provides the pap command to gsutil.� )�absolute_import)�print_functionN)�metrics)�Command)�CommandArgument)�ApiSelector)�CommandException)�NO_URLS_MATCHED_TARGET)�CreateHelpText)�storage_v1_messages)�NO_MAX)�GcloudStorageMap)� shim_utilz= gsutil pap set (enforced|inherited) gs://<bucket_name>... z( gsutil pap get gs://<bucket_name>... � a <B>SET</B> The ``pap set`` command configures public access prevention for Cloud Storage buckets. If you set a bucket to be ``inherited``, it uses public access prevention only if the bucket is subject to the `public access prevention <https://cloud.google.com/storage/docs/org-policy-constraints#public-access-prevention>`_ organization policy constraint. <B>SET EXAMPLES</B> Configure ``redbucket`` and ``bluebucket`` to use public access prevention: gsutil pap set enforced gs://redbucket gs://bluebucket a <B>GET</B> The ``pap get`` command returns public access prevention values for the specified Cloud Storage buckets. <B>GET EXAMPLES</B> Check if ``redbucket`` and ``bluebucket`` are using public access prevention: gsutil pap get gs://redbucket gs://bluebucket z� The ``pap`` command is used to retrieve or configure the `public access prevention <https://cloud.google.com/storage/docs/public-access-prevention>`_ setting of Cloud Storage buckets. This command has two sub-commands: ``get`` and ``set``. z)--format=value[separator=": "](name.sub("z","gs://"),z.iamConfiguration.publicAccessPrevention.yesno(zno="inherited"))c @ s� e Zd ZdZejddgededdddej gej e �d�ge dd d gd�e �� gd�d �Z ejddgddeeed�d�Zeedddedgi dd�eeg d�i d�eg d�i d�d�i d�d�i d�Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%S )&� PapCommandz"Implements the gsutil pap command.ZpapZpublicaccessprevention� � F� �mode�enforced� inherited)�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_helpz"Configure public access prevention)� 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- r. �updatez--public-access-prevention)r0 r1 )r- r. r3 z--no-public-access-prevention)r r 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/pap.py�,_ValidateBucketListingRefAndReturnBucketName� s ��z7PapCommand._ValidateBucketListingRefAndReturnBucketNamec C sP |j }| jj|jdg|jd�}|j}|jp,d}t|��d�}t d||f � dS )z7Gets the public access prevention setting for a bucket.�iamConfiguration��fields�providerr �/z%s: %sN) r5 � gsutil_api� GetBucket�bucket_namer6 r= �publicAccessPrevention�str�rstrip�print)r8 r9 � bucket_url�bucket_metadata� iam_config�public_access_prevention�bucketr: r: r; �_GetPublicAccessPrevention� s � z%PapCommand._GetPublicAccessPreventionc C sV |j }t� }||_tj|d�}td|t|��d�f � | jj |j |dg|jd� dS )zMSets the Public Access Prevention setting for a bucket enforced or inherited.)r= z*Setting Public Access Prevention %s for %srA r= r>