endpoints

package
v1.13.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppendSpanAttributesFn

type AppendSpanAttributesFn = func(r *http.Request, m map[string]string)

type Endpoint

type Endpoint struct {
	Methods         []string
	Route           string
	Version         string
	Group           *EndpointGroup // Endpoint group, used for allowlisting
	FastHTTPHandler fasthttp.RequestHandler
	Handler         http.HandlerFunc
	Settings        EndpointSettings
}

Endpoint is a collection of route information for an Dapr API.

func (Endpoint) GetHandler

func (endpoint Endpoint) GetHandler() http.HandlerFunc

GetHandler returns the handler for the endpoint. TODO: Remove this when FastHTTP support is removed.

func (Endpoint) IsAllowed

func (endpoint Endpoint) IsAllowed(allowedAPIs map[string]struct{}, deniedAPIs map[string]struct{}) bool

IsAllowed returns true if the endpoint is allowed given the API allowlist/denylist.

type EndpointCtxData

type EndpointCtxData struct {
	Group    *EndpointGroup
	Settings EndpointSettings
	SpanData any
}

EndpointCtxData is the type for endpoint data stored in a request's context.

func (*EndpointCtxData) GetEndpointName

func (c *EndpointCtxData) GetEndpointName() string

GetEndpointName returns the Settings.Name property, with nil-checks.

func (*EndpointCtxData) String

func (c *EndpointCtxData) String() string

String implements fmt.Stringer and is used for debugging.

type EndpointCtxKey

type EndpointCtxKey struct{}

EndpointCtxKey is the key for storing endpoint information in the context of a request.

type EndpointGroup

type EndpointGroup struct {
	// Endpoint group name.
	Name EndpointGroupName
	// Endpoint group version.
	Version EndpointGroupVersion
	// AppendSpanAttributes is a function invoked by the tracing middleware.
	// It receives a map where the callback can add attributes to be added to the span.
	// If this is not defined, no additional data is added to the span.
	AppendSpanAttributes AppendSpanAttributesFn
	// MethodName is an optional method that returns the "method" key used in the server monitoring metrics.
	// If unset, the default value is to use the endpoint name.
	MethodName MethodNameFn
}

EndpointGroup is a group of endpoints.

type EndpointGroupName

type EndpointGroupName string

EndpointGroupName is the name of an endpoint group.

const (
	EndpointGroupServiceInvocation EndpointGroupName = "invoke"
	EndpointGroupState             EndpointGroupName = "state"
	EndpointGroupPubsub            EndpointGroupName = "publish"
	EndpointGroupBindings          EndpointGroupName = "bindings"
	EndpointGroupSecrets           EndpointGroupName = "secrets"
	EndpointGroupActors            EndpointGroupName = "actors"
	EndpointGroupMetadata          EndpointGroupName = "metadata"
	EndpointGroupConfiguration     EndpointGroupName = "configuration"
	EndpointGroupLock              EndpointGroupName = "lock"
	EndpointGroupUnlock            EndpointGroupName = "unlock"
	EndpointGroupCrypto            EndpointGroupName = "crypto"
	EndpointGroupSubtleCrypto      EndpointGroupName = "subtlecrypto"
	EndpointGroupWorkflow          EndpointGroupName = "workflows"
	EndpointGroupHealth            EndpointGroupName = "healthz"
	EndpointGroupShutdown          EndpointGroupName = "shutdown"
)

type EndpointGroupVersion

type EndpointGroupVersion string

EndpointGroupVersion is the version of an endpoint group.

const (
	EndpointGroupVersion1       EndpointGroupVersion = "v1"       // Alias: v1.0
	EndpointGroupVersion1alpha1 EndpointGroupVersion = "v1alpha1" // Alias: v1.0-alpha1
	EndpointGroupVersion1beta1  EndpointGroupVersion = "v1beta1"  // Alias: v1.0-beta1
)

type EndpointSettings

type EndpointSettings struct {
	Name          string // Method name, used in logging and for other purposes
	IsFallback    bool   // Endpoint is used as fallback when the method or URL isn't found
	AlwaysAllowed bool   // Endpoint is always allowed regardless of API access rules
	IsHealthCheck bool   // Mark endpoint as healthcheck - for API logging purposes
}

EndpointSettings contains settings for the endpoint.

type MethodNameFn

type MethodNameFn = func(r *http.Request) string

Jump to

Keyboard shortcuts

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