2010-10-20 19:58:15 -04:00
|
|
|
module Fog
|
2011-06-15 20:32:15 -04:00
|
|
|
module CDN
|
|
|
|
class Rackspace
|
2010-10-20 19:58:15 -04:00
|
|
|
class Real
|
|
|
|
# List cdn properties for a container
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * container<~String> - Name of container to retrieve info for
|
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Excon::Response>:
|
|
|
|
# * headers<~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)
|
|
|
|
# * 'X-Log-Retention'<~Boolean> - ?
|
|
|
|
# * 'X-User-Agent-ACL'<~String> - ?
|
|
|
|
# * 'X-Referrer-ACL'<~String> - ?
|
2013-03-27 10:50:30 -04:00
|
|
|
# @return [Excon::Response] response
|
2013-04-15 14:12:14 -04:00
|
|
|
# @raise [Fog::Storage::Rackspace::NotFound] - HTTP 404
|
|
|
|
# @raise [Fog::Storage::Rackspace::BadRequest] - HTTP 400
|
|
|
|
# @raise [Fog::Storage::Rackspace::InternalServerError] - HTTP 500
|
|
|
|
# @raise [Fog::Storage::Rackspace::ServiceError]
|
2010-11-05 14:37:12 -04:00
|
|
|
def head_container(container)
|
2010-11-01 14:50:30 -04:00
|
|
|
response = request(
|
2010-10-20 19:58:15 -04:00
|
|
|
:expects => 204,
|
|
|
|
:method => 'HEAD',
|
|
|
|
:path => container,
|
|
|
|
:query => {'format' => 'json'}
|
|
|
|
)
|
|
|
|
response
|
|
|
|
end
|
|
|
|
end
|
2014-02-19 07:30:59 -05:00
|
|
|
|
2013-02-01 17:16:37 -05:00
|
|
|
class Mock
|
|
|
|
def head_container(container)
|
|
|
|
raise Fog::Storage::Rackspace::NotFound.new "#{container} not found" unless container == 'fogcontainertests'
|
|
|
|
response = Excon::Response.new
|
|
|
|
response.status = 204
|
2014-02-19 07:30:59 -05:00
|
|
|
response.headers = {
|
|
|
|
"X-Cdn-Uri"=>"http://e4bbc22477d80eaf22bd-ca4e4e61e477bbd430e1f5b9dc9a19f5.r53.cf1.rackcdn.com",
|
|
|
|
"X-Cdn-Ios-Uri"=>"http://3c10ef49037f74416445-ca4e4e61e477bbd430e1f5b9dc9a19f5.iosr.cf1.rackcdn.com",
|
|
|
|
"X-Cdn-Ssl-Uri"=>"https://b722b8ee248259c37901-ca4e4e61e477bbd430e1f5b9dc9a19f5.ssl.cf1.rackcdn.com",
|
|
|
|
"X-Log-Retention"=>"False",
|
|
|
|
"X-Cdn-Enabled"=>"True",
|
|
|
|
"Content-Length"=>"0",
|
|
|
|
"Date"=>"Fri, 01 Feb 2013 21:25:57 GMT",
|
|
|
|
"X-Cdn-Streaming-Uri"=>"http://b82027c64cb4dd03670a-ca4e4e61e477bbd430e1f5b9dc9a19f5.r53.stream.cf1.rackcdn.com",
|
|
|
|
"X-Ttl"=>"259200",
|
2013-02-01 17:16:37 -05:00
|
|
|
"X-Trans-Id"=>"txca40ffd0412943608bb3e9656c8b81ef"
|
2014-02-19 07:30:59 -05:00
|
|
|
}
|
|
|
|
response.body = ""
|
2013-02-01 17:16:37 -05:00
|
|
|
response
|
2014-02-19 07:30:59 -05:00
|
|
|
end
|
2013-02-01 17:16:37 -05:00
|
|
|
end
|
2010-10-20 19:58:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|