api

package
v0.0.0-...-0bbec8f Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetFromDB

func AssetFromDB(asset db.Asset) castellum.Asset

AssetFromDB converts a db.Asset into an api.Asset.

func FinishedOperationFromDB

func FinishedOperationFromDB(dbOp db.FinishedOperation, assetID string, res *db.Resource) castellum.StandaloneOperation

FinishedOperationFromDB converts a db.FinishedOperation into an api.Operation.

func NewHandler

func NewHandler(cfg core.Config, dbi *gorp.DbMap, team core.AssetManagerTeam, validator gopherpolicy.Validator, provider core.ProviderClient, auditor audittools.Auditor, timeNow func() time.Time) httpapi.API

NewHandler constructs the main httpapi.API for this package.

func ParseAge

func ParseAge(query url.Values, key, defaultValue string) (time.Duration, error)

ParseAge parses a query parameter containing an age specification like `30m`, `12h` or `7d`.

func PendingOperationFromDB

func PendingOperationFromDB(dbOp db.PendingOperation, assetID string, res *db.Resource) castellum.StandaloneOperation

PendingOperationFromDB converts a db.PendingOperation into an api.Operation.

func RequireJSON

func RequireJSON(w http.ResponseWriter, r *http.Request, data any) bool

RequireJSON will parse the request body into the given data structure, or write an error response if that fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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