aws-sdk-glacier 1.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/aws-sdk-glacier.rb +54 -0
- data/lib/aws-sdk-glacier/account.rb +143 -0
- data/lib/aws-sdk-glacier/archive.rb +178 -0
- data/lib/aws-sdk-glacier/client.rb +2506 -0
- data/lib/aws-sdk-glacier/client_api.rb +908 -0
- data/lib/aws-sdk-glacier/customizations.rb +7 -0
- data/lib/aws-sdk-glacier/errors.rb +23 -0
- data/lib/aws-sdk-glacier/job.rb +345 -0
- data/lib/aws-sdk-glacier/multipart_upload.rb +269 -0
- data/lib/aws-sdk-glacier/notification.rb +179 -0
- data/lib/aws-sdk-glacier/plugins/account_id.rb +22 -0
- data/lib/aws-sdk-glacier/plugins/api_version.rb +22 -0
- data/lib/aws-sdk-glacier/plugins/checksums.rb +91 -0
- data/lib/aws-sdk-glacier/resource.rb +82 -0
- data/lib/aws-sdk-glacier/tree_hash.rb +76 -0
- data/lib/aws-sdk-glacier/types.rb +2055 -0
- data/lib/aws-sdk-glacier/vault.rb +524 -0
- data/lib/aws-sdk-glacier/waiters.rb +98 -0
- metadata +91 -0
@@ -0,0 +1,524 @@
|
|
1
|
+
# WARNING ABOUT GENERATED CODE
|
2
|
+
#
|
3
|
+
# This file is generated. See the contributing for info on making contributions:
|
4
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
|
+
#
|
6
|
+
# WARNING ABOUT GENERATED CODE
|
7
|
+
|
8
|
+
module Aws
|
9
|
+
module Glacier
|
10
|
+
class Vault
|
11
|
+
|
12
|
+
extend Aws::Deprecations
|
13
|
+
|
14
|
+
# @overload def initialize(account_id, name, options = {})
|
15
|
+
# @param [String] account_id
|
16
|
+
# @param [String] name
|
17
|
+
# @option options [Client] :client
|
18
|
+
# @overload def initialize(options = {})
|
19
|
+
# @option options [required, String] :account_id
|
20
|
+
# @option options [required, String] :name
|
21
|
+
# @option options [Client] :client
|
22
|
+
def initialize(*args)
|
23
|
+
options = Hash === args.last ? args.pop.dup : {}
|
24
|
+
@account_id = extract_account_id(args, options)
|
25
|
+
@name = extract_name(args, options)
|
26
|
+
@data = options.delete(:data)
|
27
|
+
@client = options.delete(:client) || Client.new(options)
|
28
|
+
end
|
29
|
+
|
30
|
+
# @!group Read-Only Attributes
|
31
|
+
|
32
|
+
# @return [String]
|
33
|
+
def account_id
|
34
|
+
@account_id
|
35
|
+
end
|
36
|
+
|
37
|
+
# @return [String]
|
38
|
+
def name
|
39
|
+
@name
|
40
|
+
end
|
41
|
+
alias :vault_name :name
|
42
|
+
|
43
|
+
# The Amazon Resource Name (ARN) of the vault.
|
44
|
+
# @return [String]
|
45
|
+
def vault_arn
|
46
|
+
data.vault_arn
|
47
|
+
end
|
48
|
+
|
49
|
+
# The Universal Coordinated Time (UTC) date when the vault was created.
|
50
|
+
# This value should be a string in the ISO 8601 date format, for example
|
51
|
+
# `2012-03-20T17:03:43.221Z`.
|
52
|
+
# @return [Time]
|
53
|
+
def creation_date
|
54
|
+
data.creation_date
|
55
|
+
end
|
56
|
+
|
57
|
+
# The Universal Coordinated Time (UTC) date when Amazon Glacier
|
58
|
+
# completed the last vault inventory. This value should be a string in
|
59
|
+
# the ISO 8601 date format, for example `2012-03-20T17:03:43.221Z`.
|
60
|
+
# @return [Time]
|
61
|
+
def last_inventory_date
|
62
|
+
data.last_inventory_date
|
63
|
+
end
|
64
|
+
|
65
|
+
# The number of archives in the vault as of the last inventory date.
|
66
|
+
# This field will return `null` if an inventory has not yet run on the
|
67
|
+
# vault, for example if you just created the vault.
|
68
|
+
# @return [Integer]
|
69
|
+
def number_of_archives
|
70
|
+
data.number_of_archives
|
71
|
+
end
|
72
|
+
|
73
|
+
# Total size, in bytes, of the archives in the vault as of the last
|
74
|
+
# inventory date. This field will return null if an inventory has not
|
75
|
+
# yet run on the vault, for example if you just created the vault.
|
76
|
+
# @return [Integer]
|
77
|
+
def size_in_bytes
|
78
|
+
data.size_in_bytes
|
79
|
+
end
|
80
|
+
|
81
|
+
# @!endgroup
|
82
|
+
|
83
|
+
# @return [Client]
|
84
|
+
def client
|
85
|
+
@client
|
86
|
+
end
|
87
|
+
|
88
|
+
# Loads, or reloads {#data} for the current {Vault}.
|
89
|
+
# Returns `self` making it possible to chain methods.
|
90
|
+
#
|
91
|
+
# vault.reload.data
|
92
|
+
#
|
93
|
+
# @return [self]
|
94
|
+
def load
|
95
|
+
resp = @client.describe_vault(
|
96
|
+
vault_name: @name,
|
97
|
+
account_id: @account_id
|
98
|
+
)
|
99
|
+
@data = resp.data
|
100
|
+
self
|
101
|
+
end
|
102
|
+
alias :reload :load
|
103
|
+
|
104
|
+
# @return [Types::DescribeVaultOutput]
|
105
|
+
# Returns the data for this {Vault}. Calls
|
106
|
+
# {Client#describe_vault} if {#data_loaded?} is `false`.
|
107
|
+
def data
|
108
|
+
load unless @data
|
109
|
+
@data
|
110
|
+
end
|
111
|
+
|
112
|
+
# @return [Boolean]
|
113
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
114
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
115
|
+
def data_loaded?
|
116
|
+
!!@data
|
117
|
+
end
|
118
|
+
|
119
|
+
# @!group Actions
|
120
|
+
|
121
|
+
# @example Request syntax with placeholder values
|
122
|
+
#
|
123
|
+
# vault.create()
|
124
|
+
# @param [Hash] options ({})
|
125
|
+
# @return [Types::CreateVaultOutput]
|
126
|
+
def create(options = {})
|
127
|
+
options = options.merge(
|
128
|
+
vault_name: @name,
|
129
|
+
account_id: @account_id
|
130
|
+
)
|
131
|
+
resp = @client.create_vault(options)
|
132
|
+
resp.data
|
133
|
+
end
|
134
|
+
|
135
|
+
# @example Request syntax with placeholder values
|
136
|
+
#
|
137
|
+
# vault.delete()
|
138
|
+
# @param [Hash] options ({})
|
139
|
+
# @return [EmptyStructure]
|
140
|
+
def delete(options = {})
|
141
|
+
options = options.merge(
|
142
|
+
vault_name: @name,
|
143
|
+
account_id: @account_id
|
144
|
+
)
|
145
|
+
resp = @client.delete_vault(options)
|
146
|
+
resp.data
|
147
|
+
end
|
148
|
+
|
149
|
+
# @example Request syntax with placeholder values
|
150
|
+
#
|
151
|
+
# job = vault.initiate_inventory_retrieval()
|
152
|
+
# @param [Hash] options ({})
|
153
|
+
# @return [Job]
|
154
|
+
def initiate_inventory_retrieval(options = {})
|
155
|
+
options = Aws::Util.deep_merge(options,
|
156
|
+
vault_name: @name,
|
157
|
+
account_id: @account_id,
|
158
|
+
job_parameters: {
|
159
|
+
type: "inventory-retrieval"
|
160
|
+
}
|
161
|
+
)
|
162
|
+
resp = @client.initiate_job(options)
|
163
|
+
Job.new(
|
164
|
+
id: resp.data.job_id,
|
165
|
+
account_id: @account_id,
|
166
|
+
vault_name: @name,
|
167
|
+
client: @client
|
168
|
+
)
|
169
|
+
end
|
170
|
+
|
171
|
+
# @example Request syntax with placeholder values
|
172
|
+
#
|
173
|
+
# multipartupload = vault.initiate_multipart_upload({
|
174
|
+
# archive_description: "string",
|
175
|
+
# part_size: 1,
|
176
|
+
# })
|
177
|
+
# @param [Hash] options ({})
|
178
|
+
# @option options [String] :archive_description
|
179
|
+
# The archive description that you are uploading in parts.
|
180
|
+
#
|
181
|
+
# The part size must be a megabyte (1024 KB) multiplied by a power of 2,
|
182
|
+
# for example 1048576 (1 MB), 2097152 (2 MB), 4194304 (4 MB), 8388608 (8
|
183
|
+
# MB), and so on. The minimum allowable part size is 1 MB, and the
|
184
|
+
# maximum is 4 GB (4096 MB).
|
185
|
+
# @option options [Integer] :part_size
|
186
|
+
# The size of each part except the last, in bytes. The last part can be
|
187
|
+
# smaller than this part size.
|
188
|
+
# @return [MultipartUpload]
|
189
|
+
def initiate_multipart_upload(options = {})
|
190
|
+
options = options.merge(
|
191
|
+
vault_name: @name,
|
192
|
+
account_id: @account_id
|
193
|
+
)
|
194
|
+
resp = @client.initiate_multipart_upload(options)
|
195
|
+
MultipartUpload.new(
|
196
|
+
id: resp.data.upload_id,
|
197
|
+
account_id: @account_id,
|
198
|
+
vault_name: @name,
|
199
|
+
client: @client
|
200
|
+
)
|
201
|
+
end
|
202
|
+
|
203
|
+
# @example Request syntax with placeholder values
|
204
|
+
#
|
205
|
+
# archive = vault.upload_archive({
|
206
|
+
# archive_description: "string",
|
207
|
+
# checksum: "string",
|
208
|
+
# body: "data",
|
209
|
+
# })
|
210
|
+
# @param [Hash] options ({})
|
211
|
+
# @option options [String] :archive_description
|
212
|
+
# The optional description of the archive you are uploading.
|
213
|
+
# @option options [String] :checksum
|
214
|
+
# The SHA256 tree hash of the data being uploaded.
|
215
|
+
# @option options [String, IO] :body
|
216
|
+
# The data to upload.
|
217
|
+
# @return [Archive]
|
218
|
+
def upload_archive(options = {})
|
219
|
+
options = options.merge(
|
220
|
+
vault_name: @name,
|
221
|
+
account_id: @account_id
|
222
|
+
)
|
223
|
+
resp = @client.upload_archive(options)
|
224
|
+
Archive.new(
|
225
|
+
id: resp.data.archive_id,
|
226
|
+
account_id: @account_id,
|
227
|
+
vault_name: @name,
|
228
|
+
client: @client
|
229
|
+
)
|
230
|
+
end
|
231
|
+
|
232
|
+
# @!group Associations
|
233
|
+
|
234
|
+
# @return [Account]
|
235
|
+
def account
|
236
|
+
Account.new(
|
237
|
+
id: @account_id,
|
238
|
+
client: @client
|
239
|
+
)
|
240
|
+
end
|
241
|
+
|
242
|
+
# @param [String] id
|
243
|
+
# @return [Archive]
|
244
|
+
def archive(id)
|
245
|
+
Archive.new(
|
246
|
+
account_id: @account_id,
|
247
|
+
vault_name: @name,
|
248
|
+
id: id,
|
249
|
+
client: @client
|
250
|
+
)
|
251
|
+
end
|
252
|
+
|
253
|
+
# @example Request syntax with placeholder values
|
254
|
+
#
|
255
|
+
# completedjobs = vault.completed_jobs({
|
256
|
+
# statuscode: "string",
|
257
|
+
# })
|
258
|
+
# @param [Hash] options ({})
|
259
|
+
# @option options [String] :statuscode
|
260
|
+
# The type of job status to return. You can specify the following
|
261
|
+
# values: `InProgress`, `Succeeded`, or `Failed`.
|
262
|
+
# @return [Job::Collection]
|
263
|
+
def completed_jobs(options = {})
|
264
|
+
batches = Enumerator.new do |y|
|
265
|
+
options = options.merge(
|
266
|
+
account_id: @account_id,
|
267
|
+
vault_name: @name,
|
268
|
+
completed: "true"
|
269
|
+
)
|
270
|
+
resp = @client.list_jobs(options)
|
271
|
+
resp.each_page do |page|
|
272
|
+
batch = []
|
273
|
+
page.data.job_list.each do |j|
|
274
|
+
batch << Job.new(
|
275
|
+
account_id: @account_id,
|
276
|
+
vault_name: @name,
|
277
|
+
id: j.job_id,
|
278
|
+
data: j,
|
279
|
+
client: @client
|
280
|
+
)
|
281
|
+
end
|
282
|
+
y.yield(batch)
|
283
|
+
end
|
284
|
+
end
|
285
|
+
Job::Collection.new(batches)
|
286
|
+
end
|
287
|
+
|
288
|
+
# @example Request syntax with placeholder values
|
289
|
+
#
|
290
|
+
# failedjobs = vault.failed_jobs({
|
291
|
+
# completed: "string",
|
292
|
+
# })
|
293
|
+
# @param [Hash] options ({})
|
294
|
+
# @option options [String] :completed
|
295
|
+
# The state of the jobs to return. You can specify `true` or `false`.
|
296
|
+
# @return [Job::Collection]
|
297
|
+
def failed_jobs(options = {})
|
298
|
+
batches = Enumerator.new do |y|
|
299
|
+
options = options.merge(
|
300
|
+
account_id: @account_id,
|
301
|
+
vault_name: @name,
|
302
|
+
statuscode: "Failed"
|
303
|
+
)
|
304
|
+
resp = @client.list_jobs(options)
|
305
|
+
resp.each_page do |page|
|
306
|
+
batch = []
|
307
|
+
page.data.job_list.each do |j|
|
308
|
+
batch << Job.new(
|
309
|
+
account_id: @account_id,
|
310
|
+
vault_name: @name,
|
311
|
+
id: j.job_id,
|
312
|
+
data: j,
|
313
|
+
client: @client
|
314
|
+
)
|
315
|
+
end
|
316
|
+
y.yield(batch)
|
317
|
+
end
|
318
|
+
end
|
319
|
+
Job::Collection.new(batches)
|
320
|
+
end
|
321
|
+
|
322
|
+
# @param [String] id
|
323
|
+
# @return [Job]
|
324
|
+
def job(id)
|
325
|
+
Job.new(
|
326
|
+
account_id: @account_id,
|
327
|
+
vault_name: @name,
|
328
|
+
id: id,
|
329
|
+
client: @client
|
330
|
+
)
|
331
|
+
end
|
332
|
+
|
333
|
+
# @example Request syntax with placeholder values
|
334
|
+
#
|
335
|
+
# jobs = vault.jobs({
|
336
|
+
# statuscode: "string",
|
337
|
+
# completed: "string",
|
338
|
+
# })
|
339
|
+
# @param [Hash] options ({})
|
340
|
+
# @option options [String] :statuscode
|
341
|
+
# The type of job status to return. You can specify the following
|
342
|
+
# values: `InProgress`, `Succeeded`, or `Failed`.
|
343
|
+
# @option options [String] :completed
|
344
|
+
# The state of the jobs to return. You can specify `true` or `false`.
|
345
|
+
# @return [Job::Collection]
|
346
|
+
def jobs(options = {})
|
347
|
+
batches = Enumerator.new do |y|
|
348
|
+
options = options.merge(
|
349
|
+
account_id: @account_id,
|
350
|
+
vault_name: @name
|
351
|
+
)
|
352
|
+
resp = @client.list_jobs(options)
|
353
|
+
resp.each_page do |page|
|
354
|
+
batch = []
|
355
|
+
page.data.job_list.each do |j|
|
356
|
+
batch << Job.new(
|
357
|
+
account_id: @account_id,
|
358
|
+
vault_name: @name,
|
359
|
+
id: j.job_id,
|
360
|
+
data: j,
|
361
|
+
client: @client
|
362
|
+
)
|
363
|
+
end
|
364
|
+
y.yield(batch)
|
365
|
+
end
|
366
|
+
end
|
367
|
+
Job::Collection.new(batches)
|
368
|
+
end
|
369
|
+
|
370
|
+
# @example Request syntax with placeholder values
|
371
|
+
#
|
372
|
+
# jobsinprogress = vault.jobs_in_progress({
|
373
|
+
# completed: "string",
|
374
|
+
# })
|
375
|
+
# @param [Hash] options ({})
|
376
|
+
# @option options [String] :completed
|
377
|
+
# The state of the jobs to return. You can specify `true` or `false`.
|
378
|
+
# @return [Job::Collection]
|
379
|
+
def jobs_in_progress(options = {})
|
380
|
+
batches = Enumerator.new do |y|
|
381
|
+
options = options.merge(
|
382
|
+
account_id: @account_id,
|
383
|
+
vault_name: @name,
|
384
|
+
statuscode: "InProgress"
|
385
|
+
)
|
386
|
+
resp = @client.list_jobs(options)
|
387
|
+
resp.each_page do |page|
|
388
|
+
batch = []
|
389
|
+
page.data.job_list.each do |j|
|
390
|
+
batch << Job.new(
|
391
|
+
account_id: @account_id,
|
392
|
+
vault_name: @name,
|
393
|
+
id: j.job_id,
|
394
|
+
data: j,
|
395
|
+
client: @client
|
396
|
+
)
|
397
|
+
end
|
398
|
+
y.yield(batch)
|
399
|
+
end
|
400
|
+
end
|
401
|
+
Job::Collection.new(batches)
|
402
|
+
end
|
403
|
+
|
404
|
+
# @example Request syntax with placeholder values
|
405
|
+
#
|
406
|
+
# multipartuplaods = vault.multipart_uplaods()
|
407
|
+
# @param [Hash] options ({})
|
408
|
+
# @return [MultipartUpload::Collection]
|
409
|
+
def multipart_uplaods(options = {})
|
410
|
+
batches = Enumerator.new do |y|
|
411
|
+
options = options.merge(
|
412
|
+
vault_name: @name,
|
413
|
+
account_id: @account_id
|
414
|
+
)
|
415
|
+
resp = @client.list_multipart_uploads(options)
|
416
|
+
resp.each_page do |page|
|
417
|
+
batch = []
|
418
|
+
page.data.uploads_list.each do |u|
|
419
|
+
batch << MultipartUpload.new(
|
420
|
+
account_id: @account_id,
|
421
|
+
vault_name: @name,
|
422
|
+
id: u.multipart_upload_id,
|
423
|
+
data: u,
|
424
|
+
client: @client
|
425
|
+
)
|
426
|
+
end
|
427
|
+
y.yield(batch)
|
428
|
+
end
|
429
|
+
end
|
430
|
+
MultipartUpload::Collection.new(batches)
|
431
|
+
end
|
432
|
+
|
433
|
+
# @param [String] id
|
434
|
+
# @return [MultipartUpload]
|
435
|
+
def multipart_upload(id)
|
436
|
+
MultipartUpload.new(
|
437
|
+
account_id: @account_id,
|
438
|
+
vault_name: @name,
|
439
|
+
id: id,
|
440
|
+
client: @client
|
441
|
+
)
|
442
|
+
end
|
443
|
+
|
444
|
+
# @return [Notification]
|
445
|
+
def notification
|
446
|
+
Notification.new(
|
447
|
+
account_id: @account_id,
|
448
|
+
vault_name: @name,
|
449
|
+
client: @client
|
450
|
+
)
|
451
|
+
end
|
452
|
+
|
453
|
+
# @example Request syntax with placeholder values
|
454
|
+
#
|
455
|
+
# succeededjobs = vault.succeeded_jobs({
|
456
|
+
# completed: "string",
|
457
|
+
# })
|
458
|
+
# @param [Hash] options ({})
|
459
|
+
# @option options [String] :completed
|
460
|
+
# The state of the jobs to return. You can specify `true` or `false`.
|
461
|
+
# @return [Job::Collection]
|
462
|
+
def succeeded_jobs(options = {})
|
463
|
+
batches = Enumerator.new do |y|
|
464
|
+
options = options.merge(
|
465
|
+
account_id: @account_id,
|
466
|
+
vault_name: @name,
|
467
|
+
statuscode: "Succeeded"
|
468
|
+
)
|
469
|
+
resp = @client.list_jobs(options)
|
470
|
+
resp.each_page do |page|
|
471
|
+
batch = []
|
472
|
+
page.data.job_list.each do |j|
|
473
|
+
batch << Job.new(
|
474
|
+
account_id: @account_id,
|
475
|
+
vault_name: @name,
|
476
|
+
id: j.job_id,
|
477
|
+
data: j,
|
478
|
+
client: @client
|
479
|
+
)
|
480
|
+
end
|
481
|
+
y.yield(batch)
|
482
|
+
end
|
483
|
+
end
|
484
|
+
Job::Collection.new(batches)
|
485
|
+
end
|
486
|
+
|
487
|
+
# @deprecated
|
488
|
+
# @api private
|
489
|
+
def identifiers
|
490
|
+
{
|
491
|
+
account_id: @account_id,
|
492
|
+
name: @name
|
493
|
+
}
|
494
|
+
end
|
495
|
+
deprecated(:identifiers)
|
496
|
+
|
497
|
+
private
|
498
|
+
|
499
|
+
def extract_account_id(args, options)
|
500
|
+
value = args[0] || options.delete(:account_id)
|
501
|
+
case value
|
502
|
+
when String then value
|
503
|
+
when nil then raise ArgumentError, "missing required option :account_id"
|
504
|
+
else
|
505
|
+
msg = "expected :account_id to be a String, got #{value.class}"
|
506
|
+
raise ArgumentError, msg
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
510
|
+
def extract_name(args, options)
|
511
|
+
value = args[1] || options.delete(:name)
|
512
|
+
case value
|
513
|
+
when String then value
|
514
|
+
when nil then raise ArgumentError, "missing required option :name"
|
515
|
+
else
|
516
|
+
msg = "expected :name to be a String, got #{value.class}"
|
517
|
+
raise ArgumentError, msg
|
518
|
+
end
|
519
|
+
end
|
520
|
+
|
521
|
+
class Collection < Aws::Resources::Collection; end
|
522
|
+
end
|
523
|
+
end
|
524
|
+
end
|