Class: Aws::EC2::Snapshot
- Inherits:
-
Object
- Object
- Aws::EC2::Snapshot
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-ec2/snapshot.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#data_encryption_key_id ⇒ String
The data encryption key identifier for the snapshot.
-
#description ⇒ String
The description for the snapshot.
-
#encrypted ⇒ Boolean
Indicates whether the snapshot is encrypted.
- #id ⇒ String (also: #snapshot_id)
-
#kms_key_id ⇒ String
The full ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) that was used to protect the volume encryption key for the parent volume.
-
#owner_alias ⇒ String
Value from an Amazon-maintained list (‘amazon` | `aws-marketplace` | `microsoft`) of snapshot owners.
-
#owner_id ⇒ String
The AWS account ID of the EBS snapshot owner.
-
#progress ⇒ String
The progress of the snapshot, as a percentage.
-
#start_time ⇒ Time
The time stamp when the snapshot was initiated.
-
#state ⇒ String
The snapshot state.
-
#state_message ⇒ String
Encrypted Amazon EBS snapshots are copied asynchronously.
-
#tags ⇒ Array<Types::Tag>
Any tags assigned to the snapshot.
-
#volume_id ⇒ String
The ID of the volume that was used to create the snapshot.
-
#volume_size ⇒ Integer
The size of the volume, in GiB.
Actions collapse
- #copy(options = {}) ⇒ Types::CopySnapshotResult
- #create_tags(options = {}) ⇒ Tag::Collection
- #delete(options = {}) ⇒ EmptyStructure
- #describe_attribute(options = {}) ⇒ Types::DescribeSnapshotAttributeResult
- #modify_attribute(options = {}) ⇒ EmptyStructure
- #reset_attribute(options = {}) ⇒ EmptyStructure
Associations collapse
- #identifiers ⇒ Object deprecated private Deprecated.
- #volume ⇒ Volume?
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::Snapshot
Returns the data for this Snapshot.
-
#data_loaded? ⇒ Boolean
Returns ‘true` if this resource is loaded.
-
#initialize(*args) ⇒ Snapshot
constructor
A new instance of Snapshot.
- #load ⇒ self (also: #reload)
- #wait_until_completed(options = {}) ⇒ Snapshot
Constructor Details
#initialize(id, options = {}) ⇒ Snapshot #initialize(options = {}) ⇒ Snapshot
Returns a new instance of Snapshot.
19 20 21 22 23 24 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 19 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @id = extract_id(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() end |
Instance Method Details
#copy(options = {}) ⇒ Types::CopySnapshotResult
260 261 262 263 264 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 260 def copy( = {}) = .merge(source_snapshot_id: @id) resp = @client.copy_snapshot() resp.data end |
#create_tags(options = {}) ⇒ Tag::Collection
288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 288 def ( = {}) batch = [] = Aws::Util.deep_merge(, resources: [@id]) resp = @client.() [:tags].each do |t| batch << Tag.new( resource_id: @id, key: t[:key], value: t[:value], client: @client ) end Tag::Collection.new([batch], size: batch.size) end |
#data ⇒ Types::Snapshot
Returns the data for this Aws::EC2::Snapshot. Calls Client#describe_snapshots if #data_loaded? is ‘false`.
152 153 154 155 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 152 def data load unless @data @data end |
#data_encryption_key_id ⇒ String
The data encryption key identifier for the snapshot. This value is a unique identifier that corresponds to the data encryption key that was used to encrypt the original volume or snapshot copy. Because data encryption keys are inherited by volumes created from snapshots, and vice versa, if snapshots share the same data encryption key identifier, then they belong to the same volume/snapshot lineage. This parameter is only returned by the DescribeSnapshots API operation.
42 43 44 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 42 def data_encryption_key_id data.data_encryption_key_id end |
#data_loaded? ⇒ Boolean
160 161 162 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 160 def data_loaded? !!@data end |
#delete(options = {}) ⇒ EmptyStructure
315 316 317 318 319 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 315 def delete( = {}) = .merge(snapshot_id: @id) resp = @client.delete_snapshot() resp.data end |
#describe_attribute(options = {}) ⇒ Types::DescribeSnapshotAttributeResult
336 337 338 339 340 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 336 def describe_attribute( = {}) = .merge(snapshot_id: @id) resp = @client.describe_snapshot_attribute() resp.data end |
#description ⇒ String
The description for the snapshot.
48 49 50 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 48 def description data.description end |
#encrypted ⇒ Boolean
Indicates whether the snapshot is encrypted.
54 55 56 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 54 def encrypted data.encrypted end |
#id ⇒ String Also known as: snapshot_id
29 30 31 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 29 def id @id end |
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
431 432 433 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 431 def identifiers { id: @id } end |
#kms_key_id ⇒ String
The full ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) that was used to protect the volume encryption key for the parent volume.
62 63 64 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 62 def kms_key_id data.kms_key_id end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::EC2::Snapshot. Returns ‘self` making it possible to chain methods.
snapshot.reload.data
142 143 144 145 146 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 142 def load resp = @client.describe_snapshots(snapshot_ids: [@id]) @data = resp.snapshots[0] self end |
#modify_attribute(options = {}) ⇒ EmptyStructure
387 388 389 390 391 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 387 def modify_attribute( = {}) = .merge(snapshot_id: @id) resp = @client.modify_snapshot_attribute() resp.data end |
#owner_alias ⇒ String
Value from an Amazon-maintained list (‘amazon` | `aws-marketplace` | `microsoft`) of snapshot owners. Not to be confused with the user-configured AWS account alias, which is set from the IAM console.
119 120 121 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 119 def owner_alias data.owner_alias end |
#owner_id ⇒ String
The AWS account ID of the EBS snapshot owner.
68 69 70 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 68 def owner_id data.owner_id end |
#progress ⇒ String
The progress of the snapshot, as a percentage.
74 75 76 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 74 def progress data.progress end |
#reset_attribute(options = {}) ⇒ EmptyStructure
409 410 411 412 413 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 409 def reset_attribute( = {}) = .merge(snapshot_id: @id) resp = @client.reset_snapshot_attribute() resp.data end |
#start_time ⇒ Time
The time stamp when the snapshot was initiated.
80 81 82 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 80 def start_time data.start_time end |
#state ⇒ String
The snapshot state.
86 87 88 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 86 def state data.state end |
#state_message ⇒ String
Encrypted Amazon EBS snapshots are copied asynchronously. If a snapshot copy operation fails (for example, if the proper AWS Key Management Service (AWS KMS) permissions are not obtained) this field displays error state details to help you diagnose why the error occurred. This parameter is only returned by the DescribeSnapshots API operation.
97 98 99 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 97 def data. end |
#tags ⇒ Array<Types::Tag>
Any tags assigned to the snapshot.
125 126 127 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 125 def data. end |
#volume ⇒ Volume?
418 419 420 421 422 423 424 425 426 427 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 418 def volume if data.volume_id Volume.new( id: data.volume_id, client: @client ) else nil end end |
#volume_id ⇒ String
The ID of the volume that was used to create the snapshot. Snapshots created by the CopySnapshot action have an arbitrary volume ID that should not be used for any purpose.
105 106 107 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 105 def volume_id data.volume_id end |
#volume_size ⇒ Integer
The size of the volume, in GiB.
111 112 113 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 111 def volume_size data.volume_size end |
#wait_until_completed(options = {}) ⇒ Snapshot
170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 170 def wait_until_completed( = {}) , params = () waiter = Waiters::SnapshotCompleted.new() yield_waiter_and_warn(waiter, &Proc.new) if block_given? resp = waiter.wait(params.merge(snapshot_ids: [@id])) Snapshot.new({ id: @id, data: resp.data.snapshots[], client: @client }) end |