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 ¶
- type App
- type Config
- type Deployment
- type Diagnostics
- type ECSDeploy
- type ErrorInfo
- type Event
- type Hook
- type Hosts
- type RollbackInfo
- type Routing
- type Service
- func (s *Service) Close() error
- func (s *Service) Info() core.Info
- func (s *Service) Inspect(table, id string) any
- func (s *Service) Load(b []byte) error
- func (s *Service) Reset()
- func (s *Service) Resources() []core.Table
- func (s *Service) Save() ([]byte, error)
- func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Service) Tick(now time.Time)
- type Shift
- type Tag
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 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 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.
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.