Class: Aws::EC2::Snapshot
- Inherits:
-
Object
- Object
- Aws::EC2::Snapshot
- Extended by:
- Deprecations
- Defined in:
- sig/snapshot.rbs,
lib/aws-sdk-ec2/snapshot.rb
Overview
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#availability_zone ⇒ String
The Availability Zone or Local Zone of the snapshot.
-
#completion_duration_minutes ⇒ Integer
Only for snapshot copies created with time-based snapshot copy operations. -
#completion_time ⇒ Time
The time stamp when the snapshot was completed.
-
#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.
-
#full_snapshot_size_in_bytes ⇒ Integer
The full size of the snapshot, in bytes.
- #id ⇒ String (also: #snapshot_id)
-
#kms_key_id ⇒ String
The Amazon Resource Name (ARN) of the KMS key that was used to protect the volume encryption key for the parent volume.
-
#outpost_arn ⇒ String
The ARN of the Outpost on which the snapshot is stored.
-
#owner_alias ⇒ String
The Amazon Web Services owner alias, from an Amazon-maintained list (
amazon). -
#owner_id ⇒ String
The ID of the Amazon Web Services account that owns the EBS snapshot.
-
#progress ⇒ String
The progress of the snapshot, as a percentage.
-
#restore_expiry_time ⇒ Time
Only for archived snapshots that are temporarily restored.
-
#sse_type ⇒ String
Reserved for future use.
-
#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.
-
#storage_tier ⇒ String
The storage tier in which the snapshot is stored.
-
#tags ⇒ Array<Types::Tag>
Any tags assigned to the snapshot.
-
#transfer_type ⇒ String
Only for snapshot copies. -
#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
- #delete_tags(options = {}) ⇒ Tag::Collection
- #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
trueif this resource is loaded. -
#initialize(*args) ⇒ Snapshot
constructor
A new instance of Snapshot.
- #load ⇒ self (also: #reload)
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::EC2::Client] #wait_until instead
- #wait_until_completed(options = {}, &block) ⇒ Snapshot
Constructor Details
#initialize(id, options = {}) ⇒ Snapshot #initialize(options = {}) ⇒ Snapshot
Returns a new instance of Snapshot.
13 14 15 |
# File 'sig/snapshot.rbs', line 13
def initialize: (String id, Hash[Symbol, untyped] options) -> void
| (id: String, ?client: Client) -> void
| (Hash[Symbol, untyped] args) -> void
|
Instance Method Details
#availability_zone ⇒ String
The Availability Zone or Local Zone of the snapshot. For example,
us-west-1a (Availability Zone) or us-west-2-lax-1a (Local Zone).
40 |
# File 'sig/snapshot.rbs', line 40
def availability_zone: () -> ::String
|
#completion_duration_minutes ⇒ Integer
The completion duration requested for the time-based snapshot copy operation.
46 |
# File 'sig/snapshot.rbs', line 46
def completion_duration_minutes: () -> ::Integer
|
#completion_time ⇒ Time
The time stamp when the snapshot was completed.
49 |
# File 'sig/snapshot.rbs', line 49
def completion_time: () -> ::Time
|
#create_tags(options = {}) ⇒ Tag::Collection
131 |
# File 'sig/snapshot.rbs', line 131
def create_tags: (
|
#data ⇒ Types::Snapshot
Returns the data for this Aws::EC2::Snapshot. Calls
Client#describe_snapshots if #data_loaded? is false.
94 |
# File 'sig/snapshot.rbs', line 94
def data: () -> Types::Snapshot
|
#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 DescribeSnapshots.
85 |
# File 'sig/snapshot.rbs', line 85
def data_encryption_key_id: () -> ::String
|
#data_loaded? ⇒ Boolean
97 |
# File 'sig/snapshot.rbs', line 97
def data_loaded?: () -> bool
|
#delete(options = {}) ⇒ EmptyStructure
155 |
# File 'sig/snapshot.rbs', line 155
def delete: (
|
#delete_tags(options = {}) ⇒ Tag::Collection
143 |
# File 'sig/snapshot.rbs', line 143
def delete_tags: (
|
#describe_attribute(options = {}) ⇒ Types::DescribeSnapshotAttributeResult
161 |
# File 'sig/snapshot.rbs', line 161
def describe_attribute: (
|
#description ⇒ String
The description for the snapshot.
73 |
# File 'sig/snapshot.rbs', line 73
def description: () -> ::String
|
#encrypted ⇒ Boolean
Indicates whether the snapshot is encrypted.
79 |
# File 'sig/snapshot.rbs', line 79
def encrypted: () -> bool
|
#full_snapshot_size_in_bytes ⇒ Integer
The full size of the snapshot, in bytes.
This is not the incremental size of the snapshot. This is the full snapshot size and represents the size of all the blocks that were written to the source volume at the time the snapshot was created.
52 |
# File 'sig/snapshot.rbs', line 52
def full_snapshot_size_in_bytes: () -> ::Integer
|
#id ⇒ String Also known as: snapshot_id
18 |
# File 'sig/snapshot.rbs', line 18
def id: () -> String
|
#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.
742 743 744 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 742 def identifiers { id: @id } end |
#kms_key_id ⇒ String
The Amazon Resource Name (ARN) of the KMS key that was used to protect the volume encryption key for the parent volume.
82 |
# File 'sig/snapshot.rbs', line 82
def kms_key_id: () -> ::String
|
#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
90 |
# File 'sig/snapshot.rbs', line 90
def load: () -> self
|
#modify_attribute(options = {}) ⇒ EmptyStructure
168 |
# File 'sig/snapshot.rbs', line 168
def modify_attribute: (
|
#outpost_arn ⇒ String
The ARN of the Outpost on which the snapshot is stored. For more information, see Amazon EBS local snapshots on Outposts in the Amazon EBS User Guide.
25 |
# File 'sig/snapshot.rbs', line 25
def outpost_arn: () -> ::String
|
#owner_alias ⇒ String
The Amazon Web Services owner alias, from an Amazon-maintained list
(amazon). This is not the user-configured Amazon Web Services
account alias set using the IAM console.
22 |
# File 'sig/snapshot.rbs', line 22
def owner_alias: () -> ::String
|
#owner_id ⇒ String
The ID of the Amazon Web Services account that owns the EBS snapshot.
70 |
# File 'sig/snapshot.rbs', line 70
def owner_id: () -> ::String
|
#progress ⇒ String
The progress of the snapshot, as a percentage.
67 |
# File 'sig/snapshot.rbs', line 67
def progress: () -> ::String
|
#reset_attribute(options = {}) ⇒ EmptyStructure
192 |
# File 'sig/snapshot.rbs', line 192
def reset_attribute: (
|
#restore_expiry_time ⇒ Time
Only for archived snapshots that are temporarily restored. Indicates the date and time when a temporarily restored snapshot will be automatically re-archived.
34 |
# File 'sig/snapshot.rbs', line 34
def restore_expiry_time: () -> ::Time
|
#sse_type ⇒ String
Reserved for future use.
37 |
# File 'sig/snapshot.rbs', line 37
def sse_type: () -> ("sse-ebs" | "sse-kms" | "none")
|
#start_time ⇒ Time
The time stamp when the snapshot was initiated.
64 |
# File 'sig/snapshot.rbs', line 64
def start_time: () -> ::Time
|
#state ⇒ String
The snapshot state.
58 |
# File 'sig/snapshot.rbs', line 58
def state: () -> ("pending" | "completed" | "error" | "recoverable" | "recovering")
|
#state_message ⇒ String
Encrypted Amazon EBS snapshots are copied asynchronously. If a snapshot copy operation fails (for example, if the proper 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 DescribeSnapshots.
61 |
# File 'sig/snapshot.rbs', line 61
def state_message: () -> ::String
|
#storage_tier ⇒ String
The storage tier in which the snapshot is stored. standard indicates
that the snapshot is stored in the standard snapshot storage tier and
that it is ready for use. archive indicates that the snapshot is
currently archived and that it must be restored before it can be used.
31 |
# File 'sig/snapshot.rbs', line 31
def storage_tier: () -> ("archive" | "standard")
|
#tags ⇒ Array<Types::Tag>
Any tags assigned to the snapshot.
28 |
# File 'sig/snapshot.rbs', line 28
def tags: () -> ::Array[Types::Tag]
|
#transfer_type ⇒ String
Indicates whether the snapshot copy was created with a standard or time-based snapshot copy operation. Time-based snapshot copy operations complete within the completion duration specified in the request. Standard snapshot copy operations are completed on a best-effort basis.
-
standard- The snapshot copy was created with a standard snapshot copy operation. -
time-based- The snapshot copy was created with a time-based snapshot copy operation.
43 |
# File 'sig/snapshot.rbs', line 43
def transfer_type: () -> ("time-based" | "standard")
|
#volume_id ⇒ String
The ID of the volume that was used to create the snapshot. Snapshots created by a copy snapshot operation have an arbitrary volume ID that you should not use for any purpose.
55 |
# File 'sig/snapshot.rbs', line 55
def volume_id: () -> ::String
|
#volume_size ⇒ Integer
The size of the volume, in GiB.
76 |
# File 'sig/snapshot.rbs', line 76
def volume_size: () -> ::Integer
|
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::EC2::Client] #wait_until instead
The waiting operation is performed on a copy. The original resource remains unchanged.
Waiter polls an API operation until a resource enters a desired state.
Basic Usage
Waiter will polls until it is successful, it fails by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop until condition is true
resource.wait_until() {|resource| condition}
Example
instance.wait_until(max_attempts:10, delay:5) do |instance|
instance.state.name == 'running'
end
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. The waiting condition is set by passing a block to #wait_until:
# poll for ~25 seconds
resource.wait_until(max_attempts:5,delay:5) {|resource|...}
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success or :failure from these callbacks,
it will terminate the waiter.
started_at = Time.now
# poll for 1 hour, instead of a number of attempts
proc = Proc.new do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
# disable max attempts
instance.wait_until(before_wait:proc, max_attempts:nil) {...}
Handling Errors
When a waiter is successful, it returns the Resource. When a waiter fails, it raises an error.
begin
resource.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
attempts attempt in seconds invoked before each attempt invoked before each wait
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/aws-sdk-ec2/snapshot.rb', line 358 def wait_until( = {}, &block) self_copy = self.dup attempts = 0 [:max_attempts] = 10 unless .key?(:max_attempts) [:delay] ||= 10 [:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == [:max_attempts] :retry end end Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do Aws::Waiters::Waiter.new().wait({}) end end |
#wait_until_completed(options = {}, &block) ⇒ Snapshot
101 102 |
# File 'sig/snapshot.rbs', line 101
def wait_until_completed: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) ?{ (untyped waiter) -> void } -> Snapshot
| (?Hash[Symbol, untyped]) ?{ (untyped waiter) -> void } -> Snapshot
|