# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

:plugin: <%=name%>
:type: <%=section%>

///////////////////////////////////////////
START - GENERATED VARIABLES, DO NOT EDIT!
///////////////////////////////////////////
:version: %VERSION%
:release_date: %RELEASE_DATE%
:changelog_url: %CHANGELOG_URL%
:include_path: ../../../logstash/docs/include
///////////////////////////////////////////
END - GENERATED VARIABLES, DO NOT EDIT!
///////////////////////////////////////////

[id="plugins-{type}-{plugin}"]

=== <%=name.capitalize%>

include::{include_path}/plugin_header.asciidoc[]

==== Description

<%= description %>

[id="plugins-{type}s-{plugin}-options"]
==== <%=name.capitalize%> <%=section.capitalize%> Configuration Options

This plugin supports the following configuration options plus the <<plugins-{type}s-common-options>> described later.

[cols="<,<,<",options="header",]
|=======================================================================
|Setting |Input type|Required
<% sorted_attributes.each do |name, config|
   next if config[:obsolete]
   next if config[:deprecated]
   if config[:validate].is_a?(Array)
     annotation = "|<<string,string>>, one of `#{config[:validate].inspect}`"
   elsif config[:validate] == :path
     annotation = "|a valid filesystem path"
   else
     annotation = "|<<#{config[:validate]},#{config[:validate]}>>"
   end

   if name.is_a?(Regexp)
     name = "/" + name.to_s.gsub(/^\(\?-mix:/, "").gsub(/\)$/, "") + "/"
   end
   if config[:required]
     annotation += "|Yes"
   else
     annotation += "|No"
   end
-%>
| <<plugins-{type}s-{plugin}-<%=name%>>> <%= annotation %>
<% end -%>
|=======================================================================
<% if sorted_attributes.count > 0 -%>

Also see <<plugins-{type}s-common-options>> for a list of options supported by all
<%=section%> plugins.

&nbsp;

<% sorted_attributes.each do |name, config| -%>
<%
     next if config[:obsolete]
     if name.is_a?(Regexp)
       name = "/" + name.to_s.gsub(/^\(\?-mix:/, "").gsub(/\)$/, "") + "/"
       is_regexp = true
     else
       is_regexp = false
     end
-%>
[id="plugins-{type}s-{plugin}-<%= name%>"]
===== `<%= name %>` <%= " (DEPRECATED)" if config[:deprecated] %>

<% if config[:required] -%>
  * This is a required setting.
<% end -%>
<% if config[:deprecated] -%>
  * DEPRECATED WARNING: This configuration item is deprecated and may not be available in future versions.
<% end -%>
<% if is_regexp -%>
  * The configuration attribute name here is anything that matches the above regular expression.
<% end -%>
<% if config[:validate].is_a?(Symbol) -%>
  * Value type is <<<%= config[:validate] %>,<%= config[:validate] %>>>
<% elsif config[:validate].nil? -%>
  * Value type is <<string,string>>
<% elsif config[:validate].is_a?(Array) -%>
  * Value can be any of: `<%= config[:validate].join('`, `') %>`
<% end -%>
<% if config.include?(:default) -%>
  * Default value is `<%= config[:default].inspect %>`
<% else -%>
  * There is no default value for this setting.
<% end -%>

<%= config[:description] %>

<% end -%>

<% end -%>

include::{include_path}/{type}.asciidoc[]
