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:
commit
63760d0ed4
2 changed files with 8 additions and 7 deletions
|
@ -9,6 +9,8 @@ module Fog
|
||||||
|
|
||||||
attribute :bytes, :aliases => 'X-Container-Bytes-Used'
|
attribute :bytes, :aliases => 'X-Container-Bytes-Used'
|
||||||
attribute :count, :aliases => 'X-Container-Object-Count'
|
attribute :count, :aliases => 'X-Container-Object-Count'
|
||||||
|
|
||||||
|
attr_writer :public
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
requires :key
|
requires :key
|
||||||
|
@ -27,17 +29,13 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def public=(new_public)
|
|
||||||
@public = new_public
|
|
||||||
end
|
|
||||||
|
|
||||||
def public_url
|
def public_url
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
end
|
end
|
||||||
|
|
||||||
def save
|
def save
|
||||||
requires :key
|
requires :key
|
||||||
service.put_container(key)
|
service.put_container(key, :public => @public)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,11 +7,14 @@ module Fog
|
||||||
# ==== Parameters
|
# ==== Parameters
|
||||||
# * name<~String> - Name for container, should be < 256 bytes and must not contain '/'
|
# * 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(
|
request(
|
||||||
:expects => [201, 202],
|
:expects => [201, 202],
|
||||||
:method => 'PUT',
|
:method => 'PUT',
|
||||||
:path => Fog::OpenStack.escape(name)
|
:path => Fog::OpenStack.escape(name),
|
||||||
|
:headers => headers
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue