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

Merge pull request #3097 from allomov/public-openstack-storage

[Openstack | Storage] add possibility to create public containers.
This commit is contained in:
Wesley Beary 2014-08-11 09:02:59 -05:00
commit 63760d0ed4
2 changed files with 8 additions and 7 deletions

View file

@ -9,6 +9,8 @@ module Fog
attribute :bytes, :aliases => 'X-Container-Bytes-Used'
attribute :count, :aliases => 'X-Container-Object-Count'
attr_writer :public
def destroy
requires :key
@ -27,17 +29,13 @@ module Fog
end
end
def public=(new_public)
@public = new_public
end
def public_url
raise NotImplementedError
end
def save
requires :key
service.put_container(key)
service.put_container(key, :public => @public)
true
end
end

View file

@ -7,11 +7,14 @@ module Fog
# ==== Parameters
# * name<~String> - Name for container, should be < 256 bytes and must not contain '/'
#
def put_container(name)
def put_container(name, options={})
headers = options[:headers] || {}
headers['X-Container-Read'] = '.r:*' if options[:public]
request(
:expects => [201, 202],
:method => 'PUT',
:path => Fog::OpenStack.escape(name)
:path => Fog::OpenStack.escape(name),
:headers => headers
)
end
end