Sha256: 81db89097642ed4500d56088cea16718caed0c862acdd0297309d8e7776b542c
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require 'rubygems' require 'xml/libxml' require_gem 'builder' module S33r # For manipulating logging directives on resources # (see http://docs.amazonwebservices.com/AmazonS3/2006-03-01/LoggingHowTo.html). # # Calling LoggingResource.new (no arguments) will generate a blank instance # which can be used to remove logging from a resource. class LoggingResource attr_reader :log_target, :log_prefix def initialize(log_target=nil, log_prefix=nil) @log_target = log_target @log_prefix = log_prefix end # Generate a BucketLoggingStatus XML document for putting to the ?logging # URL for a resource. # #-- TODO: test generates correct XML def to_xml xml_str = "" xml = Builder::XmlMarkup.new(:target => xml_str, :indent => 0) xml.instruct! # BucketLoggingStatus XML. xml.BucketLoggingStatus({"xmlns" => RESPONSE_NAMESPACE_URI}) { unless @log_target.nil? and @log_prefix.nil? xml.LoggingEnabled { xml.TargetBucket @log_target xml.TargetPrefix @log_prefix } end } xml_str end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
s33r-0.4.1 | lib/s33r/logging.rb |
s33r-0.4 | lib/s33r/logging.rb |