trigger

package
v0.14.5-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyAuthenticator

type APIKeyAuthenticator struct {
	Key   string         `json:"key,omitempty" expr_enabled:"true"`
	Value string         `json:"value,omitempty" expr_enabled:"true"`
	In    APIKeyPosition `json:"in,omitempty" expr_enabled:"true"`
}

func (APIKeyAuthenticator) AuthenticateGRPC

func (a APIKeyAuthenticator) AuthenticateGRPC()

func (APIKeyAuthenticator) AuthenticateHTTP

func (a APIKeyAuthenticator) AuthenticateHTTP(req *http.Request)

type APIKeyPosition

type APIKeyPosition string
const (
	APIKeyPositionHeader APIKeyPosition = "header"
	APIKeyPositionQuery  APIKeyPosition = "query"
)

type BasicAuthenticator

type BasicAuthenticator struct {
	Username string `json:"username,omitempty" expr_enabled:"true"`
	Password string `json:"password,omitempty" expr_enabled:"true"`
}

func (BasicAuthenticator) AuthenticateGRPC

func (a BasicAuthenticator) AuthenticateGRPC()

func (BasicAuthenticator) AuthenticateHTTP

func (a BasicAuthenticator) AuthenticateHTTP(req *http.Request)

type BearerAuthenticator

type BearerAuthenticator struct {
	Bearer string `json:"bearer,omitempty" expr_enabled:"true"`
}

func (BearerAuthenticator) AuthenticateGRPC

func (a BearerAuthenticator) AuthenticateGRPC()

func (BearerAuthenticator) AuthenticateHTTP

func (a BearerAuthenticator) AuthenticateHTTP(req *http.Request)

type GRPCHeader

type GRPCHeader struct {
	Key   string `expr_enabled:"true" json:"key"`
	Value string `expr_enabled:"true" json:"value"`
}

type GRPCRequest

type GRPCRequest struct {
	ProtobufFile string             `json:"protobufFile,omitempty" expr_enabled:"true"`
	Address      string             `json:"address,omitempty" expr_enabled:"true"`
	Service      string             `json:"service,omitempty" expr_enabled:"true"`
	Method       string             `json:"method,omitempty" expr_enabled:"true"`
	Request      string             `json:"request,omitempty" expr_enabled:"true"`
	Metadata     []GRPCHeader       `json:"metadata,omitempty"`
	Auth         *HTTPAuthenticator `json:"auth,omitempty"`
}

func (GRPCRequest) Authenticate

func (a GRPCRequest) Authenticate()

func (GRPCRequest) Headers

func (a GRPCRequest) Headers() []string

func (GRPCRequest) MD

func (a GRPCRequest) MD() *metadata.MD

type GRPCResponse

type GRPCResponse struct {
	Status     string
	StatusCode int
	Metadata   []GRPCHeader
	Body       string
}

type HTTPAuthenticator

type HTTPAuthenticator struct {
	Type   string               `json:"type,omitempty" expr_enabled:"true"`
	APIKey *APIKeyAuthenticator `json:"apiKey,omitempty"`
	Basic  *BasicAuthenticator  `json:"basic,omitempty"`
	Bearer *BearerAuthenticator `json:"bearer,omitempty"`
}

func (HTTPAuthenticator) AuthenticateGRPC

func (a HTTPAuthenticator) AuthenticateGRPC()

func (HTTPAuthenticator) AuthenticateHTTP

func (a HTTPAuthenticator) AuthenticateHTTP(req *http.Request)

func (HTTPAuthenticator) Map

func (a HTTPAuthenticator) Map(mapFn func(current string) (string, error)) (HTTPAuthenticator, error)

func (*HTTPAuthenticator) UnmarshalJSON

func (a *HTTPAuthenticator) UnmarshalJSON(data []byte) error

type HTTPHeader

type HTTPHeader struct {
	Key   string `expr_enabled:"true" json:"key,omitempty"`
	Value string `expr_enabled:"true" json:"value,omitempty"`
}

type HTTPMethod

type HTTPMethod string
var (
	HTTPMethodGET      HTTPMethod = "GET"
	HTTPMethodPUT      HTTPMethod = "PUT"
	HTTPMethodPOST     HTTPMethod = "POST"
	HTTPMethodPATCH    HTTPMethod = "PATCH"
	HTTPMethodDELETE   HTTPMethod = "DELETE"
	HTTPMethodCOPY     HTTPMethod = "COPY"
	HTTPMethodHEAD     HTTPMethod = "HEAD"
	HTTPMethodOPTIONS  HTTPMethod = "OPTIONS"
	HTTPMethodLINK     HTTPMethod = "LINK"
	HTTPMethodUNLINK   HTTPMethod = "UNLINK"
	HTTPMethodPURGE    HTTPMethod = "PURGE"
	HTTPMethodLOCK     HTTPMethod = "LOCK"
	HTTPMethodUNLOCK   HTTPMethod = "UNLOCK"
	HTTPMethodPROPFIND HTTPMethod = "PROPFIND"
	HTTPMethodVIEW     HTTPMethod = "VIEW"
)

