restapi

package
v0.0.0-...-7c66ffc Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package restapi holds types for the REST API implementation. The rest api is mostly composed of resource handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomHTTPError

func CustomHTTPError(ctx context.Context, _ *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, r *http.Request, err error)

CustomHTTPError is the custom http error handler for grpc-gateway. The default handler leaks implementation details so it's not ideal.

Types

type ACMEParameters

type ACMEParameters struct {
	Enabled   bool   `param:"desc=Enable ACME Certificates (aka Let's Encrypt) for host;default=false"`
	Hosts     string `param:"desc=ACME host names;default=api.nbiot.engineering,api.nbiot.telenor.io"`
	SecretDir string `param:"desc=ACME secrets directory;default=/var/horde/autocert"`
}

ACMEParameters contains the autocert parameters

func (*ACMEParameters) HostList

func (p *ACMEParameters) HostList() []string

HostList returns the list of hosts

type ConnectIDParameters

type ConnectIDParameters struct {
	Enabled           bool   `param:"desc=Enable CONNECT ID integration;default=false"`
	Host              string `param:"desc=Host name for CONNECT ID OAuth service;default=connect.staging.telenordigital.com"`
	ClientID          string `param:"desc=Client ID for OAuth service;default=telenordigital-connectexample-web"`
	LoginRedirectURI  string `param:"desc=Redirect URI for OAuth client;default=http://localhost:8080/connect/oauth2callback"`
	LogoutRedirectURI string `param:"desc=Redirect URI for OAuth client;default=http://localhost:8080/connect/logoutcallback"`
	Password          string `param:"desc=OAuth client password;default="`
	LoginTarget       string `param:"desc=Final redirect after login;default=/"`
	LogoutTarget      string `param:"desc=Final redirect after logout;default=/"`
	Emulate           bool   `param:"desc=Emulate CONNECT ID;default=false"`
	// contains filtered or unexported fields
}

ConnectIDParameters holds the configuration for the CONNECT ID OAuth client

func (*ConnectIDParameters) ConnectConfig

func (c *ConnectIDParameters) ConnectConfig() goconnect.ClientConfig

ConnectConfig returns the complete CONNECT ID config based on the parameters

func (*ConnectIDParameters) SetSessionStoreConfig

func (c *ConnectIDParameters) SetSessionStoreConfig(driver, connectionString string) error

SetSessionStoreConfig configures the session store

type Server

type Server interface {
	// Start launches the server
	Start() error
	// Stop stops the servers
	Stop() error
}

Server is the server interface for the REST API server

func NewServer

NewServer creates a new REST API server

type ServerParameters

type ServerParameters struct {
	Endpoint         string `param:"desc=Listen address for HTTP server;default=localhost:8080"`
	TLSKeyFile       string `param:"desc=TLS key file;file"`
	TLSCertFile      string `param:"desc=TLS certificate file;file"`
	ACME             ACMEParameters
	RequestLog       string `param:"desc=Request log file name;default=requestlog.log"`
	InlineRequestlog bool   `param:"desc=Include request log in application log;default=false"`
}

ServerParameters contains the configuration parameters for the HTTP server

Jump to

Keyboard shortcuts

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