func DataSourceProcessorNetworkDirection()

in internal/elasticsearch/ingest/processor_network_direction_data_source.go [15:107]


func DataSourceProcessorNetworkDirection() *schema.Resource {
	processorSchema := map[string]*schema.Schema{
		"id": {
			Description: "Internal identifier of the resource.",
			Type:        schema.TypeString,
			Computed:    true,
		},
		"source_ip": {
			Description: "Field containing the source IP address.",
			Type:        schema.TypeString,
			Optional:    true,
		},
		"destination_ip": {
			Description: "Field containing the destination IP address.",
			Type:        schema.TypeString,
			Optional:    true,
		},
		"target_field": {
			Description: "Output field for the network direction.",
			Type:        schema.TypeString,
			Optional:    true,
		},
		"internal_networks": {
			Description: "List of internal networks.",
			Type:        schema.TypeSet,
			MinItems:    1,
			Optional:    true,
			Elem: &schema.Schema{
				Type: schema.TypeString,
			},
			ConflictsWith: []string{"internal_networks_field"},
			ExactlyOneOf:  []string{"internal_networks", "internal_networks_field"},
		},
		"internal_networks_field": {
			Description:   "A field on the given document to read the internal_networks configuration from.",
			Type:          schema.TypeString,
			Optional:      true,
			ConflictsWith: []string{"internal_networks"},
			ExactlyOneOf:  []string{"internal_networks", "internal_networks_field"},
		},
		"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:     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: "Calculates the network direction given a source IP address, destination IP address, and a list of internal networks. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/network-direction-processor.html",

		ReadContext: dataSourceProcessorNetworkDirectionRead,

		Schema: processorSchema,
	}
}