<reponame>zlepper/pulumi-elasticstack<gh_stars>0// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Elasticstack
{
    public static class GetIngestProcessorGrok
    {
        /// <summary>
        /// Extracts structured fields out of a single text field within a document. You choose which field to extract matched fields from, as well as the grok pattern you expect will match. A grok pattern is like a regular expression that supports aliased expressions that can be reused.
        /// 
        /// This processor comes packaged with many [reusable patterns](https://github.com/elastic/elasticsearch/blob/master/libs/grok/src/main/resources/patterns).
        /// 
        /// If you need help building patterns to match your logs, you will find the [Grok Debugger](https://www.elastic.co/guide/en/kibana/master/xpack-grokdebugger.html) tool quite useful! [The Grok Constructor](https://grokconstructor.appspot.com/) is also a useful tool.
        /// 
        /// 
        /// See: https://www.elastic.co/guide/en/elasticsearch/reference/current/grok-processor.html
        /// 
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using Elasticstack = Pulumi.Elasticstack;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var grok = Elasticstack.GetIngestProcessorGrok.Invoke(new()
        ///     {
        ///         Field = "message",
        ///         Patterns = new[]
        ///         {
        ///             "%{FAVORITE_DOG:pet}",
        ///             "%{FAVORITE_CAT:pet}",
        ///         },
        ///         PatternDefinitions = 
        ///         {
        ///             { "FAVORITE_DOG", "beagle" },
        ///             { "FAVORITE_CAT", "burmese" },
        ///         },
        ///     });
        /// 
        ///     var myIngestPipeline = new Elasticstack.IngestPipeline("myIngestPipeline", new()
        ///     {
        ///         Processors = new[]
        ///         {
        ///             grok.Apply(getIngestProcessorGrokResult =&gt; getIngestProcessorGrokResult.Json),
        ///         },
        ///     });
        /// 
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Task<GetIngestProcessorGrokResult> InvokeAsync(GetIngestProcessorGrokArgs args, InvokeOptions? options = null)
            => global::Pulumi.Deployment.Instance.InvokeAsync<GetIngestProcessorGrokResult>("elasticstack:index/getIngestProcessorGrok:getIngestProcessorGrok", args ?? new GetIngestProcessorGrokArgs(), options.WithDefaults());

        /// <summary>
        /// Extracts structured fields out of a single text field within a document. You choose which field to extract matched fields from, as well as the grok pattern you expect will match. A grok pattern is like a regular expression that supports aliased expressions that can be reused.
        /// 
        /// This processor comes packaged with many [reusable patterns](https://github.com/elastic/elasticsearch/blob/master/libs/grok/src/main/resources/patterns).
        /// 
        /// If you need help building patterns to match your logs, you will find the [Grok Debugger](https://www.elastic.co/guide/en/kibana/master/xpack-grokdebugger.html) tool quite useful! [The Grok Constructor](https://grokconstructor.appspot.com/) is also a useful tool.
        /// 
        /// 
        /// See: https://www.elastic.co/guide/en/elasticsearch/reference/current/grok-processor.html
        /// 
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using Elasticstack = Pulumi.Elasticstack;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var grok = Elasticstack.GetIngestProcessorGrok.Invoke(new()
        ///     {
        ///         Field = "message",
        ///         Patterns = new[]
        ///         {
        ///             "%{FAVORITE_DOG:pet}",
        ///             "%{FAVORITE_CAT:pet}",
        ///         },
        ///         PatternDefinitions = 
        ///         {
        ///             { "FAVORITE_DOG", "beagle" },
        ///             { "FAVORITE_CAT", "burmese" },
        ///         },
        ///     });
        /// 
        ///     var myIngestPipeline = new Elasticstack.IngestPipeline("myIngestPipeline", new()
        ///     {
        ///         Processors = new[]
        ///         {
        ///             grok.Apply(getIngestProcessorGrokResult =&gt; getIngestProcessorGrokResult.Json),
        ///         },
        ///     });
        /// 
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Output<GetIngestProcessorGrokResult> Invoke(GetIngestProcessorGrokInvokeArgs args, InvokeOptions? options = null)
            => global::Pulumi.Deployment.Instance.Invoke<GetIngestProcessorGrokResult>("elasticstack:index/getIngestProcessorGrok:getIngestProcessorGrok", args ?? new GetIngestProcessorGrokInvokeArgs(), options.WithDefaults());
    }


    public sealed class GetIngestProcessorGrokArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// Description of the processor.
        /// </summary>
        [Input("description")]
        public string? Description { get; set; }

        /// <summary>
        /// Must be disabled or v1. If v1, the processor uses patterns with Elastic Common Schema (ECS) field names. **NOTE:** Supported only starting from version of Elasticsearch **7.16.x**.
        /// </summary>
        [Input("ecsCompatibility")]
        public string? EcsCompatibility { get; set; }

        /// <summary>
        /// The field to use for grok expression parsing
        /// </summary>
        [Input("field", required: true)]
        public string Field { get; set; } = null!;

        /// <summary>
        /// Conditionally execute the processor
        /// </summary>
        [Input("if")]
        public string? If { get; set; }

        /// <summary>
        /// Ignore failures for the processor.
        /// </summary>
        [Input("ignoreFailure")]
        public bool? IgnoreFailure { get; set; }

        /// <summary>
        /// If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
        /// </summary>
        [Input("ignoreMissing")]
        public bool? IgnoreMissing { get; set; }

        [Input("onFailures")]
        private List<string>? _onFailures;

        /// <summary>
        /// Handle failures for the processor.
        /// </summary>
        public List<string> OnFailures
        {
            get => _onFailures ?? (_onFailures = new List<string>());
            set => _onFailures = value;
        }

        [Input("patternDefinitions")]
        private Dictionary<string, string>? _patternDefinitions;

        /// <summary>
        /// A map of pattern-name and pattern tuples defining custom patterns to be used by the current processor. Patterns matching existing names will override the pre-existing definition.
        /// </summary>
        public Dictionary<string, string> PatternDefinitions
        {
            get => _patternDefinitions ?? (_patternDefinitions = new Dictionary<string, string>());
            set => _patternDefinitions = value;
        }

        [Input("patterns", required: true)]
        private List<string>? _patterns;

        /// <summary>
        /// An ordered list of grok expression to match and extract named captures with. Returns on the first expression in the list that matches.
        /// </summary>
        public List<string> Patterns
        {
            get => _patterns ?? (_patterns = new List<string>());
            set => _patterns = value;
        }

        /// <summary>
        /// Identifier for the processor.
        /// </summary>
        [Input("tag")]
        public string? Tag { get; set; }

        /// <summary>
        /// when true, `_ingest._grok_match_index` will be inserted into your matched document’s metadata with the index into the pattern found in `patterns` that matched.
        /// </summary>
        [Input("traceMatch")]
        public bool? TraceMatch { get; set; }

        public GetIngestProcessorGrokArgs()
        {
        }
        public static new GetIngestProcessorGrokArgs Empty => new GetIngestProcessorGrokArgs();
    }

    public sealed class GetIngestProcessorGrokInvokeArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// Description of the processor.
        /// </summary>
        [Input("description")]
        public Input<string>? Description { get; set; }

        /// <summary>
        /// Must be disabled or v1. If v1, the processor uses patterns with Elastic Common Schema (ECS) field names. **NOTE:** Supported only starting from version of Elasticsearch **7.16.x**.
        /// </summary>
        [Input("ecsCompatibility")]
        public Input<string>? EcsCompatibility { get; set; }

        /// <summary>
        /// The field to use for grok expression parsing
        /// </summary>
        [Input("field", required: true)]
        public Input<string> Field { get; set; } = null!;

        /// <summary>
        /// Conditionally execute the processor
        /// </summary>
        [Input("if")]
        public Input<string>? If { get; set; }

        /// <summary>
        /// Ignore failures for the processor.
        /// </summary>
        [Input("ignoreFailure")]
        public Input<bool>? IgnoreFailure { get; set; }

        /// <summary>
        /// If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
        /// </summary>
        [Input("ignoreMissing")]
        public Input<bool>? IgnoreMissing { get; set; }

        [Input("onFailures")]
        private InputList<string>? _onFailures;

        /// <summary>
        /// Handle failures for the processor.
        /// </summary>
        public InputList<string> OnFailures
        {
            get => _onFailures ?? (_onFailures = new InputList<string>());
            set => _onFailures = value;
        }

        [Input("patternDefinitions")]
        private InputMap<string>? _patternDefinitions;

        /// <summary>
        /// A map of pattern-name and pattern tuples defining custom patterns to be used by the current processor. Patterns matching existing names will override the pre-existing definition.
        /// </summary>
        public InputMap<string> PatternDefinitions
        {
            get => _patternDefinitions ?? (_patternDefinitions = new InputMap<string>());
            set => _patternDefinitions = value;
        }

        [Input("patterns", required: true)]
        private InputList<string>? _patterns;

        /// <summary>
        /// An ordered list of grok expression to match and extract named captures with. Returns on the first expression in the list that matches.
        /// </summary>
        public InputList<string> Patterns
        {
            get => _patterns ?? (_patterns = new InputList<string>());
            set => _patterns = value;
        }

        /// <summary>
        /// Identifier for the processor.
        /// </summary>
        [Input("tag")]
        public Input<string>? Tag { get; set; }

        /// <summary>
        /// when true, `_ingest._grok_match_index` will be inserted into your matched document’s metadata with the index into the pattern found in `patterns` that matched.
        /// </summary>
        [Input("traceMatch")]
        public Input<bool>? TraceMatch { get; set; }

        public GetIngestProcessorGrokInvokeArgs()
        {
        }
        public static new GetIngestProcessorGrokInvokeArgs Empty => new GetIngestProcessorGrokInvokeArgs();
    }


    [OutputType]
    public sealed class GetIngestProcessorGrokResult
    {
        /// <summary>
        /// Description of the processor.
        /// </summary>
        public readonly string? Description;
        /// <summary>
        /// Must be disabled or v1. If v1, the processor uses patterns with Elastic Common Schema (ECS) field names. **NOTE:** Supported only starting from version of Elasticsearch **7.16.x**.
        /// </summary>
        public readonly string? EcsCompatibility;
        /// <summary>
        /// The field to use for grok expression parsing
        /// </summary>
        public readonly string Field;
        /// <summary>
        /// Internal identifier of the resource
        /// </summary>
        public readonly string Id;
        /// <summary>
        /// Conditionally execute the processor
        /// </summary>
        public readonly string? If;
        /// <summary>
        /// Ignore failures for the processor.
        /// </summary>
        public readonly bool? IgnoreFailure;
        /// <summary>
        /// If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
        /// </summary>
        public readonly bool? IgnoreMissing;
        /// <summary>
        /// JSON representation of this data source.
        /// </summary>
        public readonly string Json;
        /// <summary>
        /// Handle failures for the processor.
        /// </summary>
        public readonly ImmutableArray<string> OnFailures;
        /// <summary>
        /// A map of pattern-name and pattern tuples defining custom patterns to be used by the current processor. Patterns matching existing names will override the pre-existing definition.
        /// </summary>
        public readonly ImmutableDictionary<string, string>? PatternDefinitions;
        /// <summary>
        /// An ordered list of grok expression to match and extract named captures with. Returns on the first expression in the list that matches.
        /// </summary>
        public readonly ImmutableArray<string> Patterns;
        /// <summary>
        /// Identifier for the processor.
        /// </summary>
        public readonly string? Tag;
        /// <summary>
        /// when true, `_ingest._grok_match_index` will be inserted into your matched document’s metadata with the index into the pattern found in `patterns` that matched.
        /// </summary>
        public readonly bool? TraceMatch;

        [OutputConstructor]
        private GetIngestProcessorGrokResult(
            string? description,

            string? ecsCompatibility,

            string field,

            string id,

            string? @if,

            bool? ignoreFailure,

            bool? ignoreMissing,

            string json,

            ImmutableArray<string> onFailures,

            ImmutableDictionary<string, string>? patternDefinitions,

            ImmutableArray<string> patterns,

            string? tag,

            bool? traceMatch)
        {
            Description = description;
            EcsCompatibility = ecsCompatibility;
            Field = field;
            Id = id;
            If = @if;
            IgnoreFailure = ignoreFailure;
            IgnoreMissing = ignoreMissing;
            Json = json;
            OnFailures = onFailures;
            PatternDefinitions = patternDefinitions;
            Patterns = patterns;
            Tag = tag;
            TraceMatch = traceMatch;
        }
    }
}
