Help us shape the future of Go! Take the 2026 Go Developer Survey

codedeploy

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package codedeploy emulates AWS CodeDeploy (JSON 1.1): applications, deployment groups, deployment configs and deployments. Lambda deployments run their BeforeAllowTraffic and AfterAllowTraffic hooks and shift an alias' traffic in canary or linear steps, rolling back to the current version on a failed hook, an alarm in ALARM or StopDeployment. ECS blue/green deployments use the same engine (see ecs.go); Server deployments are metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	ApplicationID   string    `json:"applicationId"`
	ApplicationName string    `json:"applicationName"`
	CreateTime      core.Time `json:"createTime"`
	LinkedToGitHub  bool      `json:"linkedToGitHub"`
	ComputePlatform string    `json:"computePlatform"`
}

App is an application.

type Config

type Config struct {
	DeploymentConfigID   string          `json:"deploymentConfigId"`
	DeploymentConfigName string          `json:"deploymentConfigName"`
	MinimumHealthyHosts  *Hosts          `json:"minimumHealthyHosts,omitempty"`
	CreateTime           core.Time       `json:"createTime"`
	ComputePlatform      string          `json:"computePlatform"`
	TrafficRoutingConfig *Routing        `json:"trafficRoutingConfig,omitempty"`
	ZonalConfig          json.RawMessage `json:"zonalConfig,omitempty"`
}

Config is a deployment config.

type Deployment

type Deployment struct {
	ApplicationName          string          `json:"applicationName"`
	DeploymentGroupName      string          `json:"deploymentGroupName"`
	DeploymentConfigName     string          `json:"deploymentConfigName"`
	DeploymentID             string          `json:"deploymentId"`
	Revision                 json.RawMessage `json:"revision,omitempty"`
	Status                   string          `json:"status"`
	ErrorInformation         *ErrorInfo      `json:"errorInformation,omitempty"`
	CreateTime               core.Time       `json:"createTime"`
	StartTime                *core.Time      `json:"startTime,omitempty"`
	CompleteTime             *core.Time      `json:"completeTime,omitempty"`
	DeploymentOverview       map[string]int  `json:"deploymentOverview"`
	Description              string          `json:"description,omitempty"`
	Creator                  string          `json:"creator"`
	RollbackInfo             *RollbackInfo   `json:"rollbackInfo,omitempty"`
	DeploymentStyle          any             `json:"deploymentStyle,omitempty"`
	ComputePlatform          string          `json:"computePlatform"`
	DeploymentStatusMessages []string        `json:"deploymentStatusMessages"`
	Lambda                   *Shift          `json:"lambda,omitempty"` // the progress of a Lambda or ECS deployment
}

Deployment is a deployment in the API's shape, plus the progress of a Lambda deployment.

type Diagnostics

type Diagnostics struct {
	ErrorCode  string `json:"errorCode"`
	ScriptName string `json:"scriptName,omitempty"`
	Message    string `json:"message"`
	LogTail    string `json:"logTail"`
}

Diagnostics says why a lifecycle event failed.

type ECSDeploy added in v0.2.0

type ECSDeploy struct {
	Cluster, Service              string
	TaskDefinition, ContainerName string
	ContainerPort                 int
	PlatformVersion               string
	Network, Capacity             json.RawMessage // in the API's shape, from the AppSpec
	ProdListener, TestListener    string
	Groups                        [2]string     // ARNs of the group's two target groups
	Blue, Green                   string        // target group serving now, and the replacement's; set by Install
	BlueSet, GreenSet             string        // task set IDs, original and replacement
	Keep                          bool          // KEEP_ALIVE: the original task set stays
	Wait                          time.Duration // how long the original task set lives on after the shift
	End                           time.Time     // when the original task set ends; set once traffic has moved
	TestMoved                     bool          // the test listener points at the replacement
}

ECSDeploy is what an ECS deployment knows about its service, listeners and task sets.

type ErrorInfo

type ErrorInfo struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

ErrorInfo says why a deployment failed.

type Event

type Event struct {
	LifecycleEventName string       `json:"lifecycleEventName"`
	Status             string       `json:"status"`
	StartTime          *core.Time   `json:"startTime,omitempty"`
	EndTime            *core.Time   `json:"endTime,omitempty"`
	Diagnostics        *Diagnostics `json:"diagnostics,omitempty"`
}

Event is a lifecycle event of a deployment target.

type Hook

type Hook struct {
	ID      string
	Status  string // Pending | Succeeded | Failed
	Message string
	Started time.Time
}

Hook is an execution of a lifecycle hook function.

type Hosts

type Hosts struct {
	Type  string `json:"type"`
	Value int    `json:"value"`
}

Hosts is how many hosts must stay healthy (Server deployments).

type RollbackInfo

type RollbackInfo struct {
	RollbackMessage string `json:"rollbackMessage"`
}

RollbackInfo says how a deployment was rolled back.

type Routing

type Routing struct {
	Type            string `json:"type"` // AllAtOnce | TimeBasedCanary | TimeBasedLinear
	TimeBasedCanary *struct {
		CanaryPercentage int `json:"canaryPercentage"`
		CanaryInterval   int `json:"canaryInterval"`
	} `json:"timeBasedCanary,omitempty"`
	TimeBasedLinear *struct {
		LinearPercentage int `json:"linearPercentage"`
		LinearInterval   int `json:"linearInterval"`
	} `json:"timeBasedLinear,omitempty"`
}

Routing is how a Lambda or ECS deployment shifts traffic.

type Service

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

Service is the CodeDeploy emulator.

func New

func New(hub *core.Hub) *Service

New creates the CodeDeploy service and starts its clock.

func (*Service) Close

func (s *Service) Close() error

Close stops the clock.

func (*Service) Info

func (s *Service) Info() core.Info

func (*Service) Inspect

func (s *Service) Inspect(table, id string) any

func (*Service) Load

func (s *Service) Load(b []byte) error

func (*Service) Reset

func (s *Service) Reset()

func (*Service) Resources

func (s *Service) Resources() []core.Table

func (*Service) Save

func (s *Service) Save() ([]byte, error)

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Service) Tick

func (s *Service) Tick(now time.Time)

Tick moves deployments along: Server ones succeed, Lambda and ECS ones run their hooks and shift traffic one step per interval.

type Shift

type Shift struct {
	ECS                              *ECSDeploy // set for an ECS deployment; Function and Alias are not used
	Function, Alias, Current, Target string
	Hooks                            map[string]string // lifecycle event → hook function
	Routing                          *Routing
	Alarms                           []string
	Events                           []*Event
	Phase                            int // index of the event in progress
	Weight                           int // percent of traffic on the target version
	Shifted                          time.Time
	Hook                             *Hook // the hook execution in progress
	Updated                          time.Time
}

Shift is a Lambda or ECS deployment's progress: its AppSpec, lifecycle events and how much traffic the target version has.

type Tag

type Tag struct {
	Key   string
	Value string
}

Tag is a resource tag.

Jump to

Keyboard shortcuts

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