Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/boto/ec2/__pycache__/ |
Upload File : |
o ckF[�( � @ s\ d Z ddlmZ ddlmZ ddlmZ G dd� de�ZG dd� de�Z G d d � d e�Z dS )z0 Represents an EC2 Elastic Block Storage Volume � )� ResultSet)�Tag)�TaggedEC2Objectc s� e Zd ZdZd� fdd� Zdd� Z� fdd�Zd d � Zdd� Zddd�Z d dd�Z d dd�Zddd�Zd!dd�Z dd� Zdd� Zd"dd�Z� ZS )#�Volumea� Represents an EBS volume. :ivar id: The unique ID of the volume. :ivar create_time: The timestamp of when the volume was created. :ivar status: The status of the volume. :ivar size: The size (in GB) of the volume. :ivar snapshot_id: The ID of the snapshot this volume was created from, if applicable. :ivar attach_data: An AttachmentSet object. :ivar zone: The availability zone this volume is in. :ivar type: The type of volume (standard or consistent-iops) :ivar iops: If this volume is of type consistent-iops, this is the number of IOPS provisioned (10-300). :ivar encrypted: True if this volume is encrypted. Nc sP t t| ��|� d | _d | _d | _d | _d | _d | _d | _ d | _ d | _d | _d S �N) �superr �__init__�id�create_time�status�size�snapshot_id�attach_data�zone�type�iops� encrypted)�self� connection�� __class__� �1/usr/lib/python3/dist-packages/boto/ec2/volume.pyr 2 s zVolume.__init__c C � d| j S )Nz Volume:%s�r �r r r r �__repr__? � zVolume.__repr__c sX t t| ��|||�}|d ur|S |dkrt� | _| jS |dkr*tdtfg�| _| jS d S )N� attachmentSet�tagSet�item)r r �startElement� AttachmentSetr r r �tags)r �name�attrsr �retvalr r r r! B s zVolume.startElementc C s� |dkr || _ d S |dkr|| _d S |dkr!|dkr|| _d S d S |dkr,t|�| _d S |dkr5|| _d S |dkr>|| _d S |dkrG|| _d S |d krRt|�| _d S |d kr_|� � dk| _ d S t| ||� d S )N�volumeId� createTimer � r � snapshotId�availabilityZone� volumeTyper r �true)r r r �intr r r r r �lowerr �setattr�r r$ �valuer r r r � endElementO s* � zVolume.endElementc C s | j �|j � d S r )�__dict__�update)r �updatedr r r �_updatef s zVolume._updateFc s^ � j j� jg|d�}� fdd�|D �}t|�dkr#� �|d � � jS |r,td� j ��� jS )a� Update the data associated with this volume by querying EC2. :type validate: bool :param validate: By default, if EC2 returns no data about the volume 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_runc s g | ] }|j � j kr|�qS r r )�.0�xr r r � <listcomp>y s z!Volume.update.<locals>.<listcomp>r z%s is not a valid Volume ID)r �get_all_volumesr �lenr7 � ValueErrorr )r �validater9 � unfiltered_rs�rsr r r r5 i s ��z Volume.updatec C s | j j| j|d�S )zc Delete this EBS volume. :rtype: bool :return: True if successful r8 )r � delete_volumer )r r9 r r r �delete� s z Volume.deletec C s | j j| j|||d�S )a� Attach this EBS volume to an EC2 instance. :type instance_id: str :param instance_id: The ID of the EC2 instance to which it will be attached. :type device: str :param device: The device on the instance through which the volume will be exposed (e.g. /dev/sdh) :rtype: bool :return: True if successful r8 )r � attach_volumer )r �instance_id�devicer9 r r r �attach� s �z Volume.attachc C s<