File: //usr/lib/python3/dist-packages/boto/glacier/__pycache__/layer2.cpython-310.pyc
o
ckF[� � @ s, d dl mZ d dlmZ G dd� de�ZdS )� )�Layer1)�Vaultc @ s8 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� ZdS )
�Layer2zT
Provides a more pythonic and friendly interface to Glacier based on Layer1
c O s* d|v r|d | _ d S t|i |��| _ d S )N�layer1)r r )�self�args�kwargs� r �5/usr/lib/python3/dist-packages/boto/glacier/layer2.py�__init__! s zLayer2.__init__c C s | j �|� | �|�S )z�Creates a vault.
:type name: str
:param name: The name of the vault
:rtype: :class:`boto.glacier.vault.Vault`
:return: A Vault object representing the vault.
)r �create_vault� get_vault�r �namer r r
r ( s
zLayer2.create_vaultc C s | j �|�S )a� Delete a vault.
This operation deletes a vault. Amazon Glacier will delete a
vault only if there are no archives in the vault as per the
last inventory and there have been no writes to the vault
since the last inventory. If either of these conditions is not
satisfied, the vault deletion fails (that is, the vault is not
removed) and Amazon Glacier returns an error.
This operation is idempotent, you can send the same request
multiple times and it has no further effect after the first
time Amazon Glacier delete the specified vault.
:type vault_name: str
:param vault_name: The name of the vault to delete.
)r �delete_vaultr r r r
r 4 s zLayer2.delete_vaultc C s | j �|�}t| j |�S )a;
Get an object representing a named vault from Glacier. This
operation does not check if the vault actually exists.
:type name: str
:param name: The name of the vault
:rtype: :class:`boto.glacier.vault.Vault`
:return: A Vault object representing the vault.
)r �describe_vaultr )r r �
response_datar r r
r
G s zLayer2.get_vaultc sL g }d} � j j|dd�}|�� fdd�|d D �� |�d�}|s% |S q) z�
Return a list of all vaults associated with the account ID.
:rtype: List of :class:`boto.glacier.vault.Vault`
:return: A list of Vault objects.
NTi� )�marker�limitc s g | ]}t � j|��qS r )r r )�.0�rd�r r r
�
<listcomp>` s z&Layer2.list_vaults.<locals>.<listcomp>� VaultList�Marker)r �list_vaults�extend�get)r �vaultsr r r r r
r U s
�zLayer2.list_vaultsN) �__name__�
__module__�__qualname__�__doc__r r r r
r r r r r
r s r N)�boto.glacier.layer1r �boto.glacier.vaultr �objectr r r r r
�<module> s