Back to godoc.org

Package http

v0.0.0-...-e652847
Latest Go to latest

The latest major version is .

Published: Jan 15, 2020 | License: MIT | Module: bitbucket.org/orus-io/xbus

Index

Constants

const (
	// WebHookServiceName is the name of the webhook service in the registry
	WebHookServiceName = "http.webhook"
)

Variables

var ErrNoAPIKey = errors.New("No API key found in the request")

ErrNoAPIKey is when no API key is in the request

var ErrNotNow = errors.New("The actor is not ready, try again later")

ErrNotNow ...

var ErrTemporaryError = errors.New(
	"An error occured that should not put the process in fail state")

ErrTemporaryError ...

func NewWebHookHandler

func NewWebHookHandler(actor *xbus.Actor) xbus.ActorService

NewWebHookHandler ...

func SetupCredentials

func SetupCredentials(options nats.Options, r *http.Request) (nats.Options, error)

SetupCredentials extract credentials from a request and inject them in a nats.Options

type Beta11Envelope

type Beta11Envelope struct {
	api.Envelope
	Context *api.ProcessingContext `json:"context"`
}

Beta11Envelope is a envelope structure from the beta11 version

type Credentials

type Credentials struct {
	APIKey   string
	User     string
	Password string
}

Credentials holds user credentials extracted from the request

func ExtractCredentials

func ExtractCredentials(r *http.Request) (*Credentials, error)

ExtractCredentials extracts authentication information from a http.Request

type Gateway

type Gateway struct {
	XbusOptions xbus.COptions
	Log         xbus.Logger
	Router      *mux.Router
	// contains filtered or unexported fields
}

Gateway provides a http router that handle a http-rest gateway to xbus

func NewGateway

func NewGateway(options xbus.COptions, logger xbus.Logger) *Gateway

NewGateway initializes a Gateway

func (*Gateway) Beta11InputHandler

func (g *Gateway) Beta11InputHandler(w http.ResponseWriter, r *http.Request)

Beta11InputHandler is the handler for the deprecated '{actor}/input' route

func (*Gateway) Beta11OutputHandler

func (g *Gateway) Beta11OutputHandler(w http.ResponseWriter, r *http.Request)

Beta11OutputHandler is the handler for the deprecated '{actor}/output/{output}' route

func (*Gateway) OutputHandler

func (g *Gateway) OutputHandler(w http.ResponseWriter, r *http.Request)

OutputHandler is the handler for the '{actor}/output' route

func (*Gateway) ProcessRequestHandler

func (g *Gateway) ProcessRequestHandler(w http.ResponseWriter, r *http.Request)

ProcessRequestHandler is the handler for the '{actor}/processrequest' route

func (*Gateway) ProcessingEndHandler

func (g *Gateway) ProcessingEndHandler(w http.ResponseWriter, r *http.Request)

ProcessingEndHandler is the handler for the '{actor}/processingend' route

func (*Gateway) RequestHandler

func (g *Gateway) RequestHandler(w http.ResponseWriter, r *http.Request)

RequestHandler is the handler for the '{actor}/request' route

func (*Gateway) Shutdown

func (g *Gateway) Shutdown()

Shutdown the webhooks

func (*Gateway) Startup

func (g *Gateway) Startup() error

Startup starts handling the webhooks

type WebHookHandler

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

WebHookHandler ...

func (*WebHookHandler) Process

func (wh *WebHookHandler) Process(apc *xbus.ActorProcessingContext) error

Process a request

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier