# File lib/fog/rackspace/cdn.rb, line 137 def initialize(options={}) apply_options(options) authenticate(options) @enabled = false @persistent = options[:persistent] || false if endpoint_uri @connection = Fog::Core::Connection.new(endpoint_uri.to_s, @persistent, @connection_options) @enabled = true end end
Delete an existing object
container<~String> - Name of container to delete
object<~String> - Name of object to delete
@return [Excon::Response] response @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]
# File lib/fog/rackspace/requests/cdn/delete_object.rb, line 15 def delete_object(container, object) request( :expects => 204, :method => 'DELETE', :path => "#{Fog::Rackspace.escape(container)}/#{Fog::Rackspace.escape(object)}" ) end
List existing cdn-enabled storage containers
options<~Hash>:
‘enabled_only’<~Boolean> - Set to true to limit results to cdn enabled containers
‘limit’<~Integer> - Upper limit to number of results returned
‘marker’<~String> - Only return objects with name greater than this value
response<~Excon::Response>:
body<~Array>:
container<~String>: Name of container
@return [Excon::Response] response @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]
# File lib/fog/rackspace/requests/cdn/get_containers.rb, line 22 def get_containers(options = {}) response = request( :expects => [200, 204], :method => 'GET', :path => '', :query => {'format' => 'json'}.merge!(options) ) response end
List cdn properties for a container
container<~String> - Name of container to retrieve info for
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> - ?
@return [Excon::Response] response @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]
# File lib/fog/rackspace/requests/cdn/head_container.rb, line 24 def head_container(container) response = request( :expects => 204, :method => 'HEAD', :path => container, :query => {'format' => 'json'} ) response end
modify CDN properties for a container
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> - ?
@return [Excon::Response] response @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]
# File lib/fog/rackspace/requests/cdn/post_container.rb, line 21 def post_container(name, options = {}) response = request( :expects => [201, 202], :headers => options, :method => 'POST', :path => CGI.escape(name) ) response end
Purges File @param [Fog::Storage::Rackspace::File] file to be purged from the CDN @raise [Fog::Errors::NotImplemented] returned when non file parameters are specified
# File lib/fog/rackspace/cdn.rb, line 157 def purge(file) unless file.is_a? Fog::Storage::Rackspace::File raise Fog::Errors::NotImplemented.new("#{object.class} does not support CDN purging") if object end delete_object file.directory.key, file.key true end
enable CDN for a container
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> - ?
@return [Excon::Response] response @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]
# File lib/fog/rackspace/requests/cdn/put_container.rb, line 21 def put_container(name, options = {}) response = request( :expects => [201, 202], :headers => options, :method => 'PUT', :path => CGI.escape(name) ) response end
Resets CDN connection
# File lib/fog/rackspace/cdn.rb, line 150 def reload @cdn_connection.reset end
# File lib/fog/rackspace/cdn.rb, line 166 def request(params, parse_json = true) super rescue Excon::Errors::NotFound => error raise Fog::Storage::Rackspace::NotFound.slurp(error, self) rescue Excon::Errors::BadRequest => error raise Fog::Storage::Rackspace::BadRequest.slurp(error, self) rescue Excon::Errors::InternalServerError => error raise Fog::Storage::Rackspace::InternalServerError.slurp(error, self) rescue Excon::Errors::HTTPStatusError => error raise Fog::Storage::Rackspace::ServiceError.slurp(error, self) end
Generated with the Darkfish Rdoc Generator 2.