apihandler

package
v0.104.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package apihandler defines haul's v1 API endpoint logic

It defines the APIHandler struct that allows more a efficient reuse of single *dbclient.PostgresClient.

The APIHandler also implements the Declare method for activation of the `/v1/*` routes by cmd.ServerCmd

This package is a work-in-progress during haul's migration from the old `/v1/*` routes (which now reside at `/v0/*`) to the ones declared here.

Index

Constants

View Source
const DescriptionAssetAttributesGET string = "List attributes for an asset"
View Source
const DescriptionAssetDELETE string = "Delete asset"
View Source
const DescriptionAssetDescriptionGET string = "Get asset description"
View Source
const DescriptionAssetDescriptionPUT string = "Set asset description"
View Source
const DescriptionAssetGET string = "Get asset"
View Source
const DescriptionAssetRestorePOST string = "Restore asset"
View Source
const DescriptionAssetStatusDELETE string = "Clear asset status"
View Source
const DescriptionAssetStatusGET string = "Get asset status"
View Source
const DescriptionAssetStatusPUT string = "Set asset status"
View Source
const DescriptionAssetTargetDELETE string = "Clear asset target"
View Source
const DescriptionAssetTargetGET string = "Get asset target"
View Source
const DescriptionAssetTargetPUT string = "Set asset target"
View Source
const DescriptionAssetsAllGET string = "List all assets"
View Source
const DescriptionAssetsDELETE string = "Delete assets"
View Source
const DescriptionAssetsDetailedGET string = "List detailed assets"
View Source
const DescriptionAssetsGET string = "List assets"
View Source
const DescriptionAssetsPOST string = "Insert assets"
View Source
const DescriptionAssetsRestorePOST string = "Restore assets"
View Source
const DescriptionAttributeAllowEmptyValueGET string = "Get attribute allow_empty_value"
View Source
const DescriptionAttributeAllowEmptyValuePUT string = "Set attribute allow_empty_value"
View Source
const DescriptionAttributeAssetsGET string = "List assets for an attribute"
View Source
const DescriptionAttributeDELETE string = "Delete attribute"
View Source
const DescriptionAttributeGET string = "Get attribute"
View Source
const DescriptionAttributeKeyGET string = "Get attribute key"
View Source
const DescriptionAttributeKeyPUT string = "Set attribute key"
View Source
const DescriptionAttributeRestorePOST string = "Restore attribute"
View Source
const DescriptionAttributesDELETE string = "Delete attributes"
View Source
const DescriptionAttributesGET string = "List attributes"
View Source
const DescriptionAttributesPOST string = "Insert attributes"
View Source
const DescriptionEventsGET string = "List events"
View Source
const DescriptionHealthGET string = "Print server's healthcheck to test connection"
View Source
const DescriptionSeedPOST string = "Create tables in the database ('seed'), if needed"
View Source
const DescriptionSpecGET string = "Print the API server spec (pave, not openapi)"
View Source
const DescriptionTagDELETE string = "Delete tag"
View Source
const DescriptionTagDetailedGET string = "Get detailed tag"
View Source
const DescriptionTagGET string = "Get tag"
View Source
const DescriptionTagValueGET string = "Get tag value"
View Source
const DescriptionTagValuePUT string = "Set tag value"
View Source
const DescriptionTagsDELETE string = "Delete tags"
View Source
const DescriptionTagsGET string = "List tags"
View Source
const DescriptionTagsPOST string = "Insert tags"
View Source
const EndpointAsset string = "/assets/:asset_id/"
View Source
const EndpointAssetAttributes string = "/assets/:asset_id/attributes/"
View Source
const EndpointAssetDescription string = "/assets/:asset_id/description/"
View Source
const EndpointAssetRestore string = "/assets/:asset_id/restore/"
View Source
const EndpointAssetStatus string = "/assets/:asset_id/status/"
View Source
const EndpointAssetTarget string = "/assets/:asset_id/target/"
View Source
const EndpointAssets string = "/assets/"
View Source
const EndpointAssetsAll string = "/assets/all/"
View Source
const EndpointAssetsDetailed string = "/assets/detailed/"
View Source
const EndpointAssetsRestore string = "/assets/restore/"
View Source
const EndpointAttribute string = "/attributes/:attribute_id/"
View Source
const EndpointAttributeAllowEmptyValue string = "/attributes/:attribute_id/allow-empty-value/"
View Source
const EndpointAttributeAssets string = "/attributes/:attribute_id/assets/"
View Source
const EndpointAttributeKey string = "/attributes/:attribute_id/key/"
View Source
const EndpointAttributeRestore string = "/attributes/:attribute_id/restore/"
View Source
const EndpointAttributes string = "/attributes/"
View Source
const EndpointEvents string = "/events/"
View Source
const EndpointHealth string = "/health/"
View Source
const EndpointSeed string = "/seed/"
View Source
const EndpointSpec string = "/spec/"
View Source
const EndpointTag string = "/tags/:tag_id/"
View Source
const EndpointTagDetailed string = "/tags/:tag_id/detailed/"
View Source
const EndpointTagValue string = "/tags/:tag_id/value/"
View Source
const EndpointTags string = "/tags/"

Variables

This section is empty.

Functions

func Declare

func Declare(e *echo.Group, h *APIHandler, prefix string)

Declare adds routes defined in its scope to the specified *echo.Group

It is used by cmd.ServerCmd to declare the `/v1/*` routes.

Types

type APIHandler

type APIHandler struct {
	APIClient      *apiclient.APIClient
	PostgresClient *dbclient.PostgresClient
	Pave           *pave.Pave
}

func New

func New(postgresClient *dbclient.PostgresClient) *APIHandler

func NewWithAPIClient added in v0.66.0

func NewWithAPIClient(apiClient *apiclient.APIClient, postgresClient *dbclient.PostgresClient) *APIHandler

func NewWithPave added in v0.87.0

func NewWithPave(apiClient *apiclient.APIClient, postgresClient *dbclient.PostgresClient, paveClient *pave.Pave) *APIHandler

func (*APIHandler) AssetAttributesGET added in v0.63.0

func (h *APIHandler) AssetAttributesGET(c echo.Context) (err error)

AssetAttributesGET is the handler for `GET /v1/assets/{asset_id}/attributes`

func (*APIHandler) AssetDELETE added in v0.63.0

func (h *APIHandler) AssetDELETE(c echo.Context) (err error)

AssetDELETE is the handler for `DELETE /v1/assets/{asset_id}`

func (*APIHandler) AssetDescriptionGET added in v0.63.0

func (h *APIHandler) AssetDescriptionGET(c echo.Context) (err error)

AssetDescriptionGET is the handler for `GET /v1/assets/{asset_id}/description`

func (*APIHandler) AssetDescriptionPUT added in v0.63.0

func (h *APIHandler) AssetDescriptionPUT(c echo.Context) (err error)

AssetDescriptionPUT is the handler for `PUT /v1/assets/{asset_id}/description`

func (*APIHandler) AssetGET added in v0.63.0

func (h *APIHandler) AssetGET(c echo.Context) (err error)

AssetGET is the handler for `GET /v1/assets/{asset_id}`

func (*APIHandler) AssetRestorePOST added in v0.63.0

func (h *APIHandler) AssetRestorePOST(c echo.Context) (err error)

AssetRestorePOST is the handler for `POST /v1/assets/{asset_id}/restore`

func (*APIHandler) AssetStatusDELETE added in v0.63.0

func (h *APIHandler) AssetStatusDELETE(c echo.Context) (err error)

AssetStatusDELETE is the handler for `DELETE /v1/assets/{asset_id}/status`

func (*APIHandler) AssetStatusGET added in v0.63.0

func (h *APIHandler) AssetStatusGET(c echo.Context) (err error)

AssetStatusGET is the handler for `GET /v1/assets/{asset_id}/status`

func (*APIHandler) AssetStatusPUT added in v0.63.0

func (h *APIHandler) AssetStatusPUT(c echo.Context) (err error)

AssetStatusPUT is the handler for `PUT /v1/assets/{asset_id}/status`

func (*APIHandler) AssetTargetDELETE added in v0.63.0

func (h *APIHandler) AssetTargetDELETE(c echo.Context) (err error)

AssetTargetDELETE is the handler for `DELETE /v1/assets/{asset_id}/target`

func (*APIHandler) AssetTargetGET added in v0.63.0

func (h *APIHandler) AssetTargetGET(c echo.Context) (err error)

AssetTargetGET is the handler for `GET /v1/assets/{asset_id}/target`

func (*APIHandler) AssetTargetPUT added in v0.63.0

func (h *APIHandler) AssetTargetPUT(c echo.Context) (err error)

AssetTargetPUT is the handler for `PUT /v1/assets/{asset_id}/target`

func (*APIHandler) AssetsAllGET added in v0.60.0

func (h *APIHandler) AssetsAllGET(c echo.Context) (err error)

AssetsAllGET is the handler for `GET /v1/assets/all`

func (*APIHandler) AssetsDELETE added in v0.63.0

func (h *APIHandler) AssetsDELETE(c echo.Context) error

AssetsDELETE is the handler for `DELETE /v1/assets`

func (*APIHandler) AssetsDetailedGET added in v0.74.0

func (h *APIHandler) AssetsDetailedGET(c echo.Context) (err error)

AssetsDetailedGET is the handler for `GET /v1/assets/detailed`

func (*APIHandler) AssetsGET added in v0.63.0

func (h *APIHandler) AssetsGET(c echo.Context) (err error)

