You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.
Class: AWS::EC2::Snapshot
- Inherits:
-
Resource
- Object
- Core::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.
52 53 54 |
# File 'lib/aws/ec2/snapshot.rb', line 52 def description @description end |
#id ⇒ String (readonly)
Returns the snapshot's ID.
64 65 66 |
# File 'lib/aws/ec2/snapshot.rb', line 64 def id @id end |
#owner_id ⇒ String (readonly)
The AWS account ID of the snapshot owner.
52 53 54 |
# File 'lib/aws/ec2/snapshot.rb', line 52 def owner_id @owner_id end |
#progress ⇒ Integer (readonly)
The progress of the snapshot as a percentage.
52 53 54 |
# File 'lib/aws/ec2/snapshot.rb', line 52 def progress @progress end |
#start_time ⇒ Time (readonly)
The time at which the snapshot was initiated.
52 53 54 |
# File 'lib/aws/ec2/snapshot.rb', line 52 def start_time @start_time end |
#status ⇒ Symbol (readonly)
The status of the snapshot. Possible values:
:pending
:completed
:error
52 53 54 |
# File 'lib/aws/ec2/snapshot.rb', line 52 def status @status end |
#volume_id ⇒ String (readonly)
The ID of the volume this snapshot was created from.
52 53 54 |
# File 'lib/aws/ec2/snapshot.rb', line 52 def volume_id @volume_id end |
#volume_size ⇒ Integer (readonly)
The size of the volume from which the snapshot was created.
52 53 54 |
# File 'lib/aws/ec2/snapshot.rb', line 52 def volume_size @volume_size end |
Instance Method Details
#create_volume(availability_zone, options = {}) ⇒ Volume
Creates a volume from the snapshot.
114 115 116 117 118 119 120 |
# File 'lib/aws/ec2/snapshot.rb', line 114 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.
96 97 98 99 |
# File 'lib/aws/ec2/snapshot.rb', line 96 def delete client.delete_snapshot(:snapshot_id => id) nil end |
#exists? ⇒ Boolean
Returns True if the snapshot exists.
123 124 125 126 127 128 |
# File 'lib/aws/ec2/snapshot.rb', line 123 def exists? resp = client.describe_snapshots(:filters => [{ :name => 'snapshot-id', :values => [id] }]) and !resp.snapshot_set.empty? end |
#volume ⇒ Volume
Returns The volume this snapshot was created from.
131 132 133 |
# File 'lib/aws/ec2/snapshot.rb', line 131 def volume Volume.new(volume_id, :config => config) if volume_id end |