Class: AWS::EC2::Snapshot
- Inherits:
-
Resource
- Object
- 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 ⇒ Object
readonly
The snapshot 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, opts = {}) ⇒ Volume
Creates a volume from the snapshot.
-
#delete ⇒ Object
Deletes the snapshot.
-
#exists? ⇒ Boolean
True if the snapshot exists.
-
#volume ⇒ Volume
The volume this snapshot was created from.
Methods included from TaggedItem
Methods included from HasPermissions
#permissions, #private?, #public=, #public?
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 ⇒ Object (readonly)
The snapshot ID
63 64 65 |
# File 'lib/aws/ec2/snapshot.rb', line 63 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, opts = {}) ⇒ Volume
Creates a volume from the snapshot.
89 90 91 92 93 |
# File 'lib/aws/ec2/snapshot.rb', line 89 def create_volume(availability_zone, opts = {}) VolumeCollection.new(:config => config). create(opts.merge(:snapshot => self, :availability_zone => availability_zone)) end |
#delete ⇒ Object
Deletes the snapshot.
72 73 74 |
# File 'lib/aws/ec2/snapshot.rb', line 72 def delete client.delete_snapshot(:snapshot_id => id) end |
#exists? ⇒ Boolean
Returns True if the snapshot exists.
96 97 98 99 100 101 |
# File 'lib/aws/ec2/snapshot.rb', line 96 def exists? resp = client.describe_snapshots(:filters => [{ :name => 'snapshot-id', :values => [id] }]) and !resp.snapshot_set.empty? end |