api

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package api implements REST API support for Aptomi, including user-level and admin-level calls. It relies on httprouter to process HTTP requests and serve HTTP responses.

Index

Constants

This section is empty.

Variables

View Source
var EndpointsObject = &runtime.Info{
	Kind:        "endpoints",
	Constructor: func() runtime.Object { return &Endpoints{} },
}

EndpointsObject is an informational data structure with Kind and Constructor for Endpoints

View Source
var (
	// Objects is a list of all objects used in API
	Objects = runtime.AppendAll([]*runtime.Info{
		EndpointsObject,
		PolicyUpdateResultObject,
		VersionObject,
		ServerErrorObject,
	}, lang.PolicyObjects, engine.Objects)
)
View Source
var PolicyUpdateResultObject = &runtime.Info{
	Kind:        "policy-update-result",
	Constructor: func() runtime.Object { return &PolicyUpdateResult{} },
}

PolicyUpdateResultObject is an informational data structure with Kind and Constructor for PolicyUpdateResult

View Source
var ServerErrorObject = &runtime.Info{
	Kind:        "error",
	Constructor: func() runtime.Object { return &ServerError{} },
}

ServerErrorObject contains Info for the Error type

View Source
var VersionObject = &runtime.Info{
	Kind:        "version",
	Constructor: func() runtime.Object { return &Version{} },
}

VersionObject is an informational data structure with Kind and Constructor for Version

Functions

func Serve

func Serve(router *httprouter.Router, store store.Core, externalData *external.Data)

Serve initializes everything needed by REST API and registers all API endpoints in the provided http router

Types

type Endpoints

type Endpoints struct {
	runtime.TypeKind `yaml:",inline"`
	List             map[string]map[string]string
}

Endpoints object represents

type PolicyUpdateResult

type PolicyUpdateResult struct {
	runtime.TypeKind `yaml:",inline"`
	PolicyGeneration runtime.Generation
	Actions          []string
}

PolicyUpdateResult represents results for the policy update request (estimated list of actions to be executed to update existing actual state to the desired state)

type ServerError

type ServerError struct {
	runtime.TypeKind `yaml:",inline"`
	Error            string
}

ServerError represents error that could be returned from the API

func NewServerError

func NewServerError(error string) *ServerError

NewServerError returns instance of the error based on the provided error

type Version

type Version struct {
	runtime.TypeKind  `yaml:",inline"`
	version.BuildInfo `yaml:",inline"`
}

Version represents build info in the API

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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