1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Add support for Rackspace's Extract Archive API call

See http://docs.rackspace.com/files/api/v1/cf-devguide/content/Extract_Archive-d1e2338.html
for documentation on the API call
This commit is contained in:
Sammy Larbi 2014-01-18 13:42:37 -06:00
parent 69e7b0aeaf
commit 37419fd91c
2 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,39 @@
require 'fog'
module Fog
module Storage
class Rackspace
class Real
# Extract Archive
#
# See http://docs.rackspace.com/files/api/v1/cf-devguide/content/Extract_Archive-d1e2338.html
#
# ==== Parameters
# * container<~String> - Name for container, should be < 256 bytes and must not contain '/'
# * data<~String|File> - file to upload
# * archive_format<~String> - "tar", "tar.gz", or "tar.bz2"
# @raise [Fog::Storage::Rackspace::NotFound] - HTTP 404
# @raise [Fog::Storage::Rackspace::BadRequest] - HTTP 400
# @raise [Fog::Storage::Rackspace::InternalServerError] - HTTP 500
# @raise [Fog::Storage::Rackspace::ServiceError]
def extract_archive(container, data, archive_format)
data = Fog::Storage.parse_data(data)
headers = data[:headers]
params = { :body => data[:body], :query => {"extract-archive" => archive_format} }
params.merge!(
:expects => 200,
:idempotent => true,
:headers => headers,
:method => 'PUT',
:path => "#{Fog::Rackspace.escape(container.to_s)}"
)
request(params)
end
end
end
end
end

View file

@ -41,6 +41,7 @@ module Fog
request :put_dynamic_obj_manifest
request :put_static_obj_manifest
request :post_set_meta_temp_url_key
request :extract_archive
module Common
def apply_options(options)