http

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStatusCodeFromMetadata

func GetStatusCodeFromMetadata(metadata map[string]string) int

GetStatusCodeFromMetadata extracts the http status code from the metadata if it exists.

Types

type API

type API interface {
	APIEndpoints() []Endpoint
	PublicEndpoints() []Endpoint
	MarkStatusAsReady()
	MarkStatusAsOutboundReady()
	SetAppChannel(appChannel channel.AppChannel)
	SetDirectMessaging(directMessaging messaging.DirectMessaging)
	SetActorRuntime(actor actors.Actors)
}

API returns a list of HTTP endpoints for Dapr.

func NewAPI

func NewAPI(
	appID string,
	appChannel channel.AppChannel,
	directMessaging messaging.DirectMessaging,
	getComponentsFn func() []components_v1alpha1.Component,
	stateStores map[string]state.Store,
	secretStores map[string]secretstores.SecretStore,
	secretsConfiguration map[string]config.SecretsScope,
	pubsubAdapter runtime_pubsub.Adapter,
	actor actors.Actors,
	sendToOutputBindingFn func(name string, req *bindings.InvokeRequest) (*bindings.InvokeResponse, error),
	tracingSpec config.TracingSpec,
	shutdown func()) API

NewAPI returns a new API.

type BulkGetRequest added in v0.10.0

type BulkGetRequest struct {
	Metadata    map[string]string `json:"metadata"`
	Keys        []string          `json:"keys"`
	Parallelism int               `json:"parallelism"`
}

BulkGetRequest is the request object to get a list of values for multiple keys from a state store.

type BulkGetResponse added in v0.10.0

type BulkGetResponse struct {
	Key      string              `json:"key"`
	Data     jsoniter.RawMessage `json:"data,omitempty"`
	ETag     *string             `json:"etag,omitempty"`
	Metadata map[string]string   `json:"metadata,omitempty"`
	Error    string              `json:"error,omitempty"`
}

BulkGetResponse is the response object for a state bulk get operation.

type Endpoint

type Endpoint struct {
	Methods []string
	Route   string
	Version string
	Alias   string
	Handler fasthttp.RequestHandler
}

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

If an Alias, e.g. "hello", is provided along with the Route, e.g. "invoke/app-id/method/hello" and the Version, "v1.0", then two endpoints will be installed instead of one. Besiding the canonical Dapr API URL "/v1.0/invoke/app-id/method/hello", one another URL "/hello" is provided for the Alias. When Alias URL is used, extra infos are required to pass through HTTP headers, for example, application's ID.

type ErrorResponse

type ErrorResponse struct {
	ErrorCode string `json:"errorCode"`
	Message   string `json:"message"`
}

ErrorResponse is an HTTP response message sent back to calling clients by the Dapr Runtime HTTP API.

func NewErrorResponse

func NewErrorResponse(errorCode, message string) ErrorResponse

NewErrorResponse returns a new ErrorResponse.

type OutputBindingRequest

type OutputBindingRequest struct {
	Metadata  map[string]string `json:"metadata"`
	Data      interface{}       `json:"data"`
	Operation string            `json:"operation"`
}

OutputBindingRequest is the request object to invoke an output binding.

type QueryItem added in v1.5.0

type QueryItem struct {
	Key   string              `json:"key"`
	Data  jsoniter.RawMessage `json:"data"`
	ETag  *string             `json:"etag,omitempty"`
	Error string              `json:"error,omitempty"`
}

QueryItem is an object representing a single entry in query results.

type QueryResponse added in v1.5.0

type QueryResponse struct {
	Results  []QueryItem       `json:"results"`
	Token    string            `json:"token,omitempty"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

QueryResponse is the response object for querying state.

type Server

type Server interface {
	io.Closer
	StartNonBlocking() error
}

Server is an interface for the Dapr HTTP server.

func NewServer

func NewServer(api API, config ServerConfig, tracingSpec config.TracingSpec, metricSpec config.MetricSpec, pipeline http_middleware.Pipeline, apiSpec config.APISpec) Server

NewServer returns a new HTTP server.

type ServerConfig

type ServerConfig struct {
	AllowedOrigins     string
	AppID              string
	HostAddress        string
	Port               int
	APIListenAddresses []string
	PublicPort         *int
	ProfilePort        int
	EnableProfiling    bool
	MaxRequestBodySize int
	UnixDomainSocket   string
	ReadBufferSize     int
	StreamRequestBody  bool
}

ServerConfig holds config values for an HTTP server.

func NewServerConfig

func NewServerConfig(appID string, hostAddress string, port int, apiListenAddresses []string, publicPort *int, profilePort int, allowedOrigins string, enableProfiling bool, maxRequestBodySize int, unixDomainSocket string, readBufferSize int, streamRequestBody bool) ServerConfig

NewServerConfig returns a new HTTP server config.

Jump to

Keyboard shortcuts

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