controller

package
v0.0.0-...-0557d4e Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2018 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetDeploymentForDeviceQueryArtifact   = "artifact_name"
	GetDeploymentForDeviceQueryDeviceType = "device_type"
)

Variables

View Source
var (
	ErrIDNotUUIDv4                = errors.New("ID is not UUIDv4")
	ErrDeploymentID               = errors.New("Invalid deployment ID")
	ErrInternal                   = errors.New("Internal error")
	ErrDeploymentAlreadyFinished  = errors.New("Deployment already finished")
	ErrUnexpectedDeploymentStatus = errors.New("Unexpected deployment status")
	ErrMissingIdentity            = errors.New("Missing identity data")
	ErrNoArtifact                 = errors.New("No artifact for the deployment")
)

Errors

View Source
var (
	ErrModelMissingInput       = errors.New("Missing input deployment data")
	ErrModelInvalidDeviceID    = errors.New("Invalid device ID")
	ErrModelDeploymentNotFound = errors.New("Deployment not found")
	ErrModelInternal           = errors.New("Internal error")
	ErrStorageInvalidLog       = errors.New("Invalid deployment log")
	ErrStorageNotFound         = errors.New("Not found")
	ErrDeploymentAborted       = errors.New("Deployment aborted")
	ErrDeviceDecommissioned    = errors.New("Device decommissioned")
)

Errors

View Source
var (
	ErrBadStatus = errors.New("unknown status value")
)

Functions

func ParseLookupQuery

func ParseLookupQuery(vals url.Values) (deployments.Query, error)

Types

type DeploymentsController

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

func NewDeploymentsController

func NewDeploymentsController(model DeploymentsModel, view RESTView) *DeploymentsController

func (*DeploymentsController) AbortDeployment

func (d *DeploymentsController) AbortDeployment(w rest.ResponseWriter, r *rest.Request)

func (*DeploymentsController) DecommissionDevice

func (d *DeploymentsController) DecommissionDevice(w rest.ResponseWriter, r *rest.Request)

func (*DeploymentsController) GetDeployment

func (d *DeploymentsController) GetDeployment(w rest.ResponseWriter, r *rest.Request)

func (*DeploymentsController) GetDeploymentForDevice

func (d *DeploymentsController) GetDeploymentForDevice(w rest.ResponseWriter, r *rest.Request)

func (*DeploymentsController) GetDeploymentLogForDevice

func (d *DeploymentsController) GetDeploymentLogForDevice(w rest.ResponseWriter, r *rest.Request)

func (*DeploymentsController) GetDeploymentStats

func (d *DeploymentsController) GetDeploymentStats(w rest.ResponseWriter, r *rest.Request)

func (*DeploymentsController) GetDeviceStatusesForDeployment

func (d *DeploymentsController) GetDeviceStatusesForDeployment(w rest.ResponseWriter, r *rest.Request)

func (*DeploymentsController) LookupDeployment

func (d *DeploymentsController) LookupDeployment(w rest.ResponseWriter, r *rest.Request)

func (*DeploymentsController) PostDeployment

func (d *DeploymentsController) PostDeployment(w rest.ResponseWriter, r *rest.Request)

func (*DeploymentsController) PutDeploymentLogForDevice

func (d *DeploymentsController) PutDeploymentLogForDevice(w rest.ResponseWriter, r *rest.Request)

func (*DeploymentsController) PutDeploymentStatusForDevice

func (d *DeploymentsController) PutDeploymentStatusForDevice(w rest.ResponseWriter, r *rest.Request)

type DeploymentsModel

type DeploymentsModel interface {
	CreateDeployment(ctx context.Context,
		constructor *deployments.DeploymentConstructor) (string, error)
	GetDeployment(ctx context.Context, deploymentID string) (*deployments.Deployment, error)
	IsDeploymentFinished(ctx context.Context, deploymentID string) (bool, error)
	AbortDeployment(ctx context.Context, deploymentID string) error
	GetDeploymentStats(ctx context.Context, deploymentID string) (deployments.Stats, error)
	GetDeploymentForDeviceWithCurrent(ctx context.Context, deviceID string,
		current deployments.InstalledDeviceDeployment) (*deployments.DeploymentInstructions, error)
	HasDeploymentForDevice(ctx context.Context, deploymentID string,
		deviceID string) (bool, error)
	UpdateDeviceDeploymentStatus(ctx context.Context, deploymentID string,
		deviceID string, status deployments.DeviceDeploymentStatus) error
	GetDeviceStatusesForDeployment(ctx context.Context,
		deploymentID string) ([]deployments.DeviceDeployment, error)
	LookupDeployment(ctx context.Context,
		query deployments.Query) ([]*deployments.Deployment, error)
	SaveDeviceDeploymentLog(ctx context.Context, deviceID string,
		deploymentID string, logs []deployments.LogMessage) error
	GetDeviceDeploymentLog(ctx context.Context,
		deviceID, deploymentID string) (*deployments.DeploymentLog, error)
	DecommissionDevice(ctx context.Context, deviceID string) error
}

Domain model for deployment

type RESTView

type RESTView interface {
	RenderNoUpdateForDevice(w rest.ResponseWriter)
	RenderSuccessPost(w rest.ResponseWriter, r *rest.Request, id string)
	RenderSuccessGet(w rest.ResponseWriter, object interface{})
	RenderEmptySuccessResponse(w rest.ResponseWriter)
	RenderError(w rest.ResponseWriter, r *rest.Request, err error, status int, l *log.Logger)
	RenderInternalError(w rest.ResponseWriter, r *rest.Request, err error, l *log.Logger)
	RenderErrorNotFound(w rest.ResponseWriter, r *rest.Request, l *log.Logger)
	RenderDeploymentLog(w rest.ResponseWriter, dlog deployments.DeploymentLog)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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