agent

package
v0.0.0-...-ccbff5b 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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentMetadata

type AgentMetadata struct {
	Version string `json:"version"`
}

AgentMetadata contains metadata specifically for the Agent.

type Deployment

type Deployment struct {
	ID         int
	Name       string
	ServiceIDs string
	Template   string
}

Deployment represents a stored deployment.

type DeploymentBlueprint

type DeploymentBlueprint struct {
	Override Template `json:"override,omitempty"`
	Template Template `json:"template,omitempty"`
}

A DeploymentBlueprint is the top level entity, containing all the necessary bits to kick off a deployment.

func (*DeploymentBlueprint) MergedImages

func (d *DeploymentBlueprint) MergedImages() []Image

MergedImages merges the Override on top of the Template, returning the resulting merged Images to be used for deployment.

type DeploymentResponseFull

type DeploymentResponseFull struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	Redeployable bool   `json:"redeployable"`
	Status       Status `json:"status"`
}

DeploymentResponseFull is the robust representation of a Deployment typically used for the return value of an individual deployment, etc.

type DeploymentResponseLite

type DeploymentResponseLite struct {
	ID           int      `json:"id"`
	Name         string   `json:"name"`
	Redeployable bool     `json:"redeployable"`
	ServiceIDs   []string `json:"service_ids"`
}

DeploymentResponseLite is the minimal representation of a Deployment typically used for listings, etc.

type DeploymentSettings

type DeploymentSettings struct {
	Count FromIntOrString `json:"count,omitempty"`
}

DeploymentSettings contains orchestrator specific information to be used when deploying an application.

type DeploymentStore

type DeploymentStore interface {
	FindByID(int) (Deployment, error)
	All() ([]Deployment, error)
	Save(*Deployment) error
	Remove(int) error
}

DeploymentStore is an interface that can persist information for an agent about deployments.

type Environment

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

Environment represents each environment variable that will be passed to the Docker run command.

type FromIntOrString

type FromIntOrString struct {
	Value int
}

FromIntOrString allows source JSON to provide either an int or a string and have it be unmarshalled to an int.

func (FromIntOrString) MarshalJSON

func (i FromIntOrString) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface.

func (*FromIntOrString) UnmarshalJSON

func (i *FromIntOrString) UnmarshalJSON(value []byte) error

UnmarshalJSON implements the json.Unmarshaller interface.

type Image

type Image struct {
	Name        string
	Source      string
	Command     string
	Deployment  DeploymentSettings
	Links       []Link
	Environment []Environment
	Ports       []Port
	Expose      []FromIntOrString
	Volumes     []Volume
	VolumesFrom []string
}

An Image ultimately represents the deployed Docker image.

func (Image) MarshalJSON

func (img Image) MarshalJSON() ([]byte, error)

MarshalJSON is used to strip out empty/default value structs when marshalling images to JSON.

type Link struct {
	Service string `json:"service,omitempty"`
	Alias   string `json:"alias,omitempty"`
}

Link represents each Link that will be passed to the Docker run command.

func (Link) MarshalJSON

func (ln Link) MarshalJSON() ([]byte, error)

MarshalJSON produces the JSON expected by the adapter Which is different than the json sent by the client

type Manager

type Manager interface {
	ListDeployments() ([]DeploymentResponseLite, error)
	GetFullDeployment(int) (DeploymentResponseFull, error)
	GetDeployment(int) (DeploymentResponseLite, error)
	DeleteDeployment(int) error
	CreateDeployment(DeploymentBlueprint) (DeploymentResponseLite, error)
	ReDeploy(int) (DeploymentResponseLite, error)
	FetchMetadata() (Metadata, error)
}

A Manager is responsible for coordinating deployment related use cases.

func MakeDeploymentManager

func MakeDeploymentManager(s DeploymentStore, c adapter.Client, v string) Manager

MakeDeploymentManager returns a deploymentManager hydrated with a persister and adapter client.

type Metadata

type Metadata struct {
	Agent   AgentMetadata `json:"agent"`
	Adapter interface{}   `json:"adapter"`
}

Metadata contains general meta data for both the Agent and the Adapter.

type Port

type Port struct {
	HostPort      FromIntOrString `json:"host_port,omitempty"`
	ContainerPort FromIntOrString `json:"container_port,omitempty"`
}

Port represents each Port mapping that will be passed to the Docker run command.

func (Port) MarshalJSON

func (p Port) MarshalJSON() ([]byte, error)

MarshalJSON produces the JSON expected by the adapter Which is different than the json sent by the client

type Service

type Service struct {
	ID          string `json:"id"`
	ActualState string `json:"actualState"`
}

Service represents each service in a Deployment and contains the ID, as well as its state.

type Status

type Status struct {
	Services []Service `json:"services"`
}

Status contains information for health of each service in a Deployment.

type Template

type Template struct {
	Name   string  `json:"name,omitempty"`
	Images []Image `json:"images,omitempty"`
}

A Template is the 2nd level entity in the DeploymentBlueprint scheme. It contains all the necessary information for a deployment post override logic.

type Volume

type Volume struct {
	ContainerPath string `json:"container_path"`
	HostPath      string `json:"host_path"`
}

A Volume represents each Volume mapping that will be passed to the Docker run command.

func (Volume) MarshalJSON

func (v Volume) MarshalJSON() ([]byte, error)

MarshalJSON produces the JSON expected by the adapter Which is different than the json sent by the client

Jump to

Keyboard shortcuts

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