handler

package
v0.0.0-...-ed85594 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCollections

func GetCollections(ccache *CollectionsCache) func(params operations.GetCollectionsParams) middleware.Responder

GetCollections returns all collections.

func GetCollectionsOfOu

func GetCollectionsOfOu(ccache *CollectionsCache) func(params operations.GetCollectionsOuIDParams) middleware.Responder

GetCollectionsOfOu returns all collections of an organisational unit.

func GetCollectionsOfProject

func GetCollectionsOfProject(ccache *CollectionsCache) func(params operations.GetCollectionsProjectIDParams) middleware.Responder

GetCollectionsOfProject returns all collections of a project.

func GetMetrics

func GetMetrics(ucache *UsersCache, ccache *CollectionsCache) func(p operations.GetMetricsParams) middleware.Responder

GetMetrics handles the metrics request with the Prometheus handler

func GetPing

func GetPing(cfg config.Configuration) func(params operations.GetPingParams, principle *models.Principal) middleware.Responder

GetPing returns dummy string for health check, including the authentication.

func GetUsers

func GetUsers(ucache *UsersCache) func(params operations.GetUsersParams) middleware.Responder

GetUsers returns all users.

func GetUsersOfOu

func GetUsersOfOu(ucache *UsersCache) func(params operations.GetUsersOuIDParams) middleware.Responder

GetUsersOfOu returns all users of an organisational unit.

func NewCustomResponder

func NewCustomResponder(r *http.Request, h http.Handler) middleware.Responder

func SearchUsers

func SearchUsers(ucache *UsersCache) func(params operations.GetUsersSearchParams) middleware.Responder

SearchUsers returns all users with matched email and/or display name.

Types

type CollectionsCache

type CollectionsCache struct {

	// Config is the general API server configuration.
	Config config.Configuration

	// Context is the API server context.
	Context context.Context
	// contains filtered or unexported fields
}

CollectionsCache is an in-memory store for caching all DR collections.

func (*CollectionsCache) GetCollections

func (c *CollectionsCache) GetCollections() []*dr.DRCollection

GetCollections returns all collections from cache

func (*CollectionsCache) Init

func (c *CollectionsCache) Init()

init initializes the cache with first reload.

func (*CollectionsCache) UpdateConfig

func (c *CollectionsCache) UpdateConfig(cfg config.Configuration)

UpdateConfig updates configuration data

type CustomResponder

type CustomResponder func(http.ResponseWriter, runtime.Producer)

This trick of integrating promhttp handler with swagger server is taken from the blog: https://www.kaznacheev.me/posts/en/go_swagger_tricks/

func (CustomResponder) WriteResponse

func (c CustomResponder) WriteResponse(w http.ResponseWriter, p runtime.Producer)

type UsersCache

type UsersCache struct {

	// Config is the general API server configuration.
	Config config.Configuration

	// Context is the API server context.
	Context context.Context
	// contains filtered or unexported fields
}

UsersCache is an in-memory store for caching all DR users.

func (*UsersCache) GetUsers

func (c *UsersCache) GetUsers() []*dr.DRUser

GetUsers returns all users from cache

func (*UsersCache) Init

func (c *UsersCache) Init()

init initializes the cache with first reload.

func (*UsersCache) UpdateConfig

func (c *UsersCache) UpdateConfig(cfg config.Configuration)

UpdateConfig updates configuration data

Jump to

Keyboard shortcuts

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