Class: AWS::EC2::Snapshot
- Inherits:
-
Resource
- Object
- Resource
- Resource
- AWS::EC2::Snapshot
- Includes:
- HasPermissions, TaggedItem
- Defined in:
- lib/aws/ec2/snapshot.rb
Overview
Represents an Amazon EBS snapshot.
Instance Attribute Summary collapse
-
#description ⇒ String
readonly
The description of the snapshot provided at snapshot initiation.
-
#id ⇒ String
readonly
Returns the snapshot’s ID.
-
#owner_id ⇒ String
readonly
The AWS account ID of the snapshot owner.
-
#progress ⇒ Integer
readonly
The progress of the snapshot as a percentage.
-
#start_time ⇒ Time
readonly
The time at which the snapshot was initiated.
-
#status ⇒ Symbol
readonly
The status of the snapshot.
-
#volume_id ⇒ String
readonly
The ID of the volume this snapshot was created from.
-
#volume_size ⇒ Integer
readonly
The size of the volume from which the snapshot was created.
Instance Method Summary collapse
-
#create_volume(availability_zone, options = {}) ⇒ Volume
Creates a volume from the snapshot.
-
#delete ⇒ nil
Deletes the snapshot.
-
#exists? ⇒ Boolean
True if the snapshot exists.
-
#volume ⇒ Volume
The volume this snapshot was created from.
Methods included from HasPermissions
#permissions, #private?, #public=, #public?
Methods included from TaggedItem
Instance Attribute Details
#description ⇒ String (readonly)
The description of the snapshot provided at snapshot initiation.
56 57 58 |
# File 'lib/aws/ec2/snapshot.rb', line 56 def description @description end |
#id ⇒ String (readonly)
Returns the snapshot’s ID.
68 69 70 |
# File 'lib/aws/ec2/snapshot.rb', line 68 def id @id end |
#owner_id ⇒ String (readonly)
The AWS account ID of the snapshot owner.
56 57 58 |
# File 'lib/aws/ec2/snapshot.rb', line 56 def owner_id @owner_id end |
#progress ⇒ Integer (readonly)
The progress of the snapshot as a percentage.
56 57 58 |
# File 'lib/aws/ec2/snapshot.rb', line 56 def progress @progress end |
#start_time ⇒ Time (readonly)
The time at which the snapshot was initiated.
56 57 58 |
# File 'lib/aws/ec2/snapshot.rb', line 56 def start_time @start_time end |
#status ⇒ Symbol (readonly)
The status of the snapshot. Possible values:
-
:pending
-
:completed
-
:error
56 57 58 |
# File 'lib/aws/ec2/snapshot.rb', line 56 def status @status end |
#volume_id ⇒ String (readonly)
The ID of the volume this snapshot was created from.
56 57 58 |
# File 'lib/aws/ec2/snapshot.rb', line 56 def volume_id @volume_id end |
#volume_size ⇒ Integer (readonly)
The size of the volume from which the snapshot was created.
56 57 58 |
# File 'lib/aws/ec2/snapshot.rb', line 56 def volume_size @volume_size end |
Instance Method Details
#create_volume(availability_zone, options = {}) ⇒ Volume
Creates a volume from the snapshot.
118 119 120 121 122 123 124 |
# File 'lib/aws/ec2/snapshot.rb', line 118 def create_volume availability_zone, = {} volumes = VolumeCollection.new(:config => config) volumes.create(.merge( :availability_zone => availability_zone, :snapshot => self )) end |
#delete ⇒ nil
Deletes the snapshot.
100 101 102 103 |
# File 'lib/aws/ec2/snapshot.rb', line 100 def delete client.delete_snapshot(:snapshot_id => id) nil end |
#exists? ⇒ Boolean
Returns True if the snapshot exists.
127 128 129 130 131 132 |
# File 'lib/aws/ec2/snapshot.rb', line 127 def exists? resp = client.describe_snapshots(:filters => [{ :name => 'snapshot-id', :values => [id] }]) and !resp.snapshot_set.empty? end |