type HTTPRequest

type HTTPRequest struct {
	Method          HTTPMethod         `expr_enabled:"true" json:"method,omitempty"`
	URL             string             `expr_enabled:"true" json:"url,omitempty"`
	Body            string             `expr_enabled:"true" json:"body,omitempty"`
	Headers         []HTTPHeader       `json:"headers,omitempty"`
	Auth            *HTTPAuthenticator `json:"auth,omitempty"`
	SSLVerification bool               `json:"sslVerification,omitempty"`
}

func (HTTPRequest) Authenticate

func (a HTTPRequest) Authenticate(req *http.Request)

func (*HTTPRequest) UnmarshalJSON

func (r *HTTPRequest) UnmarshalJSON(data []byte) error

type HTTPResponse

type HTTPResponse struct {
	Status     string
	StatusCode int
	Headers    []HTTPHeader
	Body       string
}

type KafkaAuthenticator

type KafkaAuthenticator struct {
	Type  string                   `json:"type,omitempty" expr_enabled:"true"`
	Plain *KafkaPlainAuthenticator `json:"plain,omitempty"`
}

type KafkaMessageHeader

type KafkaMessageHeader struct {
	Key   string `expr_enabled:"true" json:"key,omitempty"`
	Value string `expr_enabled:"true" json:"value,omitempty"`
}

type KafkaPlainAuthenticator

type KafkaPlainAuthenticator struct {
	Username string `json:"username,omitempty" expr_enabled:"true"`
	Password string `json:"password,omitempty" expr_enabled:"true"`
}

type KafkaRequest

type KafkaRequest struct {
	BrokerURLs      []string             `json:"brokerUrls"`
	Topic           string               `expr_enabled:"true" json:"topic"`
	Headers         []KafkaMessageHeader `json:"headers"`
	Authentication  *KafkaAuthenticator  `json:"authetication,omitempty"`
	MessageKey      string               `expr_enabled:"true" json:"messageKey"`
	MessageValue    string               `expr_enabled:"true" json:"messageValue"`
	SSLVerification bool                 `json:"sslVerification,omitempty"`
}

func (KafkaRequest) GetHeaderAsMap

func (r KafkaRequest) GetHeaderAsMap() map[string]string

type KafkaResponse

type KafkaResponse struct {
	Partition string
	Offset    string
}

type TraceIDRequest

type TraceIDRequest struct {
	ID string `json:"id,omitempty" expr_enabled:"true"`
}

type TraceIDResponse

type TraceIDResponse struct {
	ID string
}

type Trigger

type Trigger struct {
	Type    TriggerType     `json:"type"`
	HTTP    *HTTPRequest    `json:"httpRequest,omitempty"`
	GRPC    *GRPCRequest    `json:"grpc,omitempty"`
	TraceID *TraceIDRequest `json:"traceid,omitempty"`
	Kafka   *KafkaRequest   `json:"kafka,omitempty"`
}

func (Trigger) MarshalJSON

func (t Trigger) MarshalJSON() ([]byte, error)

func (*Trigger) UnmarshalJSON

func (t *Trigger) UnmarshalJSON(data []byte) error

type TriggerError

type TriggerError struct {
	ConnectionError    bool   `json:"connectionError"`
	RunningOnContainer bool   `json:"runningOnContainer"`
	TargetsLocalhost   bool   `json:"targetsLocalhost"`
	ErrorMessage       string `json:"message"`
}

func (TriggerError) Error

func (e TriggerError) Error() error

type TriggerResult

type TriggerResult struct {
	Type    TriggerType      `json:"type"`
	HTTP    *HTTPResponse    `json:"http,omitempty"`
	GRPC    *GRPCResponse    `json:"grpc,omitempty"`
	TraceID *TraceIDResponse `json:"traceid,omitempty"`
	Kafka   *KafkaResponse   `json:"kafka,omitempty"`
	Error   *TriggerError    `json:"error,omitempty"`
}

func (*TriggerResult) UnmarshalJSON

func (t *TriggerResult) UnmarshalJSON(data []byte) error

type TriggerType

type TriggerType string
const TriggerTypeGRPC TriggerType = "grpc"
const TriggerTypeHTTP TriggerType = "http"
const TriggerTypeKafka TriggerType = "kafka"
const TriggerTypeTraceID TriggerType = "traceid"

Jump to

Keyboard shortcuts

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