2011-06-15 02:15:06 -04:00
|
|
|
module Fog
|
2011-10-17 15:25:07 -04:00
|
|
|
module Storage
|
|
|
|
class HP
|
2011-06-15 02:15:06 -04:00
|
|
|
class Real
|
|
|
|
|
|
|
|
# Create a new container
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * name<~String> - Name for container, should be < 256 bytes and must not contain '/'
|
|
|
|
#
|
2011-07-13 18:09:13 -04:00
|
|
|
def put_container(name, options = {})
|
2011-06-15 02:15:06 -04:00
|
|
|
response = request(
|
|
|
|
:expects => [201, 202],
|
2011-07-13 18:09:13 -04:00
|
|
|
:headers => options,
|
2011-06-15 02:15:06 -04:00
|
|
|
:method => 'PUT',
|
2012-03-21 16:59:08 -04:00
|
|
|
:path => Fog::HP.escape(name)
|
2011-06-15 02:15:06 -04:00
|
|
|
)
|
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2011-07-29 11:33:28 -04:00
|
|
|
|
|
|
|
class Mock # :nodoc:all
|
|
|
|
def put_container(container_name, options = {})
|
2012-10-19 01:35:06 -04:00
|
|
|
read_h = options['X-Container-Read'] || ''
|
|
|
|
write_h = options['X-Container-Write'] || ''
|
|
|
|
unless options
|
|
|
|
read_acl, write_acl = self.class.header_to_perm_acl(read_h, write_h)
|
|
|
|
self.data[:acls][:container][container_name] = {:read_acl => read_acl, :write_acl => write_acl}
|
2011-07-29 11:33:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
response = Excon::Response.new
|
|
|
|
container = {
|
2012-10-19 01:35:06 -04:00
|
|
|
:objects => {}
|
2011-07-29 11:33:28 -04:00
|
|
|
}
|
|
|
|
if self.data[:containers][container_name]
|
|
|
|
response.status = 202
|
|
|
|
else
|
|
|
|
response.status = 201
|
|
|
|
self.data[:containers][container_name] = container
|
|
|
|
end
|
|
|
|
response
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-06-15 02:15:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|