diff --git a/lib/fog/storage/hp.rb b/lib/fog/storage/hp.rb index 6775e1dcf..f16a74f86 100644 --- a/lib/fog/storage/hp.rb +++ b/lib/fog/storage/hp.rb @@ -18,8 +18,8 @@ module Fog request :get_container request :get_containers # request :get_object -# request :head_container -# request :head_containers + request :head_container + request :head_containers # request :head_object request :put_container # request :put_object diff --git a/lib/fog/storage/requests/hp/head_container.rb b/lib/fog/storage/requests/hp/head_container.rb new file mode 100644 index 000000000..344808ab4 --- /dev/null +++ b/lib/fog/storage/requests/hp/head_container.rb @@ -0,0 +1,29 @@ +module Fog + module HP + class Storage + class Real + + # List number of objects and total bytes stored + # + # ==== Parameters + # * container<~String> - Name of container to retrieve info for + # + # ==== Returns + # * response<~Excon::Response>: + # * headers<~Hash>: + # * 'X-Container-Object-Count'<~String> - Count of containers + # * 'X-Container-Bytes-Used'<~String> - Bytes used + def head_container(container) + response = request( + :expects => 204, + :method => 'HEAD', + :path => URI.escape(container), + :query => {'format' => 'json'} + ) + response + end + + end + end + end +end diff --git a/lib/fog/storage/requests/hp/head_containers.rb b/lib/fog/storage/requests/hp/head_containers.rb new file mode 100644 index 000000000..8954df2ec --- /dev/null +++ b/lib/fog/storage/requests/hp/head_containers.rb @@ -0,0 +1,26 @@ +module Fog + module HP + class Storage + class Real + + # List number of containers and total bytes stored + # + # ==== Returns + # * response<~Excon::Response>: + # * headers<~Hash>: + # * 'X-Account-Container-Count'<~String> - Count of containers + # * 'X-Account-Bytes-Used'<~String> - Bytes used + def head_containers + response = request( + :expects => 204, + :method => 'HEAD', + :path => '', + :query => {'format' => 'json'} + ) + response + end + + end + end + end +end