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

Class: Aws::Glacier::Vault

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

Defined Under Namespace

Classes: Collection

Actions collapse

Associations collapse

Read-Only Attributes collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_id, name, options = {}) ⇒ Vault #initialize(options = {}) ⇒ Vault

Returns a new instance of Vault

Overloads:

  • #initialize(account_id, name, options = {}) ⇒ Vault

    Parameters:

    • account_id (String)
    • name (String)

    Options Hash (options):

  • #initialize(options = {}) ⇒ Vault

    Options Hash (options):

    • :account_id (required, String)
    • :name (required, String)
    • :client (Client)


21
22
23
24
25
26
27
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 21

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

Instance Method Details

#accountAccount

Returns:



234
235
236
237
238
239
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 234

def 
  Account.new(
    id: @account_id,
    client: @client
  )
end

#account_idString

Returns:

  • (String)


32
33
34
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 32

def 
  @account_id
end

#archive(id) ⇒ Archive

Parameters:

  • id (String)

Returns:



243
244
245
246
247
248
249
250
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 243

def archive(id)
  Archive.new(
    account_id: @account_id,
    vault_name: @name,
    id: id,
    client: @client
  )
end

#clientClient

Returns:



83
84
85
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 83

def client
  @client
end

#completed_jobs(options = {}) ⇒ Job::Collection

Examples:

Request syntax with placeholder values


completed_jobs = vault.completed_jobs({
  statuscode: "string",
})

Parameters:

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

    ({})

Options Hash (options):

  • :statuscode (String)

    The type of job status to return. You can specify the following values: InProgress, Succeeded, or Failed.

Returns:



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 262

def completed_jobs(options = {})
  batches = Enumerator.new do |y|
    options = options.merge(
      account_id: @account_id,
      vault_name: @name,
      completed: "true"
    )
    resp = @client.list_jobs(options)
    resp.each_page do |page|
      batch = []
      page.data.job_list.each do |j|
        batch << Job.new(
          account_id: @account_id,
          vault_name: @name,
          id: j.job_id,
          data: j,
          client: @client
        )
      end
      y.yield(batch)
    end
  end
  Job::Collection.new(batches)
end

#create(options = {}) ⇒ Types::CreateVaultOutput

Examples:

Request syntax with placeholder values


vault.create()

Parameters:

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

    ({})

Returns:



125
126
127
128
129
130
131
132
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 125

def create(options = {})
  options = options.merge(
    vault_name: @name,
    account_id: @account_id
  )
  resp = @client.create_vault(options)
  resp.data
end

#creation_dateTime

The Universal Coordinated Time (UTC) date when the vault was created. This value should be a string in the ISO 8601 date format, for example 2012-03-20T17:03:43.221Z.

Returns:

  • (Time)


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

def creation_date
  data.creation_date
end

#dataTypes::DescribeVaultOutput

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

Returns:



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

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.



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

def data_loaded?
  !!@data
end

#delete(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


vault.delete()

Parameters:

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

    ({})

Returns:

  • (EmptyStructure)


139
140
141
142
143
144
145
146
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 139

def delete(options = {})
  options = options.merge(
    vault_name: @name,
    account_id: @account_id
  )
  resp = @client.delete_vault(options)
  resp.data
end

#failed_jobs(options = {}) ⇒ Job::Collection

Examples:

Request syntax with placeholder values


failed_jobs = vault.failed_jobs({
  completed: "string",
})

Parameters:

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

    ({})

Options Hash (options):

  • :completed (String)

    The state of the jobs to return. You can specify true or false.

Returns:



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 296

def failed_jobs(options = {})
  batches = Enumerator.new do |y|
    options = options.merge(
      account_id: @account_id,
      vault_name: @name,
      statuscode: "Failed"
    )
    resp = @client.list_jobs(options)
    resp.each_page do |page|
      batch = []
      page.data.job_list.each do |j|
        batch << Job.new(
          account_id: @account_id,
          vault_name: @name,
          id: j.job_id,
          data: j,
          client: @client
        )
      end
      y.yield(batch)
    end
  end
  Job::Collection.new(batches)
end

