ó FRTc@s|dZddlmZddlmZddlmZdefd„ƒYZdefd„ƒYZ d efd „ƒYZ d S( s0 Represents an EC2 Elastic Block Storage Volume iÿÿÿÿ(t ResultSet(tTag(tTaggedEC2ObjecttVolumecBs§eZdZdd„Zd„Zd„Zd„Zd„Ze e d„Z e d„Z e d„Z e e d „Z de d „Zd „Zd „Zdde d „ZRS(s¨ 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. cCsttt|ƒj|ƒd|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ dS(N(tsuperRt__init__tNonetidt create_timetstatustsizet snapshot_idt attach_datatzonettypetiopst encrypted(tselft connection((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyR2s         cCs d|jS(Ns Volume:%s(R(R((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyt__repr__?scCs€tt|ƒj|||ƒ}|dk r.|S|dkrMtƒ|_|jS|dkrxtdtfgƒ|_|jSdSdS(Nt attachmentSetttagSettitem( RRt startElementRt AttachmentSetR RRttags(RtnametattrsRtretval((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyRBs    cCs|dkr||_n÷|dkr0||_nß|dkrW|dkr||_qn¸|dkrut|ƒ|_nš|dkr||_n‚|dkr¥||_nj|dkr½||_nR|d krÛt|ƒ|_n4|d krÿ|j ƒd k|_ nt |||ƒdS( NtvolumeIdt createTimeR tR t snapshotIdtavailabilityZonet volumeTypeRRttrue( RRR tintR R R RRtlowerRtsetattr(RRtvalueR((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyt endElementOs(               cCs|jj|jƒdS(N(t__dict__tupdate(Rtupdated((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyt_updatefscCs’|jj|jgd|ƒ}g|D]}|j|jkr%|^q%}t|ƒdkro|j|dƒn|r‹td|jƒ‚n|jS(s¯ 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. tdry_runis%s is not a valid Volume ID(Rtget_all_volumesRtlenR,t ValueErrorR (RtvalidateR-t unfiltered_rstxtrs((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyR*is   +cCs|jj|jd|ƒS(sc Delete this EBS volume. :rtype: bool :return: True if successful R-(Rt delete_volumeR(RR-((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pytdelete€scCs|jj|j||d|ƒS(s¤ 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 R-(Rt attach_volumeR(Rt instance_idtdeviceR-((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pytattach‰s  cCs^d}|jr|jj}nd}|jr<|jj}n|jj|j|||d|ƒS(sŒ Detach this EBS volume from an EC2 instance. :type force: bool :param force: Forces detachment if the previous detachment attempt did not occur cleanly. This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach a volume from a failed instance. The instance will not have an opportunity to flush file system caches nor file system meta data. If you use this option, you must perform file system check and repair procedures. :rtype: bool :return: True if successful R-N(RR R8R9Rt detach_volumeR(RtforceR-R8R9((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pytdetachŸs   cCs|jj|j|d|ƒS(s Create a snapshot of this EBS Volume. :type description: str :param description: A description of the snapshot. Limited to 256 characters. :rtype: :class:`boto.ec2.snapshot.Snapshot` :return: The created Snapshot object R-(Rtcreate_snapshotR(Rt descriptionR-((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyR>¾s cCs|jS(sW Returns the state of the volume. Same value as the status attribute. (R (R((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyt volume_stateÏscCs"d}|jr|jj}n|S(s+ Get the attachment state. N(RR R (Rtstate((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pytattachment_stateÕs cCs^|jjd|d|d|ƒ}g}x0|D](}|j|jkr.|j|ƒq.q.W|S(sý Get all snapshots related to this volume. Note that this requires that all available snapshots for the account be retrieved from EC2 first and then the list is filtered client-side to contain only those for this volume. :type owner: str :param owner: If present, only the snapshots owned by the specified user will be returned. Valid values are: * self * amazon * AWS Account ID :type restorable_by: str :param restorable_by: If present, only the snapshots that are restorable by the specified account id will be returned. :rtype: list of L{boto.ec2.snapshot.Snapshot} :return: The requested Snapshot objects townert restorable_byR-(Rtget_all_snapshotst volume_idRtappend(RRCRDR-R4tminetsnap((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyt snapshotsÞs   N(t__name__t __module__t__doc__RRRRR(R,tFalseR*R6R:R=R>R@RBRJ(((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyR s      RcBs2eZdZd„Zd„Zd„Zd„ZRS(s Represents an EBS attachmentset. :ivar id: The unique ID of the volume. :ivar instance_id: The unique ID of the attached instance :ivar status: The status of the attachment :ivar attach_time: Attached since :ivar device: The device the instance has mapped cCs1d|_d|_d|_d|_d|_dS(N(RRR8R t attach_timeR9(R((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyR s     cCs d|jS(NsAttachmentSet:%s(R(R((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyRscCsdS(N((RRRR((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyRscCsŒ|dkr||_np|dkr0||_nX|dkrH||_n@|dkr`||_n(|dkrx||_nt|||ƒdS(NRt instanceIdR t attachTimeR9(RR8R ROR9R&(RRR'R((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyR(s          (RKRLRMRRRR((((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyRs     tVolumeAttributecBs&eZdd„Zd„Zd„ZRS(cCsd|_d|_i|_dS(N(RRt _key_nameR(Rtparent((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyR(s  cCs|dkr||_ndS(Nt autoEnableIO(RSR(RRRR((s</opt/freeware/lib/python2.7/site-packages/boto/ec2/volume.pyR-s  cCsp|dkrD|jƒdkr1t|j|js á&