CURRENT PATH:
/
opt
/
gsutil
/
gslib
/
commands
/
__pycache__
/
[ ⬅ KEMBALI ]
|
[ HOME ]
Upload File:
Upload Ke Sini
Dir Baru
File Baru
Editing:
hmac.cpython-39.pyc
a +(Wg�B � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddl mZ dd lm Z dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ dZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&ee�'d� e�'d� e �'d� e!�'d� d Z(dd�)e"e#e$e%e&g� Z*ee(e*�Z+dd gZ,d!Z-eee"�Z.eee#�Z/eee$�Z0ee e%�Z1ee!e&�Z2d"d#� Z3d$d%� Z4d&e�5� d' d( d) Z6d&e�5� d* d+ d, d- d. d/ d0 d1 d2 Z7d3Z8ed4�Z9ed5d6d7e6gd8e9id9�Z:eg d:�d8e9id9�Z;ed5d6d;e7gd8e9id9�Z<ed5d6d<e8ged=�ed>�e9d?�d9�Z=ed5d6d<e7ged=�ed@�ed>�e9dA�d9�Z>ed5d6dBe7gedCdDdE��edF�e9dG�d9�Z?G dHdI� dIe�Z@dJS )Kz� Implementation of HMAC key management command for GCS. NOTE: Any modification to this file or corresponding HMAC logic should be submitted in its own PR and release to avoid concurrency issues in testing. � )�absolute_import)�division)�print_function)�unicode_literals)�Command)�CommandArgument)�ApiSelector��CommandException)�CreateHelpText)�LogCommandParams)�PopulateProjectId)�GetCloudApiInstance)�GcloudStorageFlag)�GcloudStorageMap)�InsistAscii)� shim_utilz= gsutil hmac create [-p <project>] <service_account_email> z1 gsutil hmac delete [-p <project>] <access_id> z. gsutil hmac get [-p <project>] <access_id> zJ gsutil hmac list [-a] [-l] [-p <project>] [-u <service_account_email>] zR gsutil hmac update -s (ACTIVE|INACTIVE) [-e <etag>] [-p <project>] <access_id> a <B>CREATE</B> The ``hmac create`` command creates an HMAC key for the specified service account: gsutil hmac create test.service.account@test_project.iam.gserviceaccount.com The secret key material is only available upon creation, so be sure to store the returned secret along with the access_id. <B>CREATE OPTIONS</B> The ``create`` sub-command has the following option -p <project> Specify the ID or number of the project in which to create a key. a� <B>DELETE</B> The ``hmac delete`` command permanently deletes the specified HMAC key: gsutil hmac delete GOOG56JBMFZX6PMPTQ62VD2 Note that keys must be updated to be in the ``INACTIVE`` state before they can be deleted. <B>DELETE OPTIONS</B> The ``delete`` sub-command has the following option -p <project> Specify the ID or number of the project from which to delete a key. a� <B>GET</B> The ``hmac get`` command retrieves the specified HMAC key's metadata: gsutil hmac get GOOG56JBMFZX6PMPTQ62VD2 Note that there is no option to retrieve a key's secret material after it has been created. <B>GET OPTIONS</B> The ``get`` sub-command has the following option -p <project> Specify the ID or number of the project from which to get a key. a� <B>LIST</B> The ``hmac list`` command lists the HMAC key metadata for keys in the specified project. If no project is specified in the command, the default project is used. <B>LIST OPTIONS</B> The ``list`` sub-command has the following options -a Show all keys, including recently deleted keys. -l Use long listing format. Shows each key's full metadata excluding the secret. -p <project> Specify the ID or number of the project from which to list keys. -u <service_account_email> Filter keys for a single service account. a� <B>UPDATE</B> The ``hmac update`` command sets the state of the specified key: gsutil hmac update -s INACTIVE -e M42da= GOOG56JBMFZX6PMPTQ62VD2 Valid state arguments are ``ACTIVE`` and ``INACTIVE``. To set a key to state ``DELETED``, use the ``hmac delete`` command on an ``INACTIVE`` key. If an etag is set in the command, it will only succeed if the provided etag matches the etag of the stored key. <B>UPDATE OPTIONS</B> The ``update`` sub-command has the following options -s <ACTIVE|INACTIVE> Sets the state of the specified key to either ``ACTIVE`` or ``INACTIVE``. -e <etag> If provided, the update will only be performed if the specified etag matches the etag of the stored key. -p <project> Specify the ID or number of the project in which to update a key. � z z� You can use the ``hmac`` command to interact with service account `HMAC keys <https://cloud.google.com/storage/docs/authentication/hmackeys>`_. The ``hmac`` command has five sub-commands: �INACTIVE�ACTIVEz%a, %d %b %Y %H:%M:%S GMTc C s t d| ||f �S )NzD%s %s requires an Access ID to be specified as the last argument. %sr )�command_name� subcommand�synopsis� r �"/opt/gsutil/gslib/commands/hmac.py�_AccessIdException� s ��r c C s� d dd�}d| j }||d| j�7 }||d| j�7 }||d| j�7 }||d| j�t��7 }||d | j�t��7 }||d | jdd�7 }|S )z4Format the key metadata for printing to the console.Tc S s&