2011-06-15 02:15:06 -04:00
|
|
|
module Fog
|
|
|
|
module HP
|
|
|
|
class Storage
|
|
|
|
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',
|
2011-09-09 16:29:29 -04:00
|
|
|
:path => escape_name(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 = {})
|
|
|
|
acl = options['X-Container-Read'] || 'private'
|
|
|
|
if !['private', 'public-read'].include?(acl)
|
|
|
|
raise Excon::Errors::BadRequest.new('invalid X-Container-Read')
|
|
|
|
else
|
|
|
|
self.data[:acls][:container][container_name] = self.class.acls(acl)
|
|
|
|
end
|
|
|
|
|
|
|
|
response = Excon::Response.new
|
|
|
|
container = {
|
|
|
|
:objects => {},
|
|
|
|
}
|
|
|
|
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
|