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

codedeploy

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 16 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; Server and ECS 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"`
}

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 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 and ECS ones succeed, Lambda ones run their hooks and shift traffic one step per interval.

type Shift

type Shift struct {
	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 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