def put_bucket_website(bucket_name, options, options_to_be_deprecated = {})
options ||= {}
if options.is_a?(String)
Fog::Logger.deprecation("put_bucket_website with #{options.class} param is deprecated, use put_bucket_website('#{bucket_name}', :IndexDocument => '#{options}') instead [light_black](#{caller.first})[/]")
options = { :IndexDocument => options }
end
if options_to_be_deprecated[:key]
Fog::Logger.deprecation("put_bucket_website with three parameters is deprecated, use put_bucket_website('#{bucket_name}', :ErrorDocument => '#{options_to_be_deprecated[:key]}') instead [light_black](#{caller.first})[/]")
options[:ErrorDocument] = options_to_be_deprecated[:key]
end
options.merge!(options_to_be_deprecated) { |key, o1, o2| o1 }
data = "<WebsiteConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">"
if options[:RedirectAllRequestsTo]
data << "<RedirectAllRequestsTo>\n<HostName>\#{options[:RedirectAllRequestsTo]}</HostName>\n</RedirectAllRequestsTo>\n"
else
if options[:IndexDocument]
data << "<IndexDocument>\n<Suffix>\#{options[:IndexDocument]}</Suffix>\n</IndexDocument>\n"
end
if options[:ErrorDocument]
data << "<ErrorDocument>\n<Key>\#{options[:ErrorDocument]}</Key>\n</ErrorDocument>\n"
end
end
data << '</WebsiteConfiguration>'
request({
:body => data,
:expects => 200,
:headers => {},
:bucket_name => bucket_name,
:method => 'PUT',
:query => {'website' => nil}
})
end