Help us shape the future of Go! Take the 2026 Go Developer Survey

endpoints

package
v1.16.21 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 3 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
	Handler  http.HandlerFunc
	Settings EndpointSettings
}

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

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"
	EndpointGroupJobs              EndpointGroupName = "jobs"
	EndpointGroupShutdown          EndpointGroupName = "shutdown"
	EndpointGroupConversation      EndpointGroupName = "conversation"
)

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
	EndpointGroupVersion1alpha2 EndpointGroupVersion = "v1alpha2" // Alias: v1.0-alpha2
	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