#initiate_inventory_retrieval(options = {}) ⇒ Job

Examples:

Request syntax with placeholder values


vault.initiate_inventory_retrieval()

Parameters:

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

    ({})

Returns:



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 153

def initiate_inventory_retrieval(options = {})
  options = Aws::Util.deep_merge(options,
    vault_name: @name,
    account_id: @account_id,
    job_parameters: {
      type: "inventory-retrieval"
    }
  )
  resp = @client.initiate_job(options)
  Job.new(
    id: resp.data.job_id,
    account_id: @account_id,
    vault_name: @name,
    client: @client
  )
end

#initiate_multipart_upload(options = {}) ⇒ MultipartUpload

Examples:

Request syntax with placeholder values


multipartupload = vault.initiate_multipart_upload({
  archive_description: "string",
  part_size: 1,
})

Parameters:

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

    ({})

Options Hash (options):

  • :archive_description (String)

    The archive description that you are uploading in parts.

    The part size must be a megabyte (1024 KB) multiplied by a power of 2, for example 1048576 (1 MB), 2097152 (2 MB), 4194304 (4 MB), 8388608 (8 MB), and so on. The minimum allowable part size is 1 MB, and the maximum is 4 GB (4096 MB).

  • :part_size (Integer)

    The size of each part except the last, in bytes. The last part can be smaller than this part size.

Returns:



188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 188

def initiate_multipart_upload(options = {})
  options = options.merge(
    vault_name: @name,
    account_id: @account_id
  )
  resp = @client.initiate_multipart_upload(options)
  MultipartUpload.new(
    id: resp.data.upload_id,
    account_id: @account_id,
    vault_name: @name,
    client: @client
  )
end

#job(id) ⇒ Job

Parameters:

  • id (String)

Returns:



323
324
325
326
327
328
329
330
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 323

def job(id)
  Job.new(
    account_id: @account_id,
    vault_name: @name,
    id: id,
    client: @client
  )
end

#jobs(options = {}) ⇒ Job::Collection

Examples:

Request syntax with placeholder values


jobs = vault.jobs({
  statuscode: "string",
  completed: "string",
})

Parameters:

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

    ({})

Options Hash (options):

  • :statuscode (String)

    The type of job status to return. You can specify the following values: InProgress, Succeeded, or Failed.

  • :completed (String)

    The state of the jobs to return. You can specify true or false.

Returns:



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 345

def jobs(options = {})
  batches = Enumerator.new do |y|
    options = options.merge(
      account_id: @account_id,
      vault_name: @name
    )
    resp = @client.list_jobs(options)
    resp.each_page do |page|
      batch = []
      page.data.job_list.each do |j|
        batch << Job.new(
          account_id: @account_id,
          vault_name: @name,
          id: j.job_id,
          data: j,
          client: @client
        )
      end
      y.yield(batch)
    end
  end
  Job::Collection.new(batches)
end

#jobs_in_progress(options = {}) ⇒ Job::Collection

Examples:

Request syntax with placeholder values


jobs_in_progress = vault.jobs_in_progress({
  completed: "string",
})

Parameters:

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

    ({})

Options Hash (options):

  • :completed (String)

    The state of the jobs to return. You can specify true or false.

Returns:



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 378

def jobs_in_progress(options = {})
  batches = Enumerator.new do |y|
    options = options.merge(
      account_id: @account_id,
      vault_name: @name,
      statuscode: "InProgress"
    )
    resp = @client.list_jobs(options)
    resp.each_page do |page|
      batch = []
      page.data.job_list.each do |j|
        batch << Job.new(
          account_id: @account_id,
          vault_name: @name,
          id: j.job_id,
          data: j,
          client: @client
        )
      end
      y.yield(batch)
    end
  end
  Job::Collection.new(batches)
end

#last_inventory_dateTime

The Universal Coordinated Time (UTC) date when Amazon Glacier completed the last vault inventory. This value should be a string in the ISO 8601 date format, for example 2012-03-20T17:03:43.221Z.

Returns:

  • (Time)


60
61
62
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 60

def last_inventory_date
  data.last_inventory_date
end

