rest

package
v0.0.77 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package rest provides the REST rule data ingest engine

Index

Constants

View Source
const (
	// RestRuleDataIngestType is the type of the REST rule data ingest engine
	RestRuleDataIngestType = "rest"

	// MaxBytesLimit is the maximum number of bytes to read from the response body
	// We limit to 1MB to prevent abuse
	MaxBytesLimit int64 = 1 << 20
	// EndpointBytesLimit is the maximum number of bytes for the endpoint
	EndpointBytesLimit = 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointTemplateParams

type EndpointTemplateParams struct {
	// Entity is the entity to be evaluated
	Entity any
	// Params are the parameters to be used in the template
	Params map[string]any
}

EndpointTemplateParams is the parameters for the REST endpoint template

type Ingestor

type Ingestor struct {
	// contains filtered or unexported fields
}

Ingestor is the engine for a rule type that uses REST data ingest

func NewRestRuleDataIngest

func NewRestRuleDataIngest(
	restCfg *pb.RestType,
	cli provifv1.REST,
) (*Ingestor, error)

NewRestRuleDataIngest creates a new REST rule data ingest engine

func (*Ingestor) GetConfig

func (rdi *Ingestor) GetConfig() protoreflect.ProtoMessage

GetConfig returns the config for the REST rule data ingest engine

func (*Ingestor) GetType

func (*Ingestor) GetType() string

GetType returns the type of the REST rule data ingest engine

func (*Ingestor) Ingest

func (rdi *Ingestor) Ingest(
	ctx context.Context, ent protoreflect.ProtoMessage, params map[string]any,
) (*interfaces.Result, error)

Ingest calls the REST endpoint and returns the data

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL