func DataSourceProcessorCSV()

in internal/elasticsearch/ingest/processor_csv_data_source.go [15:111]


func DataSourceProcessorCSV() *schema.Resource {
	processorSchema := map[string]*schema.Schema{
		"id": {
			Description: "Internal identifier of the resource",
			Type:        schema.TypeString,
			Computed:    true,
		},
		"field": {
			Description: "The field to extract data from.",
			Type:        schema.TypeString,
			Required:    true,
		},
		"target_fields": {
			Description: "The array of fields to assign extracted values to.",
			Type:        schema.TypeList,
			Required:    true,
			MinItems:    1,
			Elem: &schema.Schema{
				Type: schema.TypeString,
			},
		},
		"ignore_missing": {
			Description: "If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document.",
			Type:        schema.TypeBool,
			Optional:    true,
			Default:     false,
		},
		"separator": {
			Description: "Separator used in CSV, has to be single character string.",
			Type:        schema.TypeString,
			Optional:    true,
			Default:     ",",
		},
		"quote": {
			Description: "Quote used in CSV, has to be single character string",
			Type:        schema.TypeString,
			Optional:    true,
			Default:     `"`,
		},
		"trim": {
			Description: "Trim whitespaces in unquoted fields.",
			Type:        schema.TypeBool,
			Optional:    true,
			Default:     false,
		},
		"empty_value": {
			Description: "Value used to fill empty fields, empty fields will be skipped if this is not provided.",
			Type:        schema.TypeString,
			Optional:    true,
		},
		"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: "Extracts fields from CSV line out of a single text field within a document. Any empty field in CSV will be skipped. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/csv-processor.html",

		ReadContext: dataSourceProcessorCSVRead,

		Schema: processorSchema,
	}
}