api

package
v0.0.0-...-b457bc4 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Package api provides the server and structures to respond to Panamax Remote Agent Requests.

Index

Constants

View Source
const (
	API_VERSION = "v1"
	VERSION     = "0.1.0"
)

Variables

This section is empty.

Functions

func NewServer

func NewServer(adapterInst PanamaxAdapter) *martiniServer

NewServer creates an instance of a martini server. The adapterInst parameter is the adapter type the server will use when dispatching requests.

Types

type Deployment

type Deployment struct {
	Count int `json:"count,omitempty"`
}

Deployment structure contains the deployment count for a service.

type Environment

type Environment struct {
	Variable string `json:"variable"`
	Value    string `json:"value"`
}

A Environment is a structure which contains environmental variables. They are equivalent to the -e "Name=Value" on the docker command line.

type Error

type Error struct {
	Code    int
	Message string `json:"message"`
}

Error is an application specific error structure which encapsulates an error code and message.

func NewError

func NewError(code int, msg string) *Error

NewError creates an error instance with the specified code and message.

func (*Error) Error

func (e *Error) Error() string
type Link struct {
	Name  string `json:"name"`
	Alias string `json:"alias"`
}

A Link is equivalent to the docker link command. It contains the named of a service and the desired alias.

type Metadata

type Metadata struct {
	Version string `json:"version"`
	Type    string `json:"type"`
}

Metadata contains informational data about the current adapter.

type PanamaxAdapter

type PanamaxAdapter interface {
	GetServices() ([]*Service, *Error)
	GetService(string) (*Service, *Error)
	CreateServices([]*Service) ([]*Service, *Error)
	UpdateService(*Service) *Error
	DestroyService(string) *Error
}

PanamaxAdapter encapulates the CRUD operations for Services. These methods must be implemented to fulfill the adapter contract.

type Port

type Port struct {
	HostPort      uint16 `json:"hostPort,omitempty"`
	ContainerPort uint16 `json:"containerPort"`
	Protocol      string `json:"protocol,omitempty"`
}

A Port is desribes a docker port mapping.

type Service

type Service struct {
	Id          string         `json:"id"`
	Name        string         `json:"name,omitempty"`
	Source      string         `json:"source,omitempty"`
	Command     string         `json:"command,omitempty"`
	Links       []*Link        `json:"links,omitempty"`
	Ports       []*Port        `json:"ports,omitempty"`
	Expose      []uint16       `json:"expose,omitempty"`
	Environment []*Environment `json:"environment,omitempty"`
	Volumes     []*Volume      `json:"volumes,omitempty"`
	VolumesFrom []*VolumesFrom `json:"volumes_from,omitempty"`
	ActualState string         `json:"actualState,omitempty"`
	Deployment  Deployment     `json:"deployment,omitempty"`
}

A Service describes the information needed to deploy and scale a desired application. The Id is required and the actualState is used to provide status back to the remote agent.

type Volume

type Volume struct {
	HostPath      string `json:"hostPath"`
	ContainerPath string `json:"containerPath"`
}

A Volume is used to mount a host directory into the container and is translated into a -v docker command.

type VolumesFrom

type VolumesFrom struct {
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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