#loadself Also known as: reload

Loads, or reloads #data for the current Aws::Glacier::Vault. Returns self making it possible to chain methods.

vault.reload.data

Returns:

  • (self)


93
94
95
96
97
98
99
100
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 93

def load
  resp = @client.describe_vault(
    vault_name: @name,
    account_id: @account_id
  )
  @data = resp.data
  self
end

#multipart_uplaods(options = {}) ⇒ MultipartUpload::Collection

Examples:

Request syntax with placeholder values


vault.multipart_uplaods()

Parameters:

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

    ({})

Returns:



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 408

def multipart_uplaods(options = {})
  batches = Enumerator.new do |y|
    options = options.merge(
      vault_name: @name,
      account_id: @account_id
    )
    resp = @client.list_multipart_uploads(options)
    resp.each_page do |page|
      batch = []
      page.data.uploads_list.each do |u|
        batch << MultipartUpload.new(
          account_id: @account_id,
          vault_name: @name,
          id: u.multipart_upload_id,
          data: u,
          client: @client
        )
      end
      y.yield(batch)
    end
  end
  MultipartUpload::Collection.new(batches)
end

#multipart_upload(id) ⇒ MultipartUpload

Parameters:

  • id (String)

Returns:



434
435
436
437
438
439
440
441
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 434

def multipart_upload(id)
  MultipartUpload.new(
    account_id: @account_id,
    vault_name: @name,
    id: id,
    client: @client
  )
end

#nameString Also known as: vault_name

Returns:

  • (String)


37
38
39
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 37

def name
  @name
end

#notificationNotification

Returns:



444
445
446
447
448
449
450
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 444

def notification
  Notification.new(
    account_id: @account_id,
    vault_name: @name,
    client: @client
  )
end

#number_of_archivesInteger

The number of archives in the vault as of the last inventory date. This field will return null if an inventory has not yet run on the vault, for example if you just created the vault.

Returns:

  • (Integer)


68
69
70
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 68

def number_of_archives
  data.number_of_archives
end

#size_in_bytesInteger

Total size, in bytes, of the archives in the vault as of the last inventory date. This field will return null if an inventory has not yet run on the vault, for example if you just created the vault.

Returns:

  • (Integer)


76
77
78
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 76

def size_in_bytes
  data.size_in_bytes
end

#succeeded_jobs(options = {}) ⇒ Job::Collection

Examples:

Request syntax with placeholder values


succeeded_jobs = vault.succeeded_jobs({
  completed: "string",
})

Parameters:

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

    ({})

Options Hash (options):

  • :completed (String)

    The state of the jobs to return. You can specify true or false.

Returns:



461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 461

def succeeded_jobs(options = {})
  batches = Enumerator.new do |y|
    options = options.merge(
      account_id: @account_id,
      vault_name: @name,
      statuscode: "Succeeded"
    )
    resp = @client.list_jobs(options)
    resp.each_page do |page|
      batch = []
      page.data.job_list.each do |j|
        batch << Job.new(
          account_id: @account_id,
          vault_name: @name,
          id: j.job_id,
          data: j,
          client: @client
        )
      end
      y.yield(batch)
    end
  end
  Job::Collection.new(batches)
end

#upload_archive(options = {}) ⇒ Archive

Examples:

Request syntax with placeholder values


archive = vault.upload_archive({
  archive_description: "string",
  checksum: "string",
  body: "data",
})

Parameters:

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

    ({})

Options Hash (options):

  • :archive_description (String)

    The optional description of the archive you are uploading.

  • :checksum (String)

    The SHA256 tree hash of the data being uploaded.

  • :body (String, IO)

    The data to upload.

Returns:



217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb', line 217

def upload_archive(options = {})
  options = options.merge(
    vault_name: @name,
    account_id: @account_id
  )
  resp = @client.upload_archive(options)
  Archive.new(
    id: resp.data.archive_id,
    account_id: @account_id,
    vault_name: @name,
    client: @client
  )
end

#vault_arnString

The Amazon Resource Name (ARN) of the vault.

Returns:

  • (String)


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

def vault_arn
  data.vault_arn
end