Documentation
¶
Overview ¶
Package codedeploy provides an in-memory implementation of the AWS CodeDeploy service.
Index ¶
- Variables
- type Alarm
- type AlarmConfiguration
- type Application
- type ApplicationRevision
- type AutoRollbackConfiguration
- type AutoScalingGroup
- type BlueGreenDeploymentConfiguration
- type Deployment
- type DeploymentConfig
- type DeploymentFilter
- type DeploymentGroup
- type DeploymentGroupInput
- type DeploymentOptions
- type DeploymentReadyOption
- type DeploymentStyle
- type DeploymentTargetRecord
- type ECSService
- type Ec2TagSet
- type ElbInfo
- type GreenFleetProvisioningOption
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type InMemoryBackend
- func (b *InMemoryBackend) AddApplicationInternal(app *Application)
- func (b *InMemoryBackend) AddDeploymentConfigInternal(cfg *DeploymentConfig)
- func (b *InMemoryBackend) AddDeploymentGroupInternal(dg *DeploymentGroup)
- func (b *InMemoryBackend) AddDeploymentInternal(d *Deployment)
- func (b *InMemoryBackend) AddGitHubAccountTokenInternal(name string)
- func (b *InMemoryBackend) AddOnPremisesInstanceInternal(inst *OnPremisesInstance)
- func (b *InMemoryBackend) AddTagsToOnPremisesInstances(instanceNames []string, kv map[string]string) error
- func (b *InMemoryBackend) ApplicationARN(name string) string
- func (b *InMemoryBackend) BatchGetApplicationRevisions(appName string, revisions []RevisionLocation) (map[string]*ApplicationRevision, error)
- func (b *InMemoryBackend) BatchGetApplications(names []string) []*Application
- func (b *InMemoryBackend) BatchGetDeploymentGroups(appName string, dgNames []string) ([]*DeploymentGroup, error)
- func (b *InMemoryBackend) BatchGetDeploymentInstances(deploymentID string, instanceIDs []string) ([]*DeploymentTargetRecord, error)
- func (b *InMemoryBackend) BatchGetDeploymentTargets(deploymentID string, targetIDs []string) ([]*DeploymentTargetRecord, error)
- func (b *InMemoryBackend) BatchGetDeployments(deploymentIDs []string) []*Deployment
- func (b *InMemoryBackend) BatchGetOnPremisesInstances(instanceNames []string) []*OnPremisesInstance
- func (b *InMemoryBackend) ContinueDeployment(deploymentID string) error
- func (b *InMemoryBackend) CreateApplication(name, computePlatform string, kv map[string]string) (*Application, error)
- func (b *InMemoryBackend) CreateDeployment(appName, dgName string, opts DeploymentOptions) (*Deployment, error)
- func (b *InMemoryBackend) CreateDeploymentConfig(name, computePlatform string, minHealthyHosts *MinimumHealthyHosts, ...) (*DeploymentConfig, error)
- func (b *InMemoryBackend) CreateDeploymentGroup(appName, dgName string, input DeploymentGroupInput, kv map[string]string) (*DeploymentGroup, error)
- func (b *InMemoryBackend) DeleteApplication(name string) error
- func (b *InMemoryBackend) DeleteDeploymentConfig(name string) error
- func (b *InMemoryBackend) DeleteDeploymentGroup(appName, dgName string) error
- func (b *InMemoryBackend) DeleteGitHubAccountToken(name string) error
- func (b *InMemoryBackend) DeploymentConfigARN(name string) string
- func (b *InMemoryBackend) DeploymentGroupARN(appName, dgName string) string
- func (b *InMemoryBackend) DeregisterOnPremisesInstance(name string) error
- func (b *InMemoryBackend) GetApplication(name string) (*Application, error)
- func (b *InMemoryBackend) GetApplicationRevision(appName string, revision RevisionLocation) (*ApplicationRevision, error)
- func (b *InMemoryBackend) GetDeployment(deploymentID string) (*Deployment, error)
- func (b *InMemoryBackend) GetDeploymentConfig(name string) (*DeploymentConfig, error)
- func (b *InMemoryBackend) GetDeploymentGroup(appName, dgName string) (*DeploymentGroup, error)
- func (b *InMemoryBackend) GetDeploymentInstance(deploymentID, instanceID string) (*DeploymentTargetRecord, error)
- func (b *InMemoryBackend) GetDeploymentTarget(deploymentID, targetID string) (*DeploymentTargetRecord, error)
- func (b *InMemoryBackend) GetOnPremisesInstance(name string) (*OnPremisesInstance, error)
- func (b *InMemoryBackend) ListApplicationDetails() []*Application
- func (b *InMemoryBackend) ListApplicationRevisions(appName string, filter RevisionListFilter) ([]*ApplicationRevision, error)
- func (b *InMemoryBackend) ListApplications() []string
- func (b *InMemoryBackend) ListDeploymentConfigs() []string
- func (b *InMemoryBackend) ListDeploymentGroupDetails(appName string) ([]*DeploymentGroup, error)
- func (b *InMemoryBackend) ListDeploymentGroups(appName string) ([]string, error)
- func (b *InMemoryBackend) ListDeploymentInstances(deploymentID string) ([]string, error)
- func (b *InMemoryBackend) ListDeploymentTargets(deploymentID string) ([]string, error)
- func (b *InMemoryBackend) ListDeployments(filter DeploymentFilter) []string
- func (b *InMemoryBackend) ListGitHubAccountTokenNames() []string
- func (b *InMemoryBackend) ListOnPremisesInstances(registrationStatus string, tagFilters []TagFilter) []string
- func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) RegisterApplicationRevision(appName string, revision RevisionLocation, description string) error
- func (b *InMemoryBackend) RegisterOnPremisesInstance(name, iamSessionArn, iamUserArn string) error
- func (b *InMemoryBackend) RemoveTagsFromOnPremisesInstances(instanceNames []string, keys []string) error
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) StopDeployment(deploymentID string) error
- func (b *InMemoryBackend) TagResource(resourceARN string, kv map[string]string) error
- func (b *InMemoryBackend) UntagResource(resourceARN string, keys []string) error
- func (b *InMemoryBackend) UpdateApplication(name, newName string) error
- func (b *InMemoryBackend) UpdateDeploymentGroup(appName, currentDGName, newDGName string, input DeploymentGroupInput) (bool, error)
- type LoadBalancerInfo
- type MinimumHealthyHosts
- type OnPremisesInstance
- type Provider
- type RevisionAppSpecContent
- type RevisionGitHubLocation
- type RevisionListFilter
- type RevisionLocation
- type RevisionS3Location
- type TagFilter
- type TagSet
- type TargetGroupInfo
- type TargetGroupPairInfo
- type TerminateBlueInstancesOnDeploymentSuccess
- type TimeBasedCanary
- type TimeBasedLinear
- type TrafficRoute
- type TrafficRoutingConfig
- type TriggerConfiguration
- type ZonalConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = awserr.New("ApplicationDoesNotExistException", awserr.ErrNotFound) ErrDeploymentGroupNotFound = awserr.New("DeploymentGroupDoesNotExistException", awserr.ErrNotFound) ErrDeploymentNotFound = awserr.New("DeploymentDoesNotExistException", awserr.ErrNotFound) ErrAlreadyExists = awserr.New("ApplicationAlreadyExistsException", awserr.ErrConflict) ErrDeploymentGroupAlreadyExists = awserr.New("DeploymentGroupAlreadyExistsException", awserr.ErrConflict) ErrDeploymentConfigNotFound = awserr.New("DeploymentConfigDoesNotExistException", awserr.ErrNotFound) ErrDeploymentConfigAlreadyExists = awserr.New("DeploymentConfigAlreadyExistsException", awserr.ErrConflict) ErrOnPremisesInstanceNotFound = awserr.New("InstanceDoesNotExistException", awserr.ErrNotFound) ErrValidation = awserr.New("InvalidParameterValueException", awserr.ErrInvalidParameter) ErrTagLimitExceeded = awserr.New("TagLimitExceededException", awserr.ErrInvalidParameter) ErrInvalidComputePlatform = awserr.New("InvalidComputePlatformException", awserr.ErrInvalidParameter) ErrIamArnRequired = awserr.New("IamArnRequiredException", awserr.ErrInvalidParameter) ErrMultipleIamArns = awserr.New("MultipleIamArnsProvidedException", awserr.ErrInvalidParameter) ErrDeploymentConfigInUse = awserr.New("DeploymentConfigInUseException", awserr.ErrConflict) ErrGitHubAccountTokenNotFound = awserr.New("GitHubAccountTokenDoesNotExistException", awserr.ErrNotFound) ErrRevisionNotFound = awserr.New("RevisionDoesNotExistException", awserr.ErrNotFound) ErrDeploymentTargetNotFound = awserr.New("DeploymentTargetDoesNotExistException", awserr.ErrNotFound) )
Sentinel errors returned by the CodeDeploy backend, mapped to AWS exception types and HTTP status codes by handler.go's errorMappings table.
var ErrNilAppContext = errors.New("AppContext is required")
ErrNilAppContext is returned when Provider.Init is called with a nil AppContext.
Functions ¶
This section is empty.
Types ¶
type Alarm ¶
type Alarm struct {
Name string `json:"name,omitempty"`
}
Alarm references a CloudWatch alarm.
type AlarmConfiguration ¶
type AlarmConfiguration struct {
Alarms []Alarm `json:"alarms,omitempty"`
Enabled bool `json:"enabled,omitempty"`
IgnorePollAlarmFailure bool `json:"ignorePollAlarmFailure,omitempty"`
}
AlarmConfiguration holds alarm-based stop configuration.
type Application ¶
type Application struct {
CreationTime time.Time `json:"createTime"`
Tags *tags.Tags `json:"-"`
TagsMap map[string]string `json:"tagsMap,omitempty"`
ApplicationName string `json:"applicationName"`
ApplicationID string `json:"applicationId"`
ComputePlatform string `json:"computePlatform"`
AccountID string `json:"-"`
Region string `json:"-"`
}
Application represents an AWS CodeDeploy application.
type ApplicationRevision ¶ added in v1.2.0
type ApplicationRevision struct {
RegisterTime time.Time
FirstUsedTime *time.Time
LastUsedTime *time.Time
ApplicationName string
Description string
Revision RevisionLocation
DeploymentGroups []string
}
ApplicationRevision represents a registered CodeDeploy application revision, keyed by (ApplicationName, Revision) identity. FirstUsedTime/LastUsedTime are nil until the revision is actually referenced by a CreateDeployment call; DeploymentGroups lists the deployment groups this revision is the current target revision for.
type AutoRollbackConfiguration ¶
type AutoRollbackConfiguration struct {
Events []string `json:"events,omitempty"` // rollback event types
Enabled bool `json:"enabled,omitempty"`
}
AutoRollbackConfiguration holds auto-rollback event configuration.
type AutoScalingGroup ¶
type AutoScalingGroup struct {
Name string `json:"name,omitempty"`
Hook string `json:"hook,omitempty"`
}
AutoScalingGroup references an Auto Scaling group for a deployment group.
type BlueGreenDeploymentConfiguration ¶
type BlueGreenDeploymentConfiguration struct {
TerminateBlueInstancesOnDeploymentSuccess *TerminateBlueInstancesOnDeploymentSuccess `json:"terminateBlueInstancesOnDeploymentSuccess,omitempty"` //nolint:lll // long AWS name
DeploymentReadyOption *DeploymentReadyOption `json:"deploymentReadyOption,omitempty"` //nolint:lll // aligned with AWS field above
GreenFleetProvisioningOption *GreenFleetProvisioningOption `json:"greenFleetProvisioningOption,omitempty"` //nolint:lll // aligned with AWS field above
}
BlueGreenDeploymentConfiguration holds blue/green deployment configuration.
type Deployment ¶
type Deployment struct {
CreateTime time.Time `json:"createTime"`
CompleteTime *time.Time `json:"completeTime,omitempty"`
Revision *RevisionLocation `json:"revision,omitempty"`
Status string `json:"status"`
ApplicationName string `json:"applicationName"`
DeploymentGroupName string `json:"deploymentGroupName"`
DeploymentConfigName string `json:"deploymentConfigName"`
DeploymentID string `json:"deploymentId"`
Creator string `json:"creator"`
Description string `json:"description,omitempty"`
FileExistsBehavior string `json:"fileExistsBehavior,omitempty"`
AccountID string `json:"-"`
Region string `json:"-"`
UpdateOutdatedInstancesOnly bool `json:"updateOutdatedInstancesOnly,omitempty"`
IgnoreApplicationStopFailures bool `json:"ignoreApplicationStopFailures,omitempty"`
}
Deployment represents a CodeDeploy deployment.
type DeploymentConfig ¶
type DeploymentConfig struct {
CreateTime time.Time `json:"createTime"`
MinimumHealthyHosts *MinimumHealthyHosts `json:"minimumHealthyHosts,omitempty"`
TrafficRoutingConfig *TrafficRoutingConfig `json:"trafficRoutingConfig,omitempty"`
ZonalConfig *ZonalConfig `json:"zonalConfig,omitempty"`
DeploymentConfigName string `json:"deploymentConfigName"`
DeploymentConfigID string `json:"deploymentConfigId"`
ComputePlatform string `json:"computePlatform"`
IsDefault bool `json:"isDefault,omitempty"`
}
DeploymentConfig represents a CodeDeploy deployment configuration.
type DeploymentFilter ¶
type DeploymentFilter struct {
CreateTimeStart *time.Time
CreateTimeEnd *time.Time
ApplicationName string
DeploymentGroupName string
Statuses []string
}
DeploymentFilter holds optional filters for ListDeployments.
type DeploymentGroup ¶
type DeploymentGroup struct {
Tags *tags.Tags `json:"-"`
TagsMap map[string]string `json:"tagsMap,omitempty"`
BlueGreenDeploymentConfiguration *BlueGreenDeploymentConfiguration `json:"blueGreenDeploymentConfiguration,omitempty"`
AlarmConfiguration *AlarmConfiguration `json:"alarmConfiguration,omitempty"`
AutoRollbackConfiguration *AutoRollbackConfiguration `json:"autoRollbackConfiguration,omitempty"`
LoadBalancerInfo *LoadBalancerInfo `json:"loadBalancerInfo,omitempty"`
DeploymentStyle *DeploymentStyle `json:"deploymentStyle,omitempty"`
Ec2TagSet *Ec2TagSet `json:"ec2TagSet,omitempty"`
OnPremisesTagSet *TagSet `json:"onPremisesTagSet,omitempty"`
ApplicationName string `json:"applicationName"`
DeploymentGroupName string `json:"deploymentGroupName"`
DeploymentGroupID string `json:"deploymentGroupId"`
ServiceRoleArn string `json:"serviceRoleArn"`
DeploymentConfigName string `json:"deploymentConfigName"`
ComputePlatform string `json:"computePlatform"`
OutdatedInstancesStrategy string `json:"outdatedInstancesStrategy,omitempty"`
AccountID string `json:"-"`
Region string `json:"-"`
Ec2TagFilters []TagFilter `json:"ec2TagFilters,omitempty"`
OnPremisesInstanceTagFilters []TagFilter `json:"onPremisesInstanceTagFilters,omitempty"`
AutoScalingGroups []AutoScalingGroup `json:"autoScalingGroups,omitempty"`
TriggerConfigurations []TriggerConfiguration `json:"triggerConfigurations,omitempty"`
ECSServices []ECSService `json:"ecsServices,omitempty"`
TerminationHookEnabled bool `json:"terminationHookEnabled,omitempty"`
}
DeploymentGroup represents a CodeDeploy deployment group.
type DeploymentGroupInput ¶
type DeploymentGroupInput struct {
BlueGreenDeploymentConfiguration *BlueGreenDeploymentConfiguration
AlarmConfiguration *AlarmConfiguration
AutoRollbackConfiguration *AutoRollbackConfiguration
LoadBalancerInfo *LoadBalancerInfo
DeploymentStyle *DeploymentStyle
Ec2TagSet *Ec2TagSet
OnPremisesTagSet *TagSet
ServiceRoleArn string
DeploymentConfigName string
OutdatedInstancesStrategy string
OnPremisesInstanceTagFilters []TagFilter
AutoScalingGroups []AutoScalingGroup
TriggerConfigurations []TriggerConfiguration
ECSServices []ECSService
Ec2TagFilters []TagFilter
TerminationHookEnabled bool
}
DeploymentGroupInput holds all the optional rich fields for CreateDeploymentGroup and UpdateDeploymentGroup.
type DeploymentOptions ¶
type DeploymentOptions struct {
Revision *RevisionLocation
FileExistsBehavior string
Description string
Creator string
UpdateOutdatedInstancesOnly bool
IgnoreApplicationStopFailures bool
}
DeploymentOptions holds optional per-deployment settings.
type DeploymentReadyOption ¶
type DeploymentReadyOption struct {
ActionOnTimeout string `json:"actionOnTimeout,omitempty"` // CONTINUE_DEPLOYMENT | STOP_DEPLOYMENT
WaitTimeInMinutes int `json:"waitTimeInMinutes,omitempty"`
}
DeploymentReadyOption configures behavior when blue/green instances are ready.
type DeploymentStyle ¶
type DeploymentStyle struct {
DeploymentType string `json:"deploymentType,omitempty"` // IN_PLACE | BLUE_GREEN
DeploymentOption string `json:"deploymentOption,omitempty"` // WITH_TRAFFIC_CONTROL | WITHOUT_TRAFFIC_CONTROL
}
DeploymentStyle describes the type and traffic control option for a deployment.
type DeploymentTargetRecord ¶ added in v1.2.0
type DeploymentTargetRecord struct {
LastUpdatedAt time.Time
DeploymentID string
TargetID string
TargetType string // instanceTarget | lambdaTarget | ecsTarget
Status string // TargetStatus enum value
TargetArn string
InstanceLabel string // BLUE | GREEN (instanceTarget only)
ClusterName string // ecsTarget only
ServiceName string // ecsTarget only
}
DeploymentTargetRecord describes one participant (instance/ECS service/Lambda function) in a deployment. It is derived on read from the deployment's real backend state (the owning deployment group's compute platform, on-premises instance tag matching, or configured ECS services) rather than fabricated per-request, and its Status is always mapped from the deployment's own current Status (see targetStatusForDeployment) instead of being hardcoded.
type ECSService ¶
type ECSService struct {
ServiceName string `json:"serviceName,omitempty"`
ClusterName string `json:"clusterName,omitempty"`
}
ECSService references an ECS service for ECS-platform deployments.
type Ec2TagSet ¶
type Ec2TagSet struct {
Ec2TagSetList [][]TagFilter `json:"ec2TagSetList,omitempty"`
}
Ec2TagSet is a list of EC2 tag filter groups combined with AND logic.
type ElbInfo ¶
type ElbInfo struct {
Name string `json:"name,omitempty"`
}
ElbInfo references an ELB for load-balancer-based routing.
type GreenFleetProvisioningOption ¶
type GreenFleetProvisioningOption struct {
Action string `json:"action,omitempty"` // DISCOVER_EXISTING | COPY_AUTO_SCALING_GROUP
}
GreenFleetProvisioningOption configures how replacement instances are provisioned.
type Handler ¶
type Handler struct {
Backend *InMemoryBackend
// contains filtered or unexported fields
}
Handler is the Echo HTTP handler for AWS CodeDeploy operations.
func NewHandler ¶
func NewHandler(backend *InMemoryBackend) *Handler
NewHandler creates a new CodeDeploy handler with a pre-built dispatch table.
func (*Handler) ChaosOperations ¶
ChaosOperations returns all operations that can be fault-injected.
func (*Handler) ChaosRegions ¶
ChaosRegions returns all regions this CodeDeploy instance handles.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase AWS service name for fault rule matching.
func (*Handler) ExtractOperation ¶
ExtractOperation extracts the CodeDeploy operation from the X-Amz-Target header.
func (*Handler) ExtractResource ¶
ExtractResource extracts the application name from the request body.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations returns the list of supported CodeDeploy operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler function.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) Reset ¶
func (h *Handler) Reset()
Reset clears the handler state by delegating to the backend.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a function that matches AWS CodeDeploy requests.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend is the in-memory store for CodeDeploy resources.
deployments, deploymentConfigs, and applicationRevisions carry a real, wire-visible identity field and no live *tags.Tags field, so each registers directly on b.registry as a "clean" *store.Table. applicationRevisions is keyed by a composite appName+canonical-revision-JSON string (see applicationRevisionKey in store_setup.go), with applicationRevisionsByApp replacing a per-application scan for ListApplicationRevisions.
applications, deploymentGroups, and onPremisesInstances each carry a live *tags.Tags field marked json:"-", so each is a "dirty" table (store.New only, NOT store.Register-ed onto b.registry -- see store_setup.go) round-tripped through a DTO wrapper in persistence.go. deploymentGroups was previously nested by application; it flattens to one *store.Table keyed by the composite "appName/dgName" string (see dgKey in store_setup.go), with deploymentGroupsByApp replacing the old map[string]map[string]*DeploymentGroup nesting for per-application scans.
githubTokens is deliberately NOT converted: it is an identity-less set (map[string]struct{}), so there is no *T value for store.Table to key on. It remains a plain map, unchanged by this refactor.
func NewInMemoryBackend ¶
func NewInMemoryBackend(accountID, region string) *InMemoryBackend
NewInMemoryBackend creates a new in-memory CodeDeploy backend with pre-seeded default configs.
func (*InMemoryBackend) AddApplicationInternal ¶
func (b *InMemoryBackend) AddApplicationInternal(app *Application)
AddApplicationInternal adds an application directly to the backend without validation. Used for test seeding only.
func (*InMemoryBackend) AddDeploymentConfigInternal ¶
func (b *InMemoryBackend) AddDeploymentConfigInternal(cfg *DeploymentConfig)
AddDeploymentConfigInternal adds a deployment config directly to the backend without validation. Used for test seeding only.
func (*InMemoryBackend) AddDeploymentGroupInternal ¶
func (b *InMemoryBackend) AddDeploymentGroupInternal(dg *DeploymentGroup)
AddDeploymentGroupInternal adds a deployment group directly to the backend without validation. Used for test seeding only.
func (*InMemoryBackend) AddDeploymentInternal ¶
func (b *InMemoryBackend) AddDeploymentInternal(d *Deployment)
AddDeploymentInternal adds a deployment directly to the backend without validation. Used for test seeding only.
func (*InMemoryBackend) AddGitHubAccountTokenInternal ¶
func (b *InMemoryBackend) AddGitHubAccountTokenInternal(name string)
AddGitHubAccountTokenInternal adds a GitHub token name directly (for test seeding and internal use).
func (*InMemoryBackend) AddOnPremisesInstanceInternal ¶
func (b *InMemoryBackend) AddOnPremisesInstanceInternal(inst *OnPremisesInstance)
AddOnPremisesInstanceInternal adds an on-premises instance directly to the backend. Used for test seeding only.
func (*InMemoryBackend) AddTagsToOnPremisesInstances ¶
func (b *InMemoryBackend) AddTagsToOnPremisesInstances(instanceNames []string, kv map[string]string) error
AddTagsToOnPremisesInstances adds tags to on-premises instances, registering them if needed.
func (*InMemoryBackend) ApplicationARN ¶
func (b *InMemoryBackend) ApplicationARN(name string) string
ApplicationARN builds an ARN for a CodeDeploy application.
func (*InMemoryBackend) BatchGetApplicationRevisions ¶
func (b *InMemoryBackend) BatchGetApplicationRevisions( appName string, revisions []RevisionLocation, ) (map[string]*ApplicationRevision, error)
BatchGetApplicationRevisions validates that the application exists and returns the registered ApplicationRevision for each requested location that is actually registered (revisions never registered are silently omitted from the map, matching the codebase-wide "not found -> omitted" Batch* convention -- see BatchGetApplications/BatchGetDeploymentGroups).
func (*InMemoryBackend) BatchGetApplications ¶
func (b *InMemoryBackend) BatchGetApplications(names []string) []*Application
BatchGetApplications returns application structs for the given names. Names that do not exist are silently omitted (AWS behavior).
func (*InMemoryBackend) BatchGetDeploymentGroups ¶
func (b *InMemoryBackend) BatchGetDeploymentGroups(appName string, dgNames []string) ([]*DeploymentGroup, error)
BatchGetDeploymentGroups returns deployment group info for the given names under an app. Groups that do not exist are silently omitted.
func (*InMemoryBackend) BatchGetDeploymentInstances ¶
func (b *InMemoryBackend) BatchGetDeploymentInstances( deploymentID string, instanceIDs []string, ) ([]*DeploymentTargetRecord, error)
BatchGetDeploymentInstances returns instance-summary information for the given instance IDs. IDs that do not resolve to a real instance target are silently omitted, matching this codebase's Batch* "not found -> omitted" convention.
func (*InMemoryBackend) BatchGetDeploymentTargets ¶
func (b *InMemoryBackend) BatchGetDeploymentTargets( deploymentID string, targetIDs []string, ) ([]*DeploymentTargetRecord, error)
BatchGetDeploymentTargets returns the computed targets matching the given target IDs. IDs that do not resolve to a real target are silently omitted, matching this codebase's Batch* "not found -> omitted" convention.
func (*InMemoryBackend) BatchGetDeployments ¶
func (b *InMemoryBackend) BatchGetDeployments(deploymentIDs []string) []*Deployment
BatchGetDeployments returns deployment structs for the given IDs. Deployment IDs that do not exist are silently omitted.
func (*InMemoryBackend) BatchGetOnPremisesInstances ¶
func (b *InMemoryBackend) BatchGetOnPremisesInstances(instanceNames []string) []*OnPremisesInstance
BatchGetOnPremisesInstances returns on-premises instance info for the given names. Names that do not exist are silently omitted.
func (*InMemoryBackend) ContinueDeployment ¶
func (b *InMemoryBackend) ContinueDeployment(deploymentID string) error
ContinueDeployment marks a blue/green deployment as continuing past the wait point.
func (*InMemoryBackend) CreateApplication ¶
func (b *InMemoryBackend) CreateApplication(name, computePlatform string, kv map[string]string) (*Application, error)
CreateApplication creates a new CodeDeploy application.
func (*InMemoryBackend) CreateDeployment ¶
func (b *InMemoryBackend) CreateDeployment(appName, dgName string, opts DeploymentOptions) (*Deployment, error)
CreateDeployment creates a new deployment.
func (*InMemoryBackend) CreateDeploymentConfig ¶
func (b *InMemoryBackend) CreateDeploymentConfig( name, computePlatform string, minHealthyHosts *MinimumHealthyHosts, trafficRouting *TrafficRoutingConfig, zonalConfig *ZonalConfig, ) (*DeploymentConfig, error)
CreateDeploymentConfig creates a named deployment configuration.
func (*InMemoryBackend) CreateDeploymentGroup ¶
func (b *InMemoryBackend) CreateDeploymentGroup( appName, dgName string, input DeploymentGroupInput, kv map[string]string, ) (*DeploymentGroup, error)
CreateDeploymentGroup creates a deployment group for an application.
func (*InMemoryBackend) DeleteApplication ¶
func (b *InMemoryBackend) DeleteApplication(name string) error
DeleteApplication deletes an application and all its deployment groups.
func (*InMemoryBackend) DeleteDeploymentConfig ¶
func (b *InMemoryBackend) DeleteDeploymentConfig(name string) error
DeleteDeploymentConfig deletes a deployment configuration by name. AWS-default configs (IsDefault=true) cannot be deleted.
func (*InMemoryBackend) DeleteDeploymentGroup ¶
func (b *InMemoryBackend) DeleteDeploymentGroup(appName, dgName string) error
DeleteDeploymentGroup deletes a deployment group.
func (*InMemoryBackend) DeleteGitHubAccountToken ¶
func (b *InMemoryBackend) DeleteGitHubAccountToken(name string) error
DeleteGitHubAccountToken removes a stored GitHub account token name.
func (*InMemoryBackend) DeploymentConfigARN ¶
func (b *InMemoryBackend) DeploymentConfigARN(name string) string
DeploymentConfigARN builds an ARN for a CodeDeploy deployment configuration.
func (*InMemoryBackend) DeploymentGroupARN ¶
func (b *InMemoryBackend) DeploymentGroupARN(appName, dgName string) string
DeploymentGroupARN builds an ARN for a CodeDeploy deployment group.
func (*InMemoryBackend) DeregisterOnPremisesInstance ¶
func (b *InMemoryBackend) DeregisterOnPremisesInstance(name string) error
DeregisterOnPremisesInstance marks an on-premises instance as deregistered.
func (*InMemoryBackend) GetApplication ¶
func (b *InMemoryBackend) GetApplication(name string) (*Application, error)
GetApplication returns an application by name.
func (*InMemoryBackend) GetApplicationRevision ¶ added in v1.2.0
func (b *InMemoryBackend) GetApplicationRevision( appName string, revision RevisionLocation, ) (*ApplicationRevision, error)
GetApplicationRevision returns a registered application revision by its (appName, revision) identity.
func (*InMemoryBackend) GetDeployment ¶
func (b *InMemoryBackend) GetDeployment(deploymentID string) (*Deployment, error)
GetDeployment returns a deployment by ID.
func (*InMemoryBackend) GetDeploymentConfig ¶
func (b *InMemoryBackend) GetDeploymentConfig(name string) (*DeploymentConfig, error)
GetDeploymentConfig returns a deployment configuration by name.
func (*InMemoryBackend) GetDeploymentGroup ¶
func (b *InMemoryBackend) GetDeploymentGroup(appName, dgName string) (*DeploymentGroup, error)
GetDeploymentGroup returns a deployment group by application and group name.
func (*InMemoryBackend) GetDeploymentInstance ¶ added in v1.2.0
func (b *InMemoryBackend) GetDeploymentInstance(deploymentID, instanceID string) (*DeploymentTargetRecord, error)
GetDeploymentInstance returns instance-summary information for a single instance participating in a deployment.
func (*InMemoryBackend) GetDeploymentTarget ¶ added in v1.2.0
func (b *InMemoryBackend) GetDeploymentTarget(deploymentID, targetID string) (*DeploymentTargetRecord, error)
GetDeploymentTarget returns a single computed deployment target by ID.
func (*InMemoryBackend) GetOnPremisesInstance ¶
func (b *InMemoryBackend) GetOnPremisesInstance(name string) (*OnPremisesInstance, error)
GetOnPremisesInstance returns an on-premises instance by name.
func (*InMemoryBackend) ListApplicationDetails ¶
func (b *InMemoryBackend) ListApplicationDetails() []*Application
ListApplicationDetails returns all applications as structs.
func (*InMemoryBackend) ListApplicationRevisions ¶ added in v1.2.0
func (b *InMemoryBackend) ListApplicationRevisions( appName string, filter RevisionListFilter, ) ([]*ApplicationRevision, error)
ListApplicationRevisions returns registered revisions for an application, filtered and sorted per filter.
func (*InMemoryBackend) ListApplications ¶
func (b *InMemoryBackend) ListApplications() []string
ListApplications returns all application names in sorted order.
func (*InMemoryBackend) ListDeploymentConfigs ¶
func (b *InMemoryBackend) ListDeploymentConfigs() []string
ListDeploymentConfigs returns all deployment config names in sorted order.
func (*InMemoryBackend) ListDeploymentGroupDetails ¶
func (b *InMemoryBackend) ListDeploymentGroupDetails(appName string) ([]*DeploymentGroup, error)
ListDeploymentGroupDetails returns all deployment groups for an application.
func (*InMemoryBackend) ListDeploymentGroups ¶
func (b *InMemoryBackend) ListDeploymentGroups(appName string) ([]string, error)
ListDeploymentGroups returns all deployment group names for an application in sorted order.
func (*InMemoryBackend) ListDeploymentInstances ¶ added in v1.2.0
func (b *InMemoryBackend) ListDeploymentInstances(deploymentID string) ([]string, error)
ListDeploymentInstances returns instance IDs for a Server/Lambda-platform deployment (ECS deployments have no per-instance concept and always resolve to an empty list here, matching the legacy API's EC2/On-premises + Lambda scope).
func (*InMemoryBackend) ListDeploymentTargets ¶ added in v1.2.0
func (b *InMemoryBackend) ListDeploymentTargets(deploymentID string) ([]string, error)
ListDeploymentTargets returns the sorted target IDs participating in a deployment.
func (*InMemoryBackend) ListDeployments ¶
func (b *InMemoryBackend) ListDeployments(filter DeploymentFilter) []string
ListDeployments returns deployment IDs in sorted order, filtered by the provided criteria.
func (*InMemoryBackend) ListGitHubAccountTokenNames ¶
func (b *InMemoryBackend) ListGitHubAccountTokenNames() []string
ListGitHubAccountTokenNames returns all stored GitHub account token names.
func (*InMemoryBackend) ListOnPremisesInstances ¶
func (b *InMemoryBackend) ListOnPremisesInstances(registrationStatus string, tagFilters []TagFilter) []string
ListOnPremisesInstances returns instance names, optionally filtered by registration status and tag filters.
func (*InMemoryBackend) ListTagsForResource ¶
func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
ListTagsForResource returns the tags for a resource (application or deployment group) by ARN.
func (*InMemoryBackend) Region ¶
func (b *InMemoryBackend) Region() string
Region returns the AWS region this backend is configured for.
func (*InMemoryBackend) RegisterApplicationRevision ¶ added in v1.2.0
func (b *InMemoryBackend) RegisterApplicationRevision( appName string, revision RevisionLocation, description string, ) error
RegisterApplicationRevision registers (or re-registers) a revision for an application. Re-registering an already-known revision refreshes its description (when a non-empty one is supplied) but preserves the original RegisterTime, matching real CodeDeploy's "registering an already-registered revision is a no-op besides the description" behavior.
func (*InMemoryBackend) RegisterOnPremisesInstance ¶
func (b *InMemoryBackend) RegisterOnPremisesInstance(name, iamSessionArn, iamUserArn string) error
RegisterOnPremisesInstance registers a new on-premises instance. Exactly one of iamSessionArn or iamUserArn must be set.
func (*InMemoryBackend) RemoveTagsFromOnPremisesInstances ¶
func (b *InMemoryBackend) RemoveTagsFromOnPremisesInstances(instanceNames []string, keys []string) error
RemoveTagsFromOnPremisesInstances removes tag keys from the given on-premises instances.
func (*InMemoryBackend) Reset ¶
func (b *InMemoryBackend) Reset()
Reset clears all state, returning the backend to a fresh empty state (with default configs re-seeded).
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore loads backend state from a JSON snapshot produced by Snapshot.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises the backend state to JSON. Returns nil on marshal failure.
func (*InMemoryBackend) StopDeployment ¶
func (b *InMemoryBackend) StopDeployment(deploymentID string) error
StopDeployment marks a deployment as Stopped.
func (*InMemoryBackend) TagResource ¶
func (b *InMemoryBackend) TagResource(resourceARN string, kv map[string]string) error
TagResource adds tags to a resource (application or deployment group) by ARN.
func (*InMemoryBackend) UntagResource ¶
func (b *InMemoryBackend) UntagResource(resourceARN string, keys []string) error
UntagResource removes tags from a resource (application or deployment group) by ARN.
func (*InMemoryBackend) UpdateApplication ¶
func (b *InMemoryBackend) UpdateApplication(name, newName string) error
UpdateApplication renames a CodeDeploy application, updating all referencing deployment groups and deployments.
func (*InMemoryBackend) UpdateDeploymentGroup ¶
func (b *InMemoryBackend) UpdateDeploymentGroup( appName, currentDGName, newDGName string, input DeploymentGroupInput, ) (bool, error)
UpdateDeploymentGroup updates a deployment group, optionally renaming it. Returns true if alarms or triggers were removed (hooksNotCleanedUp).
type LoadBalancerInfo ¶
type LoadBalancerInfo struct {
ElbInfoList []ElbInfo `json:"elbInfoList,omitempty"`
TargetGroupInfoList []TargetGroupInfo `json:"targetGroupInfoList,omitempty"`
TargetGroupPairInfoList []TargetGroupPairInfo `json:"targetGroupPairInfoList,omitempty"`
}
LoadBalancerInfo holds load balancer configuration for a deployment group.
type MinimumHealthyHosts ¶
type MinimumHealthyHosts struct {
Type string `json:"type,omitempty"` // HOST_COUNT | FLEET_PERCENT
Value int `json:"value,omitempty"`
}
MinimumHealthyHosts specifies the minimum number/percentage of healthy instances.
type OnPremisesInstance ¶
type OnPremisesInstance struct {
RegisterTime time.Time `json:"registerTime"`
DeregisterTime *time.Time `json:"deregisterTime,omitempty"`
Tags *tags.Tags `json:"-"`
TagsMap map[string]string `json:"tagsMap,omitempty"`
InstanceName string `json:"instanceName"`
IamSessionArn string `json:"iamSessionArn,omitempty"`
IamUserArn string `json:"iamUserArn,omitempty"`
}
OnPremisesInstance represents an on-premises instance registered with CodeDeploy.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for AWS CodeDeploy.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the CodeDeploy service backend and handler.
type RevisionAppSpecContent ¶
type RevisionAppSpecContent struct {
Content string `json:"content,omitempty"`
Sha256 string `json:"sha256,omitempty"`
}
RevisionAppSpecContent holds the AppSpec content for a string/AppSpecContent revision.
type RevisionGitHubLocation ¶
type RevisionGitHubLocation struct {
Repository string `json:"repository,omitempty"`
CommitID string `json:"commitId,omitempty"`
}
RevisionGitHubLocation holds the GitHub location fields for a deployment revision.
type RevisionListFilter ¶ added in v1.2.0
type RevisionListFilter struct {
Deployed string // include | exclude | ignore
S3Bucket string
S3KeyPrefix string
SortBy string // registerTime | firstUsedTime | lastUsedTime
SortOrder string // ascending | descending
}
RevisionListFilter holds the optional filter/sort fields for ListApplicationRevisions.
type RevisionLocation ¶
type RevisionLocation struct {
S3Location *RevisionS3Location `json:"s3Location,omitempty"`
GitHubLocation *RevisionGitHubLocation `json:"gitHubLocation,omitempty"`
AppSpecContent *RevisionAppSpecContent `json:"appSpecContent,omitempty"`
RevisionType string `json:"revisionType,omitempty"`
}
RevisionLocation represents a deployment revision source location.
type RevisionS3Location ¶
type RevisionS3Location struct {
Bucket string `json:"bucket,omitempty"`
Key string `json:"key,omitempty"`
BundleType string `json:"bundleType,omitempty"`
ETag string `json:"eTag,omitempty"`
Version string `json:"version,omitempty"`
}
RevisionS3Location holds the S3 location fields for a deployment revision.
type TagFilter ¶
type TagFilter struct {
Key string `json:"Key,omitempty"`
Value string `json:"Value,omitempty"`
Type string `json:"Type,omitempty"` // EQUALS | KEY_ONLY | VALUE_ONLY
}
TagFilter represents a key/value tag filter for on-premises or EC2 instances.
type TagSet ¶
type TagSet struct {
OnPremisesTagSetList [][]TagFilter `json:"onPremisesTagSetList,omitempty"`
}
TagSet is a list of tag filters combined with AND logic.
type TargetGroupInfo ¶
type TargetGroupInfo struct {
Name string `json:"name,omitempty"`
}
TargetGroupInfo references a target group for ALB/NLB routing.
type TargetGroupPairInfo ¶
type TargetGroupPairInfo struct {
ProdTrafficRoute *TrafficRoute `json:"prodTrafficRoute,omitempty"`
TestTrafficRoute *TrafficRoute `json:"testTrafficRoute,omitempty"`
TargetGroups []TargetGroupInfo `json:"targetGroups,omitempty"`
}
TargetGroupPairInfo is an ALB/NLB target group pair for blue/green deployments.
type TerminateBlueInstancesOnDeploymentSuccess ¶
type TerminateBlueInstancesOnDeploymentSuccess struct {
Action string `json:"action,omitempty"` // TERMINATE | KEEP_ALIVE
TerminationWaitTimeInMinutes int `json:"terminationWaitTimeInMinutes,omitempty"`
}
TerminateBlueInstancesOnDeploymentSuccess holds blue-instance termination config.
type TimeBasedCanary ¶
type TimeBasedCanary struct {
CanaryPercentage int `json:"canaryPercentage,omitempty"`
CanaryInterval int `json:"canaryInterval,omitempty"`
}
TimeBasedCanary holds canary traffic shifting configuration.
type TimeBasedLinear ¶
type TimeBasedLinear struct {
LinearPercentage int `json:"linearPercentage,omitempty"`
LinearInterval int `json:"linearInterval,omitempty"`
}
TimeBasedLinear holds linear traffic shifting configuration.
type TrafficRoute ¶
type TrafficRoute struct {
ListenerArns []string `json:"listenerArns,omitempty"`
}
TrafficRoute specifies a listener ARN for traffic routing.
type TrafficRoutingConfig ¶
type TrafficRoutingConfig struct {
TimeBasedCanary *TimeBasedCanary `json:"timeBasedCanary,omitempty"`
TimeBasedLinear *TimeBasedLinear `json:"timeBasedLinear,omitempty"`
Type string `json:"type,omitempty"`
}
TrafficRoutingConfig holds traffic routing configuration for a deployment config.
type TriggerConfiguration ¶
type TriggerConfiguration struct {
TriggerName string `json:"triggerName,omitempty"`
TriggerTargetArn string `json:"triggerTargetArn,omitempty"`
TriggerEvents []string `json:"triggerEvents,omitempty"`
}
TriggerConfiguration holds SNS trigger configuration for deployment events.
type ZonalConfig ¶
type ZonalConfig struct {
MinimumHealthyHostsPerZone *MinimumHealthyHosts `json:"minimumHealthyHostsPerZone,omitempty"`
FirstZoneMonitorDurationInSeconds int `json:"firstZoneMonitorDurationInSeconds,omitempty"`
MonitorDurationInSeconds int `json:"monitorDurationInSeconds,omitempty"`
}
ZonalConfig holds availability-zone-based deployment configuration.
Source Files
¶
- application_revisions.go
- applications.go
- deployment_configs.go
- deployment_groups.go
- deployment_instances.go
- deployments.go
- errors.go
- github_tokens.go
- handler.go
- handler_application_revisions.go
- handler_applications.go
- handler_deployment_configs.go
- handler_deployment_groups.go
- handler_deployment_instances.go
- handler_deployments.go
- handler_github_tokens.go
- handler_lifecycle_hooks.go
- handler_on_premises_instances.go
- handler_tags.go
- models.go
- on_premises_instances.go
- persistence.go
- provider.go
- store.go
- store_setup.go
- tags.go