api

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(ctx context.Context) error

Close represents the graceful shutting down of the http server

func CreateAndInitialiseDatasetAPI

func CreateAndInitialiseDatasetAPI(ctx context.Context, cfg config.Configuration, hc *healthcheck.HealthCheck, dataStore store.DataStore, urlBuilder *url.Builder, errorChan chan error, downloadGenerator DownloadsGenerator, auditor Auditor, datasetPermissions AuthHandler, permissions AuthHandler)

CreateAndInitialiseDatasetAPI create a new DatasetAPI instance based on the configuration provided, apply middleware and starts the HTTP server.

Types

type API

type API interface {
	CreateDatasetAPI(string, *mux.Router, store.DataStore) *DatasetAPI
}

API provides an interface for the routes

type Auditor

type Auditor audit.AuditorService

Auditor is an alias for the auditor service

type AuthHandler

type AuthHandler interface {
	Require(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc
}

AuthHandler provides authorisation checks on requests

type DatasetAPI

type DatasetAPI struct {
	EnablePrePublishView bool
	Router               *mux.Router
	// contains filtered or unexported fields
}

DatasetAPI manages importing filters against a dataset

func NewDatasetAPI

func NewDatasetAPI(ctx context.Context, cfg config.Configuration, router *mux.Router, dataStore store.DataStore, urlBuilder *url.Builder, downloadGenerator DownloadsGenerator, auditor Auditor, datasetPermissions AuthHandler, permissions AuthHandler) *DatasetAPI

NewDatasetAPI create a new Dataset API instance and register the API routes based on the application configuration.

type DownloadsGenerator

type DownloadsGenerator interface {
	Generate(ctx context.Context, datasetID, instanceID, edition, version string) error
}

DownloadsGenerator pre generates full file downloads for the specified dataset/edition/version

type PublishCheck

type PublishCheck struct {
	Datastore store.Storer
	Auditor   audit.AuditorService
}

PublishCheck Checks if an version has been published

func (*PublishCheck) Check

func (d *PublishCheck) Check(handle func(http.ResponseWriter, *http.Request), action string) http.HandlerFunc

Check wraps a HTTP handle. Checks that the state is not published

type VersionDetails

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

VersionDetails contains the details that uniquely identify a version resource

Jump to

Keyboard shortcuts

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