api

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: May 30, 2018 License: Apache-2.0 Imports: 24 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 AuthRequestObject = &runtime.Info{
	Kind:        "auth-request",
	Constructor: func() runtime.Object { return &AuthRequest{} },
}

AuthRequestObject contains Info for the AuthRequest type

View Source
var AuthSuccessObject = &runtime.Info{
	Kind:        "auth-success",
	Constructor: func() runtime.Object { return &AuthSuccess{} },
}

AuthSuccessObject contains Info for the AuthSuccess type

View Source
var DependenciesStatusObject = &runtime.Info{
	Kind:        "dependencies-status",
	Constructor: func() runtime.Object { return &DependenciesStatus{} },
}

DependenciesStatusObject is an informational data structure with Kind and Constructor for DependenciesStatus

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

Functions

func Serve

func Serve(router *httprouter.Router, store store.Core, externalData *external.Data, pluginRegistryFactory plugin.RegistryFactory, secret string, logLevel logrus.Level, runEnforcement chan bool)

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

Types

type AuthRequest added in v0.1.8

type AuthRequest struct {
	runtime.TypeKind `yaml:",inline"`
	Username         string
	Password         string
}

AuthRequest represents authentication request

type AuthSuccess added in v0.1.8

type AuthSuccess struct {
	runtime.TypeKind `yaml:",inline"`
	Token            string
}

AuthSuccess represents successful authentication

type Claims added in v0.1.8

type Claims struct {
	Name string `json:"name"`
	jwt.StandardClaims
}

Claims represent Aptomi JWT Claims

func (Claims) Valid added in v0.1.8

func (claims Claims) Valid() error

Valid checks if claims are valid

type DependenciesStatus added in v0.1.14

type DependenciesStatus struct {
	runtime.TypeKind `yaml:",inline"`

	// map containing status by dependency
	Status map[string]*DependencyStatus
}

DependenciesStatus is a struct which holds status information for a set of given dependencies

type DependencyQueryFlag added in v0.1.14

type DependencyQueryFlag string

DependencyQueryFlag determines whether to query just dependency deployment status, or both deployment + readiness/health checks status

const (
	// DependencyQueryDeploymentStatusOnly prescribes only to query dependency deployment status (i.e. actual state = desired state)
	DependencyQueryDeploymentStatusOnly DependencyQueryFlag = "deployed"

	// DependencyQueryDeploymentStatusAndReadiness prescribes to query both dependency deployment status (i.e. actual state = desired state), as well as readiness status (i.e. health checks = passing)
	DependencyQueryDeploymentStatusAndReadiness DependencyQueryFlag = "ready"
)

type DependencyStatus added in v0.1.14

type DependencyStatus struct {
	Found     bool
	Deployed  bool
	Ready     bool
	Endpoints map[string]map[string]string
}

DependencyStatus is a struct which holds status information for an individual dependency

type PolicyUpdateResult

type PolicyUpdateResult struct {
	runtime.TypeKind `yaml:",inline"`
	PolicyGeneration runtime.Generation
	PolicyChanged    bool
	WaitForRevision  runtime.Generation
	PlanAsText       *action.PlanAsText
	EventLog         []*event.APIEvent
}

PolicyUpdateResult represents results of the policy update request, including action plan and event log

func (*PolicyUpdateResult) AsColumns added in v0.1.2

func (result *PolicyUpdateResult) AsColumns() map[string]string

AsColumns returns PolicyUpdateResult representation as columns

func (*PolicyUpdateResult) GetDefaultColumns added in v0.1.2

func (result *PolicyUpdateResult) GetDefaultColumns() []string

GetDefaultColumns returns default set of columns to be displayed

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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