mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[AWS|Glacier] Jobs requests
This commit is contained in:
parent
17c8e44a31
commit
42b84b54c9
5 changed files with 160 additions and 0 deletions
|
@ -17,9 +17,13 @@ module Fog
|
|||
request :delete_archive
|
||||
request :delete_vault
|
||||
request :delete_vault_notification_configuration
|
||||
request :describe_job
|
||||
request :describe_vault
|
||||
request :get_job_output
|
||||
request :get_vault_notification_configuration
|
||||
request :initiate_job
|
||||
request :initiate_multipart_upload
|
||||
request :list_jobs
|
||||
request :list_multipart_uploads
|
||||
request :list_parts
|
||||
request :list_vaults
|
||||
|
|
35
lib/fog/aws/requests/glacier/describe_job.rb
Normal file
35
lib/fog/aws/requests/glacier/describe_job.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class Glacier
|
||||
class Real
|
||||
|
||||
# Complete an upload
|
||||
#
|
||||
# ==== Parameters
|
||||
# * name<~String> Name of the vault
|
||||
# * job_id<~String> The id of the job
|
||||
# * options<~Hash>
|
||||
# * account_id<~String> - The AWS account id. Defaults to the account owning the credentials making the request
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
#
|
||||
# ==== See Also
|
||||
# http://docs.amazonwebservices.com/amazonglacier/latest/dev/api-describe-job-get.html
|
||||
#
|
||||
def describe_job(vault_name, job_id, options={})
|
||||
account_id = options['account_id'] || '-'
|
||||
path = "/#{account_id}/vaults/#{Fog::AWS.escape(vault_name)}/jobs/#{job_id}"
|
||||
|
||||
request(
|
||||
:expects => 200,
|
||||
:idempotent => true,
|
||||
:headers => {},
|
||||
:method => :get,
|
||||
:path => path
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
41
lib/fog/aws/requests/glacier/get_job_output.rb
Normal file
41
lib/fog/aws/requests/glacier/get_job_output.rb
Normal file
|
@ -0,0 +1,41 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class Glacier
|
||||
class Real
|
||||
|
||||
# Get the output from a job
|
||||
#
|
||||
# ==== Parameters
|
||||
# * name<~String> Name of the vault
|
||||
# * job_id<~String> The id of the job
|
||||
# * options<~Hash>
|
||||
# * Range<~Range> The range to retrieve
|
||||
# * account_id<~String> - The AWS account id. Defaults to the account owning the credentials making the request
|
||||
# * response_block<~Proc> Proc to use for streaming the response
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
#
|
||||
# ==== See Also
|
||||
# http://docs.amazonwebservices.com/amazonglacier/latest/dev/api-job-output-get.html
|
||||
#
|
||||
def get_job_output(vault_name, job_id, options={})
|
||||
account_id = options.delete('account_id') || '-'
|
||||
path = "/#{account_id}/vaults/#{Fog::AWS.escape(vault_name)}/jobs/#{job_id}/output"
|
||||
headers = {}
|
||||
if range = options.delete('Range')
|
||||
headers['Range'] = "bytes=#{range.begin}-#{range.end}"
|
||||
end
|
||||
request(
|
||||
options.merge(
|
||||
:expects => [200,206],
|
||||
:idempotent => true,
|
||||
:headers => headers,
|
||||
:method => :get,
|
||||
:path => path,
|
||||
))
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
41
lib/fog/aws/requests/glacier/initiate_job.rb
Normal file
41
lib/fog/aws/requests/glacier/initiate_job.rb
Normal file
|
@ -0,0 +1,41 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class Glacier
|
||||
class Real
|
||||
|
||||
# This operation initates a multipart upload of an archive to a vault
|
||||
#
|
||||
# ==== Parameters
|
||||
# * name<~String> The vault name
|
||||
# * job_specification<~Hash> A specification of the job
|
||||
# * Type<~String> The job type. Mandatory. Values: archive-retrieval, inventory-retrieval
|
||||
# * Description<~String> The job description
|
||||
# * ArchiveId<~String> The id of the archive to retrieve (only for Type==archive-retrieval)
|
||||
# * Format<~String> The format to return (only for inventory retrieval). Values: CSV, JSON
|
||||
# * SNSTopic<String> ARN of a topic to publish to when the job is complete
|
||||
# * options<~Hash>
|
||||
# * account_id<~String> - The AWS account id. Defaults to the account owning the credentials making the request
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
#
|
||||
# ==== See Also
|
||||
# http://docs.amazonwebservices.com/amazonglacier/latest/dev/api-initiate-job-post.html
|
||||
#
|
||||
def initiate_job(name, job_specification, options={})
|
||||
account_id = options['account_id'] || '-'
|
||||
path = "/#{account_id}/vaults/#{Fog::AWS.escape(name)}/jobs"
|
||||
|
||||
request({
|
||||
:expects => 202,
|
||||
:headers => {},
|
||||
:method => 'POST',
|
||||
:path => path,
|
||||
:body => Fog::JSON.encode(job_specification)
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
39
lib/fog/aws/requests/glacier/list_jobs.rb
Normal file
39
lib/fog/aws/requests/glacier/list_jobs.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class Glacier
|
||||
class Real
|
||||
|
||||
# lists in-progress and recently jobs for the specified vault
|
||||
#
|
||||
# ==== Parameters
|
||||
# * name<~String> Name of the vault
|
||||
# * options<~Hash>
|
||||
# * completed<~Boolean>Specifies the state of the jobs to return. You can specify true or false
|
||||
# * statuscode<~String> Filter returned jobs by status (InProgress, Succeeded, or Failed)
|
||||
# * limit<~Integer> - The maximum number of items returned in the response. (default 1000)
|
||||
# * marker<~String> - marker used for pagination
|
||||
# * account_id<~String> - The AWS account id. Defaults to the account owning the credentials making the request
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# ==== See Also
|
||||
#http://docs.amazonwebservices.com/amazonglacier/latest/dev/api-jobs-get.html
|
||||
#
|
||||
def list_jobs(vault_name, options={})
|
||||
account_id = options.delete('account_id') || '-'
|
||||
path = "/#{account_id}/vaults/#{Fog::AWS.escape(vault_name)}/jobs"
|
||||
|
||||
|
||||
request(
|
||||
:expects => 200,
|
||||
:idempotent => true,
|
||||
:headers => {},
|
||||
:method => :get,
|
||||
:path => path,
|
||||
:query => options
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue