File: //home/arjun/projects/env/lib/python3.10/site-packages/boto/gs/__pycache__/key.cpython-310.pyc
o
we#� � @ s| d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm Z
d dlmZ d dl
mZ d dl
mZ G dd � d e
�Z dS )
� N)�StringIO)�BotoClientError)�Key)�KeyFile)�compute_hash)�get_utf8_valuec sV e Zd ZdZd;� fdd� Zdd� Zdd� Zd<d
d�Zdd
� Zdd� Z d=� fdd� Z
d>dd�Z d>dd�Zd?dd�Z
d@dd�Zd?dd�Zdd� Zd d!� Zd?d"d#�Zd$d%� Z & dAd'd(�Z & dBd)d*�Z & dCd+d,�Z� fd-d.�Z dDd/d0�ZdEd1d2�ZdEd3d4�Z dDd5d6�Z dDd7d8�ZdEd9d:�Z� ZS )Fr a�
Represents a key (object) in a GS bucket.
:ivar bucket: The parent :class:`boto.gs.bucket.Bucket`.
:ivar name: The name of this Key object.
:ivar metadata: A dictionary containing user metadata that you
wish to store with the object or that has been retrieved from
an existing object.
:ivar cache_control: The value of the `Cache-Control` HTTP header.
:ivar content_type: The value of the `Content-Type` HTTP header.
:ivar content_encoding: The value of the `Content-Encoding` HTTP header.
:ivar content_disposition: The value of the `Content-Disposition` HTTP
header.
:ivar content_language: The value of the `Content-Language` HTTP header.
:ivar etag: The `etag` associated with this object.
:ivar last_modified: The string timestamp representing the last
time this object was modified in GS.
:ivar owner: The ID of the owner of this object.
:ivar storage_class: The storage class of the object. Currently, one of:
STANDARD | DURABLE_REDUCED_AVAILABILITY.
:ivar md5: The MD5 hash of the contents of the object.
:ivar size: The size, in bytes, of the object.
:ivar generation: The generation number of the object.
:ivar metageneration: The generation number of the object metadata.
:ivar encrypted: Whether the object is encrypted while at rest on
the server.
:ivar cloud_hashes: Dictionary of checksums as supplied by the storage
provider.
Nc s0 t t| �j||d� || _d | _i | _d | _d S )N)�bucket�name)�superr �__init__�
generation�meta_generation�cloud_hashes�component_count)�selfr r r �� __class__� �D/home/arjun/projects/env/lib/python3.10/site-packages/boto/gs/key.pyr A s
zKey.__init__c C sJ | j r| jrd| j | jf }nd}| jrd| jj| j|f S d| j|f S )Nz#%s.%s� z<Key: %s,%s%s>z<Key: None,%s%s>)r �metagenerationr r )r �ver_strr r r �__repr__H s zKey.__repr__c C s� |dkr || _ d S |dkr|| _d S |dkr$|dkrd| _d S d| _d S |dkr-|| _d S |dkr8t|�| _d S |d krA|| _d S |d
krGd S |dkrP|| _d S |dkrY|| _d S |d
krb|| _ d S t
| ||� d S )Nr �ETag�IsLatest�trueTF�LastModified�Size�StorageClass�Owner� VersionId�
Generation�MetaGeneration)r �etag� is_latest�
last_modified�int�size�
storage_class�
version_idr r �setattr)r r �value�
connectionr r r �
endElementR s.
zKey.endElementFc C s |� dd �| _|� dd �| _d S )Nzx-goog-metageneration�x-goog-generation)� getheaderr r )r �resp�forcer r r �handle_version_headersm s zKey.handle_version_headersc C s d S �Nr )r �responser r r �handle_restore_headersq s zKey.handle_restore_headersc C s� |D ]N\}}|dkr%|� d�D ]}|�� � dd�\}}t�|�| j|<