class AWS::S3::WebsiteConfiguration

Attributes

options[R]

@return [Hash]

to_hash[R]

@return [Hash]

Public Class Methods

new(options = {}) click to toggle source

@option options [Hash] :redirect_all_requests_to

Describes the redirect behavior for every request to this
bucket's website endpoint. If this element is present, no
other options are are allowed.
* `:host_name` - (*required*, String)
  Name of the host where requests will be redirected.
* `:protocol` - (String)
  Protocol to use (http, https) when redirecting requests. The
  default is the protocol that is used in the original request.

@option options [Hash] :index_document

* `:suffix` - (*required*, String) - A suffix that is appended to
  a request that is for a directory on the website endpoint
  (e.g. if the suffix is index.html and you make a request to
  samplebucket/images/ the data that is returned will be for
  the object with the key name images/index.html).
  The suffix must not be empty and must not include a
  slash character.

@option options [Hash] :error_document

* `:key` - (*required*, String) - The object key name to use
  when a 4XX class error occurs.

@option options [Array<Hash>] :routing_rules

* `:redirect` - (*required*, Hash)
  * `:host_name` - (String)
  * `:protocol` - (String)
  * `:replace_key_prefix_with` - (String)
  * `:replace_key_with` - (String)
  * `:http_redirect_code` - (String)
* `:condition` - (Hash)
  * `:key_prefix_equals` - (String)
  * `:http_error_code_returned_equals` - (String)
# File lib/aws/s3/website_configuration.rb, line 51
def initialize options = {}
  @options = deep_copy(options)
  if @options.empty?
    @options[:index_document] = { :suffix => 'index.html' }
    @options[:error_document] = { :key => 'error.html' }
  end
end

Public Instance Methods

error_document_key() click to toggle source

This method exists for backwards compatability. @return [String,nil] @api private

# File lib/aws/s3/website_configuration.rb, line 82
def error_document_key
  (@options[:error_document] || {})[:key]
end
error_document_key=(key) click to toggle source

This method exists for backwards compatability. @api private

# File lib/aws/s3/website_configuration.rb, line 88
def error_document_key= key
  @options.delete(:redirect_all_requests_to)
  @options[:error_document] ||= {}
  @options[:error_document][:key] = key
end
index_document_suffix() click to toggle source

This method exists for backwards compatability. @return [String,nil] @api private

# File lib/aws/s3/website_configuration.rb, line 67
def index_document_suffix
  (@options[:index_document] || {})[:suffix]
end
index_document_suffix=(suffix) click to toggle source

This method exists for backwards compatability. @api private

# File lib/aws/s3/website_configuration.rb, line 73
def index_document_suffix= suffix
  @options.delete(:redirect_all_requests_to)
  @options[:index_document] ||= {}
  @options[:index_document][:suffix] = suffix
end

Private Instance Methods

deep_copy(hash) click to toggle source
# File lib/aws/s3/website_configuration.rb, line 96
def deep_copy hash
  Marshal.load(Marshal.dump(hash))
end