You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::Glacier::Job

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb

Defined Under Namespace

Classes: Collection

Actions collapse

Associations collapse

Read-Only Attributes collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_id, vault_name, id, options = {}) ⇒ Job #initialize(options = {}) ⇒ Job

Returns a new instance of Job

Overloads:

  • #initialize(account_id, vault_name, id, options = {}) ⇒ Job

    Parameters:

    • account_id (String)
    • vault_name (String)
    • id (String)

    Options Hash (options):

  • #initialize(options = {}) ⇒ Job

    Options Hash (options):

    • :account_id (required, String)
    • :vault_name (required, String)
    • :id (required, String)
    • :client (Client)


23
24
25
26
27
28
29
30
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 23

def initialize(*args)
  options = Hash === args.last ? args.pop.dup : {}
  @account_id = (args, options)
  @vault_name = extract_vault_name(args, options)
  @id = extract_id(args, options)
  @data = options.delete(:data)
  @client = options.delete(:client) || Client.new(options)
end

Instance Method Details

#account_idString

Returns:

  • (String)


35
36
37
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 35

def 
  @account_id
end

#actionString

The job type. It is either ArchiveRetrieval or InventoryRetrieval.

Returns:

  • (String)


58
59
60
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 58

def action
  data.action
end

#archive_idString

For an ArchiveRetrieval job, this is the archive ID requested for download. Otherwise, this field is null.

Returns:

  • (String)


65
66
67
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 65

def archive_id
  data.archive_id
end

#archive_sha256_tree_hashString

The SHA256 tree hash of the entire archive for an archive retrieval. For inventory retrieval jobs, this field is null.

Returns:

  • (String)


167
168
169
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 167

def archive_sha256_tree_hash
  data.archive_sha256_tree_hash
end

#archive_size_in_bytesInteger

For an ArchiveRetrieval job, this is the size in bytes of the archive being requested for download. For the InventoryRetrieval job, the value is null.

Returns:

  • (Integer)


106
107
108
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 106

def archive_size_in_bytes
  data.archive_size_in_bytes
end

#clientClient

Returns:



197
198
199
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 197

def client
  @client
end

#completedBoolean

The job status. When a job is completed, you get the job's output.

Returns:

  • (Boolean)


85
86
87
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 85

def completed
  data.completed
end

#completion_dateTime

The UTC time that the archive retrieval request completed. While the job is in progress, the value will be null.

Returns:

  • (Time)


128
129
130
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 128

def completion_date
  data.completion_date
end

#creation_dateTime

The UTC date when the job was created. A string representation of ISO 8601 date format, for example, "2012-03-20T17:03:43.221Z".

Returns:

  • (Time)


79
80
81
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 79

def creation_date
  data.creation_date
end

#dataTypes::GlacierJobDescription

Returns the data for this Aws::Glacier::Job. Calls Client#describe_job if #data_loaded? is false.

Returns:



221
222
223
224
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 221

def data
  load unless @data
  @data
end

#data_loaded?Boolean

Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.

Returns:

  • (Boolean)

    Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.



229
230
231
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 229

def data_loaded?
  !!@data
end

#get_output(options = {}) ⇒ Types::GetJobOutputOutput

Examples:

Request syntax with placeholder values


job.get_output({
  range: "string",
})

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

  • :range (String)

    The range of bytes to retrieve from the output. For example, if you want to download the first 1,048,576 bytes, specify the range as bytes=0-1048575. By default, this operation downloads the entire output.

    If the job output is large, then you can use a range to retrieve a portion of the output. This allows you to download the entire output in smaller chunks of bytes. For example, suppose you have 1 GB of job output you want to download and you decide to download 128 MB chunks of data at a time, which is a total of eight Get Job Output requests. You use the following process to download the job output:

    1. Download a 128 MB chunk of output by specifying the appropriate byte range. Verify that all 128 MB of data was received.

    2. Along with the data, the response includes a SHA256 tree hash of the payload. You compute the checksum of the payload on the client and compare it with the checksum you received in the response to ensure you received all the expected data.

    3. Repeat steps 1 and 2 for all the eight 128 MB chunks of output data, each time specifying the appropriate byte range.

    4. After downloading all the parts of the job output, you have a list of eight checksum values. Compute the tree hash of these values to find the checksum of the entire output. Using the DescribeJob API, obtain job information of the job that provided you the output. The response includes the checksum of the entire archive stored in Amazon Glacier. You compare this value with the checksum you computed to ensure you have downloaded the entire archive content with no errors.

