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
|
|
|
|
|
2011-03-04 15:27:52 -05:00
|
|
|
# enable CDN for a container
|
2010-10-20 19:58:15 -04:00
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * name<~String> - Name for container, should be < 256 bytes and must not contain '/'
|
2013-03-27 10:50:30 -04:00
|
|
|
# * options<~Hash>:
|
2010-10-20 19:58:15 -04:00
|
|
|
# * '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> - ?
|
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 put_container(name, options = {})
|
2010-11-01 14:50:30 -04:00
|
|
|
response = request(
|
2010-10-20 19:58:15 -04:00
|
|
|
:expects => [201, 202],
|
|
|
|
:headers => options,
|
|
|
|
:method => 'PUT',
|
|
|
|
:path => CGI.escape(name)
|
|
|
|
)
|
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2013-02-01 17:16:37 -05:00
|
|
|
|
|
|
|
class Mock
|
|
|
|
|
|
|
|
def put_container(name, options = {})
|
|
|
|
response = Excon::Response.new
|
|
|
|
response.status = 201
|
|
|
|
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",
|
|
|
|
"Content-Length"=>"18",
|
|
|
|
"Date"=>"Fri, 01 Feb 2013 21:21:45 GMT",
|
|
|
|
"Content-Type"=>"text/plain; charset=UTF-8",
|
|
|
|
"X-Cdn-Streaming-Uri"=>"http://b82027c64cb4dd03670a-ca4e4e61e477bbd430e1f5b9dc9a19f5.r53.stream.cf1.rackcdn.com",
|
|
|
|
"X-Trans-Id"=>"tx1b41ec63189f4862baa65e0c08711772"
|
|
|
|
}
|
|
|
|
response.body = "201 Created\n\n\n\n "
|
|
|
|
response
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-10-20 19:58:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|