mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[rackspace|cdn] use post_container to update
This commit is contained in:
parent
f6ccfee60c
commit
11ed66103e
4 changed files with 33 additions and 2 deletions
|
@ -11,6 +11,7 @@ module Fog
|
||||||
request_path 'fog/cdn/requests/rackspace'
|
request_path 'fog/cdn/requests/rackspace'
|
||||||
request :get_containers
|
request :get_containers
|
||||||
request :head_container
|
request :head_container
|
||||||
|
request :post_container
|
||||||
request :put_container
|
request :put_container
|
||||||
|
|
||||||
class Mock
|
class Mock
|
||||||
|
|
30
lib/fog/cdn/requests/rackspace/post_container.rb
Normal file
30
lib/fog/cdn/requests/rackspace/post_container.rb
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
module Fog
|
||||||
|
module Rackspace
|
||||||
|
class CDN
|
||||||
|
class Real
|
||||||
|
|
||||||
|
# modify CDN properties for a container
|
||||||
|
#
|
||||||
|
# ==== Parameters
|
||||||
|
# * name<~String> - Name for container, should be < 256 bytes and must not contain '/'
|
||||||
|
# # options<~Hash>:
|
||||||
|
# * 'X-CDN-Enabled'<~Boolean> - cdn status for container
|
||||||
|
# * 'X-CDN-URI'<~String> - cdn url for this container
|
||||||
|
# * 'X-TTL'<~String> - integer seconds before data expires, defaults to 86400 (1 day), in 3600..259200
|
||||||
|
# * 'X-Log-Retention'<~Boolean> - ?
|
||||||
|
# * 'X-User-Agent-ACL'<~String> - ?
|
||||||
|
# * 'X-Referrer-ACL'<~String> - ?
|
||||||
|
def post_container(name, options = {})
|
||||||
|
response = request(
|
||||||
|
:expects => [201, 202],
|
||||||
|
:headers => options,
|
||||||
|
:method => 'POST',
|
||||||
|
:path => CGI.escape(name)
|
||||||
|
)
|
||||||
|
response
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,7 +3,7 @@ module Fog
|
||||||
class CDN
|
class CDN
|
||||||
class Real
|
class Real
|
||||||
|
|
||||||
# modify CDN properties for a container
|
# enable CDN for a container
|
||||||
#
|
#
|
||||||
# ==== 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 '/'
|
||||||
|
|
|
@ -15,7 +15,7 @@ module Fog
|
||||||
def destroy
|
def destroy
|
||||||
requires :key
|
requires :key
|
||||||
connection.delete_container(key)
|
connection.delete_container(key)
|
||||||
connection.cdn.put_container(key, 'X-CDN-Enabled' => 'False')
|
connection.cdn.post_container(key, 'X-CDN-Enabled' => 'False')
|
||||||
true
|
true
|
||||||
rescue Excon::Errors::NotFound
|
rescue Excon::Errors::NotFound
|
||||||
false
|
false
|
||||||
|
|
Loading…
Reference in a new issue