api

package
v0.0.0-...-ca3ac9b Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const APIKeyHeaderKey = "apikey"

APIKeyHeaderKey in this header the right api key should be inserted

View Source
const BlobIDHeaderKey = "blobid"

BlobIDHeaderKey is the header for defining a blob id

View Source
const FilenameKey = "filename"

FilenameKey key for the headermapping for the file name

View Source
const HeaderPrefixKey = "headerprefix"

HeaderPrefixKey all headers with this prefix will be saved, too

View Source
const MetricsEndpoint = "/metrics"

MetricsEndpoint endpoint subpath for metrics

View Source
const RetentionHeaderKey = "retention"

RetentionHeaderKey is the header for defining a retention time

View Source
const TenantHeaderKey = "tenant"

TenantHeaderKey in this header the right tenant should be inserted

View Source
const URLParamTenantID = "tntid"

URLParamTenantID url parameter for the tenant id

Variables

This section is empty.

Functions

func MetricsHandler

func MetricsHandler(cfg MetricsConfig) func(next http.Handler) http.Handler

MetricsHandler creates a new directly usable handler

func RoleCheck

func RoleCheck(allowedRoles []Role) func(next http.Handler) http.Handler

RoleCheck implements a simple middleware handler for adding basic http auth to a route.

func SysAPIHandler

func SysAPIHandler(cfg SysAPIConfig) func(next http.Handler) http.Handler

SysAPIHandler creates a new directly usable handler

func TenantCheck

func TenantCheck() func(next http.Handler) http.Handler

TenantCheck implements a simple middleware handler for adding basic http auth to a route.

func TraceEnhancer

func TraceEnhancer(next http.Handler) http.Handler

TraceEnhancer is a middleware that will set the http method and url as operation-name of the top level span.

Types

type Handler

type Handler interface {
	// Routes get the routes
	Routes() (string, *chi.Mux)
}

Handler a http REST interface handler

type MetricsConfig

type MetricsConfig struct {
	// Skip particular requests from the handler
	SkipFunc func(r *http.Request) bool
}

MetricsConfig defining a handler for checking system id and api key

type Role

type Role string

Role define a role

const (
	RoleObjectReader  Role = "object-reader"
	RoleObjectCreator Role = "object-creator"
	RoleObjectAdmin   Role = "object-admin"
	RoleTenantAdmin   Role = "tenant-admin"
	RoleAdmin         Role = "admin"
)

definition of default roles

type RoleChecker

type RoleChecker interface {
	CheckRole(ctx context.Context, allowedRoles []Role) bool
}

RoleChecker interface for checking roles

var RoleCheckerImpl RoleChecker

RoleCheckerImpl the default implementation of the role checker

type SysAPIConfig

type SysAPIConfig struct {
	Apikey           string
	HeaderKeyMapping map[string]string
	// Skip particular requests from the handler
	SkipFunc func(r *http.Request) bool
}

SysAPIConfig defining a handler for checking system id and api key

type TenantChecker

type TenantChecker interface {
	CheckTenant(ctx context.Context, tenant string) bool
}

TenantChecker interface for checking a tenant

var TntCheckerImpl TenantChecker

TntCheckerImpl default implementation of tenant checker

Jump to

Keyboard shortcuts

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