File: //usr/lib/python3/dist-packages/boto/ec2/__pycache__/snapshot.cpython-310.pyc
o
ckF[s � @ s@ d Z ddlmZ ddlmZ G dd� de�ZG dd� de�ZdS ) z0
Represents an EC2 Elastic Block Store Snapshot
� )�TaggedEC2Object)�Zonec s� e Zd ZdZdZd� fdd� Zdd� Zdd � Zd
d� Zdd
d�Z ddd�Z
ddd�Zddd�Zddd�Z
ddd�Z ddd�Z� ZS ) �Snapshota�
Represents an EBS snapshot.
:ivar id: The unique ID of the snapshot.
:ivar volume_id: The ID of the volume this snapshot was created
from.
:ivar status: The status of the snapshot.
:ivar progress: The percent complete of the snapshot.
:ivar start_time: The timestamp of when the snapshot was created.
:ivar owner_id: The id of the account that owns the snapshot.
:ivar owner_alias: The alias of the account that owns the snapshot.
:ivar volume_size: The size (in GB) of the volume the snapshot was created from.
:ivar description: The description of the snapshot.
:ivar encrypted: True if this snapshot is encrypted
�createVolumePermissionNc sP t t| ��|� d | _d | _d | _d | _d | _d | _d | _ d | _
d | _d | _d S �N)
�superr �__init__�id� volume_id�status�progress�
start_time�owner_id�owner_alias�volume_size�description� encrypted)�self�
connection�� __class__� �3/usr/lib/python3/dist-packages/boto/ec2/snapshot.pyr 0 s
zSnapshot.__init__c C s
d| j S )NzSnapshot:%s)r )r r r r �__repr__= s
zSnapshot.__repr__c C s� |dkr || _ d S |dkr|| _d S |dkr|| _d S |dkr$|| _d S |dkr-|| _d S |dkr6|| _d S |dkrLzt|�| _W d S || _Y d S |dkrU|| _d S |d krb|� � d
k| _
d S t| ||� d S )N�
snapshotId�volumeIdr � startTime�ownerId�
ownerAlias�
volumeSizer r �true)r r
r r
r r �intr r �lowerr �setattr�r �name�valuer r r r �
endElement@ s,
zSnapshot.endElementc C s |j | _ |j| _d S r )r r )r �updatedr r r �_updateY s zSnapshot._updateFc C sL | j j| jg|d�}t|�dkr| �|d � | jS |r#td| j ��| jS )a�
Update the data associated with this snapshot by querying EC2.
:type validate: bool
:param validate: By default, if EC2 returns no data about the
snapshot the update method returns quietly. If
the validate param is True, however, it will
raise a ValueError exception if no data is
returned from EC2.
��dry_runr z%s is not a valid Snapshot ID)r �get_all_snapshotsr �lenr) �
ValueErrorr )r �validater+ �rsr r r �update] s �zSnapshot.updatec C s | j j| j|d�S �Nr* )r �delete_snapshotr �r r+ r r r �deleteo s zSnapshot.deletec C s | j j| j| j|d�}|jS r2 )r �get_snapshot_attributer �AttrName�attrs)r r+ r8 r r r �get_permissionsr s �zSnapshot.get_permissionsc C � | j j| j| jd|||d�S )N�addr* �r �modify_snapshot_attributer r7 �r �user_ids�groupsr+ r r r �sharez �
�zSnapshot.sharec C r: )N�remover* r<