o ckF[s@s@dZddlmZddlmZGdddeZGdddeZdS) z0 Represents an EC2 Elastic Block Store Snapshot )TaggedEC2Object)ZonecseZdZdZdZdfdd ZddZdd Zd d Zdd dZ dddZ dddZ dddZ dddZ dddZ  dddZZS) 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 createVolumePermissionNcsPtt||d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ dSN) superr__init__id volume_idstatusprogress start_timeowner_id owner_alias volume_size description encrypted)self connection __class__3/usr/lib/python3/dist-packages/boto/ec2/snapshot.pyr0s zSnapshot.__init__cCs d|jS)Nz Snapshot:%s)r )rrrr__repr__=s zSnapshot.__repr__cCs|dkr ||_dS|dkr||_dS|dkr||_dS|dkr$||_dS|dkr-||_dS|dkr6||_dS|dkrLzt||_WdS||_YdS|dkrU||_dS|d krb| d k|_ dSt |||dS) N snapshotIdvolumeIdr startTimeownerId ownerAlias volumeSizerrtrue) r r r r rrintrrlowerrsetattrrnamevaluerrrr endElement@s,        zSnapshot.endElementcCs|j|_|j|_dSr)r r )rupdatedrrr_updateYs zSnapshot._updateFcCsL|jj|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_runrz%s is not a valid Snapshot ID)rget_all_snapshotsr lenr) ValueErrorr )rvalidater+rsrrrupdate]s zSnapshot.updatecCs|jj|j|dSNr*)rdelete_snapshotr rr+rrrdeleteoszSnapshot.deletecCs|jj|j|j|d}|jSr2)rget_snapshot_attributer AttrNameattrs)rr+r8rrrget_permissionsrs zSnapshot.get_permissionscC|jj|j|jd|||dS)Naddr*rmodify_snapshot_attributer r7ruser_idsgroupsr+rrrsharez zSnapshot.sharecCr:)Nremover*r<r>rrrunsharerBzSnapshot.unsharecCs|jj|j|j|dSr2)rreset_snapshot_attributer r7r4rrrreset_permissionss zSnapshot.reset_permissionsc Cs.t|tr|j}|jj|||j|||j|dS)aq Create a new EBS Volume from this Snapshot :type zone: string or :class:`boto.ec2.zone.Zone` :param zone: The availability zone in which the Volume will be created. :type size: int :param size: The size of the new volume, in GiB. (optional). Defaults to the size of the snapshot. :type volume_type: string :param volume_type: The type of the volume. (optional). Valid values are: standard | io1 | gp2. :type iops: int :param iops: The provisioned IOPs you want to associate with this volume. (optional) r*) isinstancerr%r create_volumer r)rzonesize volume_typeiopsr+rrrrHs zSnapshot.create_volumer)FF)F)NNF)NNNF)__name__ __module__ __qualname____doc__r7rrr'r)r1r5r9rArDrFrH __classcell__rrrrrs        rc@s&eZdZdddZddZddZdS) SnapshotAttributeNcCsd|_i|_dSr) snapshot_idr8)rparentrrrrs zSnapshotAttribute.__init__cCsdSrr)rr%r8rrrr startElementszSnapshotAttribute.startElementcCs|dkr d|_dS|dkr$d|jvr|jd|dS|g|jd<dS|dkr?d|jvr7|jd|dS|g|jd<dS|dkrH||_dSt|||dS)Nrcreate_volume_permissiongroupr@userIdr?r)r%r8appendrSr#r$rrrr's    zSnapshotAttribute.endElementr)rMrNrOrrUr'rrrrrRs  rRN)rPboto.ec2.ec2objectr boto.ec2.zonerrobjectrRrrrrs