AssetsGET is the handler for `GET /v1/assets`

func (*APIHandler) AssetsPOST added in v0.63.0

func (h *APIHandler) AssetsPOST(c echo.Context) (err error)

AssetsPOST is the handler for `POST /v1/assets`

func (*APIHandler) AssetsRestorePOST added in v0.67.0

func (h *APIHandler) AssetsRestorePOST(c echo.Context) (err error)

AssetsRestorePOST is the handler for `POST /v1/assets/restore`

func (*APIHandler) AttributeAllowEmptyValueGET added in v0.96.0

func (h *APIHandler) AttributeAllowEmptyValueGET(c echo.Context) (err error)

func (*APIHandler) AttributeAllowEmptyValuePUT added in v0.75.0

func (h *APIHandler) AttributeAllowEmptyValuePUT(c echo.Context) (err error)

AttributeAllowEmptyValuePUT

func (*APIHandler) AttributeAssetsGET added in v0.63.0

func (h *APIHandler) AttributeAssetsGET(c echo.Context) (err error)

AttributeAssetsGET is the handler for `GET /v1/attributes/{attribute_id}/assets`

func (*APIHandler) AttributeDELETE added in v0.63.0

func (h *APIHandler) AttributeDELETE(c echo.Context) (err error)

AttributeDELETE is the handler for `DELETE /v1/attributes/{attribute_id}`

func (*APIHandler) AttributeGET added in v0.63.0

func (h *APIHandler) AttributeGET(c echo.Context) (err error)

AttributeGET is the handler for `GET /v1/attributes/{attribute_id}`

func (*APIHandler) AttributeKeyGET added in v0.95.0

func (h *APIHandler) AttributeKeyGET(c echo.Context) (err error)

AttributeKeyGET

func (*APIHandler) AttributeKeyPUT added in v0.75.0

func (h *APIHandler) AttributeKeyPUT(c echo.Context) (err error)

AttributeKeyPUT

func (*APIHandler) AttributeRestorePOST added in v0.63.0

func (h *APIHandler) AttributeRestorePOST(c echo.Context) (err error)

AttributeRestorePOST

func (*APIHandler) AttributesDELETE added in v0.77.0

func (h *APIHandler) AttributesDELETE(c echo.Context) (err error)

AttributesDELETE

func (*APIHandler) AttributesGET added in v0.63.0

func (h *APIHandler) AttributesGET(c echo.Context) (err error)

AttributesGET is the handler for `GET /v1/attributes`

func (*APIHandler) AttributesPOST added in v0.63.0

func (h *APIHandler) AttributesPOST(c echo.Context) (err error)

AttributesPOST is the handler for `POST /v1/attributes`

func (*APIHandler) EventsGET added in v0.62.0

func (h *APIHandler) EventsGET(c echo.Context) (err error)

EventsGET is the handler for `GET /events`

func (*APIHandler) HealthGET

func (h *APIHandler) HealthGET(c echo.Context) (err error)

HealthGET is the handler for `GET /v1/health`

func (*APIHandler) SeedPOST added in v0.61.0

func (h *APIHandler) SeedPOST(c echo.Context) (err error)

SeedPOST is the handler for `POST /v1/seed`

func (*APIHandler) SpecGET added in v0.87.0

func (h *APIHandler) SpecGET(c echo.Context) (err error)

SpecGET is the handler for `POST /v1/seed`

func (*APIHandler) TagDELETE added in v0.78.0

func (h *APIHandler) TagDELETE(c echo.Context) (err error)

TagDELETE is the handler for `DELETE /v1/tags/{tag_id}`

func (*APIHandler) TagDetailedGET added in v0.78.0

func (h *APIHandler) TagDetailedGET(c echo.Context) (err error)

func (*APIHandler) TagGET added in v0.78.0

func (h *APIHandler) TagGET(c echo.Context) (err error)

TagGET is the handler for `GET /v1/tags/{tag_id}`

func (*APIHandler) TagValueGET added in v0.78.0

func (h *APIHandler) TagValueGET(c echo.Context) (err error)

func (*APIHandler) TagValuePUT added in v0.78.0

func (h *APIHandler) TagValuePUT(c echo.Context) (err error)

func (*APIHandler) TagsDELETE added in v0.78.0

func (h *APIHandler) TagsDELETE(c echo.Context) (err error)

TagsDELETE is the handler for `DELETE /v1/tags`

func (*APIHandler) TagsGET added in v0.78.0

func (h *APIHandler) TagsGET(c echo.Context) (err error)

TagsGET is the handler for `GET /v1/tags`

func (*APIHandler) TagsPOST added in v0.78.0

func (h *APIHandler) TagsPOST(c echo.Context) (err error)

TagsPOST is `POST /tags`

Jump to

Keyboard shortcuts

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