func DataSourceProcessorDate()

in internal/elasticsearch/ingest/processor_date_data_source.go [15:106]


func DataSourceProcessorDate() *schema.Resource {
	processorSchema := map[string]*schema.Schema{
		"id": {
			Description: "Internal identifier of the resource",
			Type:        schema.TypeString,
			Computed:    true,
		},
		"field": {
			Description: "The field to get the date from.",
			Type:        schema.TypeString,
			Required:    true,
		},
		"target_field": {
			Description: "The field that will hold the parsed date.",
			Type:        schema.TypeString,
			Optional:    true,
			Default:     "@timestamp",
		},
		"formats": {
			Description: "An array of the expected date formats.",
			Type:        schema.TypeList,
			Required:    true,
			MinItems:    1,
			Elem: &schema.Schema{
				Type: schema.TypeString,
			},
		},
		"timezone": {
			Description: "The timezone to use when parsing the date.",
			Type:        schema.TypeString,
			Optional:    true,
			Default:     "UTC",
		},
		"locale": {
			Description: "The locale to use when parsing the date, relevant when parsing month names or week days.",
			Type:        schema.TypeString,
			Optional:    true,
			Default:     "ENGLISH",
		},
		"output_format": {
			Description: "The format to use when writing the date to `target_field`.",
			Type:        schema.TypeString,
			Optional:    true,
			Default:     "yyyy-MM-dd'T'HH:mm:ss.SSSXXX",
		},
		"description": {
			Description: "Description of the processor. ",
			Type:        schema.TypeString,
			Optional:    true,
		},
		"if": {
			Description: "Conditionally execute the processor",
			Type:        schema.TypeString,
			Optional:    true,
		},
		"ignore_failure": {
			Description: "Ignore failures for the processor. ",
			Type:        schema.TypeBool,
			Optional:    true,
			Default:     false,
		},
		"on_failure": {
			Description: "Handle failures for the processor.",
			Type:        schema.TypeList,
			Optional:    true,
			MinItems:    1,
			Elem: &schema.Schema{
				Type:             schema.TypeString,
				ValidateFunc:     validation.StringIsJSON,
				DiffSuppressFunc: utils.DiffJsonSuppress,
			},
		},
		"tag": {
			Description: "Identifier for the processor.",
			Type:        schema.TypeString,
			Optional:    true,
		},
		"json": {
			Description: "JSON representation of this data source.",
			Type:        schema.TypeString,
			Computed:    true,
		},
	}

	return &schema.Resource{
		Description: "Parses dates from fields, and then uses the date or timestamp as the timestamp for the document. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/date-processor.html",

		ReadContext: dataSourceProcessorDateRead,

		Schema: processorSchema,
	}
}