Returns:



274
275
276
277
278
279
280
281
282
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 274

def get_output(options = {})
  options = options.merge(
    account_id: @account_id,
    vault_name: @vault_name,
    job_id: @id
  )
  resp = @client.get_job_output(options)
  resp.data
end

#idString Also known as: job_id

Returns:

  • (String)


45
46
47
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 45

def id
  @id
end

#inventory_retrieval_parametersTypes::InventoryRetrievalJobDescription

Parameters used for range inventory retrieval.



190
191
192
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 190

def inventory_retrieval_parameters
  data.inventory_retrieval_parameters
end

#inventory_size_in_bytesInteger

For an InventoryRetrieval job, this is the size in bytes of the inventory requested for download. For the ArchiveRetrieval job, the value is null.

Returns:

  • (Integer)


114
115
116
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 114

def inventory_size_in_bytes
  data.inventory_size_in_bytes
end

#job_descriptionString

The job description you provided when you initiated the job.

Returns:

  • (String)


52
53
54
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 52

def job_description
  data.job_description
end

#loadself 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

Returns:

  • (self)


207
208
209
210
211
212
213
214
215
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 207

def load
  resp = @client.describe_job(
    account_id: @account_id,
    vault_name: @vault_name,
    job_id: @id
  )
  @data = resp.data
  self
end

#retrieval_byte_rangeString

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 and StartByteValue equals 0 and EndByteValue equals the size of the archive minus 1. For inventory retrieval jobs this field is null.

Returns:

  • (String)


177
178
179
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 177

def retrieval_byte_range
  data.retrieval_byte_range
end

#sha256_tree_hashString

For an ArchiveRetrieval job, it is the checksum of the archive. Otherwise, the value is null.

The SHA256 tree hash value for the requested range of an archive. If the Initiate a Job request for an archive specified a tree-hash aligned range, then this field returns a value.

For the specific case when the whole archive is retrieved, this value is the same as the ArchiveSHA256TreeHash value.

This field is null in the following situations:

  • 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 and the job status is InProgress.

^ ^

  • Inventory jobs.

^

Returns:

  • (String)


160
161
162
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 160

def sha256_tree_hash
  data.sha256_tree_hash
end

#sns_topicString

An Amazon Simple Notification Service (Amazon SNS) topic that receives notification.

Returns:

  • (String)


121
122
123
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 121

def sns_topic
  data.sns_topic
end

#status_codeString

The status code can be InProgress, Succeeded, or Failed, and indicates the status of the job.

Returns:

  • (String)


92
93
94
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 92

def status_code
  data.status_code
end

#status_messageString

A friendly message that describes the job status.

Returns:

  • (String)


98
99
100
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 98

def status_message
  data.status_message
end

#tierString

The retrieval option to use for the archive retrieval. Valid values are Expedited, Standard, or Bulk. Standard is the default.

Returns:

  • (String)


184
185
186
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 184

def tier
  data.tier
end

#vaultVault

Returns:



287
288
289
290
291
292
293
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 287

def vault
  Vault.new(
    account_id: @account_id,
    name: @vault_name,
    client: @client
  )
end

#vault_arnString

The Amazon Resource Name (ARN) of the vault from which the archive retrieval was requested.

Returns:

  • (String)


72
73
74
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 72

def vault_arn
  data.vault_arn
end

#vault_nameString

Returns:

  • (String)


40
41
42
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/job.rb', line 40

def vault_name
  @vault_name
end