Class: Aws::Glacier::Job
- Inherits:
-
Object
- Object
- Aws::Glacier::Job
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-glacier/job.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
- #account_id ⇒ String
-
#action ⇒ String
The job type.
-
#archive_id ⇒ String
The archive ID requested for a select job or archive retrieval.
-
#archive_sha256_tree_hash ⇒ String
The SHA256 tree hash of the entire archive for an archive retrieval.
-
#archive_size_in_bytes ⇒ Integer
For an archive retrieval job, this value is the size in bytes of the archive being requested for download.
-
#completed ⇒ Boolean
The job status.
-
#completion_date ⇒ Time
The UTC time that the job request completed.
-
#creation_date ⇒ Time
The UTC date when the job was created.
- #id ⇒ String (also: #job_id)
-
#inventory_retrieval_parameters ⇒ Types::InventoryRetrievalJobDescription
Parameters used for range inventory retrieval.
-
#inventory_size_in_bytes ⇒ Integer
For an inventory retrieval job, this value is the size in bytes of the inventory requested for download.
-
#job_description ⇒ String
The job description provided when initiating the job.
-
#job_output_path ⇒ String
Contains the job output location.
-
#output_location ⇒ Types::OutputLocation
Contains the location where the data from the select job is stored.
-
#retrieval_byte_range ⇒ String
The retrieved byte range for archive retrieval jobs in the form StartByteValue-EndByteValue.
-
#select_parameters ⇒ Types::SelectParameters
Contains the parameters used for a select.
-
#sha256_tree_hash ⇒ String
For an archive retrieval job, this value is the checksum of the archive.
-
#sns_topic ⇒ String
An Amazon SNS topic that receives notification.
-
#status_code ⇒ String
The status code can be ‘InProgress`, `Succeeded`, or `Failed`, and indicates the status of the job.
-
#status_message ⇒ String
A friendly message that describes the job status.
-
#tier ⇒ String
The tier to use for a select or an archive retrieval.
-
#vault_arn ⇒ String
The Amazon Resource Name (ARN) of the vault from which an archive retrieval was requested.
- #vault_name ⇒ String
Actions collapse
Associations collapse
- #identifiers ⇒ Object deprecated private Deprecated.
- #vault ⇒ Vault
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::GlacierJobDescription
Returns the data for this Job.
-
#data_loaded? ⇒ Boolean
Returns ‘true` if this resource is loaded.
-
#initialize(*args) ⇒ Job
constructor
A new instance of Job.
- #load ⇒ self (also: #reload)
-
#wait_until(options = {}, &block) ⇒ Resource
deprecated
Deprecated.
Use [Aws::Glacier::Client] #wait_until instead
Constructor Details
#initialize(account_id, vault_name, id, options = {}) ⇒ Job #initialize(options = {}) ⇒ Job
Returns a new instance of Job.
23 24 25 26 27 28 29 30 |
# File 'lib/aws-sdk-glacier/job.rb', line 23 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @account_id = extract_account_id(args, ) @vault_name = extract_vault_name(args, ) @id = extract_id(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() end |
Instance Method Details
#account_id ⇒ String
35 36 37 |
# File 'lib/aws-sdk-glacier/job.rb', line 35 def account_id @account_id end |
#action ⇒ String
The job type. This value is either ‘ArchiveRetrieval`, `InventoryRetrieval`, or `Select`.
59 60 61 |
# File 'lib/aws-sdk-glacier/job.rb', line 59 def action data[:action] end |
#archive_id ⇒ String
The archive ID requested for a select job or archive retrieval. Otherwise, this field is null.
66 67 68 |
# File 'lib/aws-sdk-glacier/job.rb', line 66 def archive_id data[:archive_id] end |
#archive_sha256_tree_hash ⇒ String
The SHA256 tree hash of the entire archive for an archive retrieval. For inventory retrieval or select jobs, this field is null.
169 170 171 |
# File 'lib/aws-sdk-glacier/job.rb', line 169 def archive_sha256_tree_hash data[:archive_sha256_tree_hash] end |
#archive_size_in_bytes ⇒ Integer
For an archive retrieval job, this value is the size in bytes of the archive being requested for download. For an inventory retrieval or select job, this value is null.
109 110 111 |
# File 'lib/aws-sdk-glacier/job.rb', line 109 def archive_size_in_bytes data[:archive_size_in_bytes] end |
#completed ⇒ Boolean
The job status. When a job is completed, you get the job’s output using Get Job Output (GET output).
88 89 90 |
# File 'lib/aws-sdk-glacier/job.rb', line 88 def completed data[:completed] end |
#completion_date ⇒ Time
The UTC time that the job request completed. While the job is in progress, the value is null.
130 131 132 |
# File 'lib/aws-sdk-glacier/job.rb', line 130 def completion_date data[:completion_date] end |
#creation_date ⇒ Time
The UTC date when the job was created. This value is a string representation of ISO 8601 date format, for example ‘“2012-03-20T17:03:43.221Z”`.
81 82 83 |
# File 'lib/aws-sdk-glacier/job.rb', line 81 def creation_date data[:creation_date] end |
#data ⇒ Types::GlacierJobDescription
Returns the data for this Aws::Glacier::Job. Calls Client#describe_job if #data_loaded? is ‘false`.
242 243 244 245 |
# File 'lib/aws-sdk-glacier/job.rb', line 242 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
250 251 252 |
# File 'lib/aws-sdk-glacier/job.rb', line 250 def data_loaded? !!@data end |
#get_output(options = {}, &block) ⇒ Types::GetJobOutputOutput
390 391 392 393 394 395 396 397 398 |
# File 'lib/aws-sdk-glacier/job.rb', line 390 def get_output( = {}, &block) = .merge( account_id: @account_id, vault_name: @vault_name, job_id: @id ) resp = @client.get_job_output(, &block) resp.data end |
#id ⇒ String Also known as: job_id
45 46 47 |
# File 'lib/aws-sdk-glacier/job.rb', line 45 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.
413 414 415 416 417 418 419 |
# File 'lib/aws-sdk-glacier/job.rb', line 413 def identifiers { account_id: @account_id, vault_name: @vault_name, id: @id } end |
#inventory_retrieval_parameters ⇒ Types::InventoryRetrievalJobDescription
Parameters used for range inventory retrieval.
193 194 195 |
# File 'lib/aws-sdk-glacier/job.rb', line 193 def inventory_retrieval_parameters data[:inventory_retrieval_parameters] end |
#inventory_size_in_bytes ⇒ Integer
For an inventory retrieval job, this value is the size in bytes of the inventory requested for download. For an archive retrieval or select job, this value is null.
117 118 119 |
# File 'lib/aws-sdk-glacier/job.rb', line 117 def inventory_size_in_bytes data[:inventory_size_in_bytes] end |
#job_description ⇒ String
The job description provided when initiating the job.
52 53 54 |
# File 'lib/aws-sdk-glacier/job.rb', line 52 def job_description data[:job_description] end |
#job_output_path ⇒ String
Contains the job output location.
199 200 201 |
# File 'lib/aws-sdk-glacier/job.rb', line 199 def job_output_path data[:job_output_path] end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::Glacier::Job. Returns ‘self` making it possible to chain methods.
job.reload.data
228 229 230 231 232 233 234 235 236 |
# File 'lib/aws-sdk-glacier/job.rb', line 228 def load resp = @client.describe_job( account_id: @account_id, vault_name: @vault_name, job_id: @id ) @data = resp.data self end |
#output_location ⇒ Types::OutputLocation
Contains the location where the data from the select job is stored.
211 212 213 |
# File 'lib/aws-sdk-glacier/job.rb', line 211 def output_location data[:output_location] end |
#retrieval_byte_range ⇒ String
The retrieved byte range for archive retrieval jobs in the form StartByteValue-EndByteValue. If no range was specified in the archive retrieval, then the whole archive is retrieved. In this case, StartByteValue equals 0 and EndByteValue equals the size of the archive minus 1. For inventory retrieval or select jobs, this field is null.
180 181 182 |
# File 'lib/aws-sdk-glacier/job.rb', line 180 def retrieval_byte_range data[:retrieval_byte_range] end |
#select_parameters ⇒ Types::SelectParameters
Contains the parameters used for a select.
205 206 207 |
# File 'lib/aws-sdk-glacier/job.rb', line 205 def select_parameters data[:select_parameters] end |
#sha256_tree_hash ⇒ String
For an archive retrieval job, this value is the checksum of the archive. Otherwise, this value is null.
The SHA256 tree hash value for the requested range of an archive. If the InitiateJob request for an archive specified a tree-hash aligned range, then this field returns a value.
If the whole archive is retrieved, this value is the same as the ArchiveSHA256TreeHash value.
This field is null for the following:
-
Archive retrieval jobs that specify a range that is not tree-hash aligned
^ ^
-
Archival jobs that specify a range that is equal to the whole archive, when the job status is ‘InProgress`
^ ^
-
Inventory jobs
-
Select jobs
162 163 164 |
# File 'lib/aws-sdk-glacier/job.rb', line 162 def sha256_tree_hash data[:sha256_tree_hash] end |
#sns_topic ⇒ String
An Amazon SNS topic that receives notification.
123 124 125 |
# File 'lib/aws-sdk-glacier/job.rb', line 123 def sns_topic data[:sns_topic] end |
#status_code ⇒ String
The status code can be ‘InProgress`, `Succeeded`, or `Failed`, and indicates the status of the job.
95 96 97 |
# File 'lib/aws-sdk-glacier/job.rb', line 95 def status_code data[:status_code] end |
#status_message ⇒ String
A friendly message that describes the job status.
101 102 103 |
# File 'lib/aws-sdk-glacier/job.rb', line 101 def data[:status_message] end |
#tier ⇒ String
The tier to use for a select or an archive retrieval. Valid values are ‘Expedited`, `Standard`, or `Bulk`. `Standard` is the default.
187 188 189 |
# File 'lib/aws-sdk-glacier/job.rb', line 187 def tier data[:tier] end |
#vault ⇒ Vault
403 404 405 406 407 408 409 |
# File 'lib/aws-sdk-glacier/job.rb', line 403 def vault Vault.new( account_id: @account_id, name: @vault_name, client: @client ) end |
#vault_arn ⇒ String
The Amazon Resource Name (ARN) of the vault from which an archive retrieval was requested.
73 74 75 |
# File 'lib/aws-sdk-glacier/job.rb', line 73 def vault_arn data[:vault_arn] end |
#vault_name ⇒ String
40 41 42 |
# File 'lib/aws-sdk-glacier/job.rb', line 40 def vault_name @vault_name end |
#wait_until(options = {}, &block) ⇒ Resource
Use [Aws::Glacier::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) {|instance| instance.state.name == 'running' }
## 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
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/aws-sdk-glacier/job.rb', line 332 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::Waiters::Waiter.new().wait({}) end |