api

package
v0.0.0-...-e00d9b6 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReturnError

func ReturnError(w http.ResponseWriter, err error) bool

ReturnError produces an error response with HTTP status code 500 if the given error is non-nil. Otherwise, nothing is done and false is returned.

func ReturnJSON

func ReturnJSON(w http.ResponseWriter, code int, data any)

ReturnJSON is a convenience function for HTTP handlers returning JSON data. The `code` argument specifies the HTTP response code, usually 200.

func Server

func Server(keystone identity.Identity, storageInterface storage.Storage) error

Server Set up and start the API server, hooking it up to the API router

Types

type EventList

type EventList struct {
	NextURL string              `json:"next,omitempty"`
	PrevURL string              `json:"previous,omitempty"`
	Events  []*hermes.ListEvent `json:"events"`
	Total   int                 `json:"total"`
}

EventList is the model for JSON returned by the ListEvents API call

type Token

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

Token represents a user's token, as passed through the X-Auth-Token header of a request.

func (*Token) Require

func (t *Token) Require(w http.ResponseWriter, rule string) bool

Require checks if the given token has the given permission according to the policy.json that is in effect. If not, an error response is written and false is returned.

type VersionData

type VersionData struct {
	Status string            `json:"status"`
	ID     string            `json:"id"`
	Links  []versionLinkData `json:"links"`
}

VersionData is used by version advertisement handlers.

func NewV1Handler

func NewV1Handler(keystone identity.Identity, storageInterface storage.Storage) (http.Handler, VersionData)

NewV1Handler creates a http.Handler that serves the Hermes v1 API. It also returns the VersionData for this API version which is needed for the version advertisement on "GET /".

Jump to

Keyboard shortcuts

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