opsworks

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 19 Imported by: 0

README

OpsWorks

Parity grade: B · SDK aws-sdk-go-v2/service/opsworks@v1.31.0 · last audited 2026-08-15 (5f0e2722b)

Coverage

Metric Value
PARITY entries audited 32 (32 ok)
Feature families 9 (9 ok)
Known gaps 5
Deferred items 1
Resource leaks clean
Known gaps
  • ElasticLoadBalancer responses omit AvailabilityZones/Ec2InstanceIds/SubnetIds/VpcId -- all real, optional types.ElasticLoadBalancer members, but this backend's ElasticLoadBalancer domain struct has no VPC/subnet/EC2-instance concept at all to source them from (only ElasticLoadBalancerName/Region/DNSName/StackID/LayerID are tracked). Structural, same class as the App/Layer/Instance optional-surface gaps below, not fixed this pass (gopherstack-6flj).
  • RdsDbInstance responses still omit Engine and MissingOnRds (DbPassword is now fixed, see ops.RdsDbInstance -- gopherstack-4uhx). Both remaining fields are real (optional) members of types.RdsDbInstance, but neither has a source: Engine is not a RegisterRdsDbInstance input member at all (nothing to derive it from without inventing a value), and MissingOnRds requires simulated drift detection against a real RDS instance's existence, which is a cross-service concern this package has no model for (this backend does not talk to services/rds). Both are genuinely structural, not a scope choice -- modeling them would require either fabricating data (banned) or wiring opsworks to query the rds service backend by ARN, which is out of services/opsworks's bounds.
  • FIXED 2026-08-23 (batch14): AssignVolume's required VolumeId member (RegisterVolume's own required StackId was fixed in gopherstack-4uhx, see families.Volume) is now pre-validated for emptiness -- an empty VolumeId now returns ValidationException instead of falling through to the volume-lookup's ResourceNotFoundException. Confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_AssignVolume.go / validateOpAssignVolumeInput (VolumeId required, InstanceId not). TestAssignVolumeValidation (volumes_test.go), hand-reverted to confirm it fails with 404 ResourceNotFoundException pre-fix.
  • No test/integration/*_parity_test.go suite exists for opsworks (the deprecated SDK isn't a go.mod dependency, so a client-driven integration test needs either vendoring it or hand-rolling raw HTTP requests in the integration-test harness style). This is why overall stays at B rather than A per the gopherstack-parity-audit skill's rubric, even though this pass's live-HTTP verification covered all 73 ops. Building that suite is a real, nontrivial follow-on task, not done this pass.
  • Error responses (handleError, all branches) are sent with Content-Type: application/json rather than application/x-amz-json-1.1, unlike success responses which correctly get the awsjson1.1 content type from service.HandleTarget. Confirmed harmless for a real aws-sdk-go-v2 client -- deserializers.go's awsAwsjson11_deserializeOpError* functions key off the X-Amzn-ErrorType header and the body's __type/message fields, never Content-Type -- but it's still a wire divergence from a real server. This is a repo-wide pattern (shared by roughly half the awsjson1.1 services grepped, not opsworks-specific), so left unfixed here as out of this pass's bounded scope.
Deferred
  • CreateStack's VpcId/Attributes/ConfigurationManager/ChefConfiguration are now modeled (gopherstack-4uhx), but the rest of CreateStack's optional surface (AgentVersion, CustomCookbooksSource, CustomJson, DefaultAvailabilityZone, DefaultOs, DefaultRootDeviceType, DefaultSshKeyName, DefaultSubnetId, HostnameTheme, UseCustomCookbooks, UseOpsworksSecurityGroups) is not, and CreateLayer/CreateApp/CreateInstance's full optional surfaces (CloudWatchLogsConfiguration, LifecycleEventConfiguration, VolumeConfigurations, AppSource, DataSources, Environment, SslConfiguration, BlockDeviceMappings, etc.) remain entirely unmodeled -- only the fields this backend's Handler already decodes were audited for wire-shape correctness.

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrStackNotFound is returned when a stack does not exist.
	ErrStackNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrLayerNotFound is returned when a layer does not exist.
	ErrLayerNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrInstanceNotFound is returned when an instance does not exist.
	ErrInstanceNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrAppNotFound is returned when an app does not exist.
	ErrAppNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrDeploymentNotFound is returned when a deployment does not exist.
	ErrDeploymentNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrCommandNotFound is returned when a command does not exist.
	ErrCommandNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrUserProfileNotFound is returned when a user profile does not exist.
	ErrUserProfileNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrElasticLBNotFound is returned when an ELB is not found.
	ErrElasticLBNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrElasticIPNotFound is returned when an elastic IP is not found.
	ErrElasticIPNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrVolumeNotFound is returned when a volume is not found.
	ErrVolumeNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrRdsDBInstanceNotFound is returned when an RDS DB instance is not found.
	ErrRdsDBInstanceNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrEcsClusterNotFound is returned when an ECS cluster is not found.
	ErrEcsClusterNotFound = awserr.New(errResourceNotFound, awserr.ErrNotFound)
	// ErrValidation is returned on invalid input.
	ErrValidation = awserr.New(errValidation, awserr.ErrInvalidParameter)
)
View Source
var ErrNilAppContext = errors.New("opsworks: nil app context")

ErrNilAppContext is returned when Init is called with a nil AppContext.

Functions

This section is empty.

Types

type AgentVersion

type AgentVersion struct {
	ConfigurationManager *ConfigurationManager
	Version              string
}

AgentVersion describes an OpsWorks agent version.

type App

type App struct {
	CreatedAt time.Time
	StackID   string
	AppID     string
	Arn       string
	Name      string
	Type      string
}

App represents an OpsWorks app. CreatedAt is first: time.Time non-pointer prefix reduces GC pointer bytes.

Arn is kept as an internal bookkeeping field only (e.g. for future resourceExists-style lookups) -- it is deliberately NOT serialized on the wire in appsToJSON, because the real AWS types.App has no Arn member (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's types.go). Real OpsWorks apps are not independently ARN-addressable; TagResource / UntagResource / ListTags only accept a stack's or layer's ARN.

type AutoScalingSchedule

type AutoScalingSchedule struct {
	Monday    map[string]string `json:"Monday"`
	Tuesday   map[string]string `json:"Tuesday"`
	Wednesday map[string]string `json:"Wednesday"`
	Thursday  map[string]string `json:"Thursday"`
	Friday    map[string]string `json:"Friday"`
	Saturday  map[string]string `json:"Saturday"`
	Sunday    map[string]string `json:"Sunday"`
}

AutoScalingSchedule specifies time-based auto-scaling configuration.

type ChefConfiguration added in v1.3.1

type ChefConfiguration struct {
	BerkshelfVersion string
	ManageBerkshelf  bool
}

ChefConfiguration mirrors the real types.ChefConfiguration (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's types.go).

type Command

type Command struct {
	CreatedAt      time.Time
	AcknowledgedAt time.Time
	CompletedAt    time.Time
	DeploymentID   string
	InstanceID     string
	CommandID      string
	Type           string
	Status         string
	LogURL         string
	ExitCode       int32
}

Command represents an OpsWorks command. CreatedAt is first: time.Time non-pointer prefix reduces GC pointer bytes.

type ConfigurationManager

type ConfigurationManager struct {
	Name    string
	Version string
}

ConfigurationManager describes a configuration manager.

type CreateStackOptions added in v1.3.1

type CreateStackOptions struct {
	ConfigurationManager *StackConfigurationManager
	ChefConfiguration    *ChefConfiguration
	Attributes           map[string]string
	VpcID                string
}

CreateStackOptions carries CreateStack's optional parameters. AWS's CreateStackInput has a much larger optional surface (AgentVersion, CustomCookbooksSource, CustomJson, DefaultAvailabilityZone, DefaultOs, DefaultRootDeviceType, DefaultSshKeyName, DefaultSubnetId, HostnameTheme, UseCustomCookbooks, UseOpsworksSecurityGroups) that remains unmodeled -- see PARITY.md's deferred list.

type Deployment

type Deployment struct {
	CreatedAt    time.Time
	CompletedAt  time.Time
	StackID      string
	AppID        string
	DeploymentID string
	Command      string
	Status       string
	Duration     int32
}

Deployment represents an OpsWorks deployment. CreatedAt is first: time.Time non-pointer prefix reduces GC pointer bytes.

type EcsCluster

type EcsCluster struct {
	RegisteredAt   time.Time
	EcsClusterArn  string
	EcsClusterName string
	StackID        string
	Status         string
}

EcsCluster represents a registered ECS cluster.

type ElasticIP

type ElasticIP struct {
	IP         string
	Domain     string
	Name       string
	Region     string
	InstanceID string
	StackID    string
}

ElasticIP represents an elastic IP registered with OpsWorks.

StackID is kept for the real, "This member is required" RegisterElasticIpInput field and the real DescribeElasticIpsInput's filter member, but is deliberately NOT serialized on the wire in elasticIpsToJSON: the real types.ElasticIp has no StackId member (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's types.go -- only Domain/InstanceId/Ip/Name/Region).

type ElasticLoadBalancer

type ElasticLoadBalancer struct {
	ElasticLoadBalancerName string
	Region                  string
	DNSName                 string
	StackID                 string
	LayerID                 string
}

ElasticLoadBalancer represents an OpsWorks-attached elastic load balancer.

type Handler

type Handler struct {
	Backend StorageBackend
	// contains filtered or unexported fields
}

Handler handles OpsWorks HTTP requests.

func NewHandler

func NewHandler(b StorageBackend) *Handler

NewHandler constructs a new Handler.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation extracts the operation name from the X-Amz-Target header.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(_ *echo.Context) string

ExtractResource extracts the resource identifier from the request.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns the list of supported operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function for OpsWorks requests.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset resets the backend and rebuilds the dispatch table.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend. See the Snapshot doc comment above for why this delegation is new.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a function that matches OpsWorks API requests.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

Prior to Phase 3.3, Handler had no Snapshot/Restore of its own even though InMemoryBackend implemented both (dead wiring: nothing ever called them). This delegation is what actually wires OpsWorks into the persistence Manager.

type InMemoryBackend

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

InMemoryBackend is an in-memory OpsWorks backend.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new in-memory OpsWorks backend.

func (*InMemoryBackend) AccountID

func (b *InMemoryBackend) AccountID() string

AccountID returns the configured account ID.

func (*InMemoryBackend) AssignInstance

func (b *InMemoryBackend) AssignInstance(instanceID string, layerIDs []string) error

AssignInstance assigns a registered instance to a layer. The target layer must exist and belong to the same stack as the instance -- AWS does not document cross-stack assignment as valid, and this backend previously accepted any layer ID (even one from an unrelated stack, or one that didn't exist at all) without checking. AssignInstance's doc comment (aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_AssignInstance.go) also documents "You cannot use this action with instances that were created with OpsWorks Stacks" -- i.e. it only applies to RegisterInstance'd instances, never CreateInstance'd ones; storedInstance.Registered (set only by RegisterInstance) is what this backend already tracks that on.

func (*InMemoryBackend) AssignVolume

func (b *InMemoryBackend) AssignVolume(volumeID, instanceID string) error

AssignVolume assigns a registered volume to an instance. The instance must belong to the same stack the volume was registered with -- a volume can only be registered with one stack at a time (see RegisterVolume), so assigning it to an instance from a different stack would silently create a cross-stack resource association AWS does not document as valid.

VolumeId is "This member is required" on the real AssignVolumeInput (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_AssignVolume.go / validateOpAssignVolumeInput); InstanceId is not.

func (*InMemoryBackend) AssociateElasticIP

func (b *InMemoryBackend) AssociateElasticIP(elasticIP, instanceID string) error

AssociateElasticIP associates an elastic IP with an instance.

func (*InMemoryBackend) AttachElasticLoadBalancer

func (b *InMemoryBackend) AttachElasticLoadBalancer(elbName, layerID string) error

AttachElasticLoadBalancer attaches an ELB to a layer.

func (*InMemoryBackend) CloneStack

func (b *InMemoryBackend) CloneStack(sourceStackID, name, region string) (*Stack, error)

CloneStack creates a new stack that is a copy of the source stack.

func (*InMemoryBackend) CreateApp

func (b *InMemoryBackend) CreateApp(stackID, name, appType string) (*App, error)

CreateApp creates a new app in a stack. Name, StackId, and Type are all "This member is required" on the real CreateAppInput (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_CreateApp.go), and Type is restricted to the AppType enum, not a free string.

func (*InMemoryBackend) CreateDeployment

func (b *InMemoryBackend) CreateDeployment(stackID, appID, command string) (*Deployment, error)

CreateDeployment creates a new deployment.

func (*InMemoryBackend) CreateInstance

func (b *InMemoryBackend) CreateInstance(stackID, layerID, instanceType string) (*Instance, error)

CreateInstance creates a new instance in a stack/layer. StackId, LayerIds (at least one), and InstanceType are all "This member is required" on the real CreateInstanceInput (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_CreateInstance.go).

func (*InMemoryBackend) CreateLayer

func (b *InMemoryBackend) CreateLayer(stackID, layerType, name, shortname string) (*Layer, error)

CreateLayer creates a new layer in a stack. Name, Shortname, StackId, and Type are all "This member is required" on the real CreateLayerInput (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_CreateLayer.go), and Type is restricted to the LayerType enum, not a free string.

func (*InMemoryBackend) CreateStack

func (b *InMemoryBackend) CreateStack(
	name, region, defaultInstanceProfileArn, serviceRoleArn string, opts CreateStackOptions,
) (*Stack, error)

CreateStack creates a new OpsWorks stack. Name, Region, DefaultInstanceProfileArn, and ServiceRoleArn are all "This member is required" on the real CreateStackInput (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_CreateStack.go) -- a well-behaved SDK client validates this locally before ever sending the request, but a raw/non-SDK caller can still reach this handler with one missing, so the backend must reject it too. opts carries a subset of the remaining optional members (see CreateStackOptions's doc comment for what is still unmodeled).

func (*InMemoryBackend) CreateUserProfile

func (b *InMemoryBackend) CreateUserProfile(
	iamUserArn, sshUsername, sshPublicKey string,
	allowSelfManagement bool,
) (*UserProfile, error)

CreateUserProfile creates an OpsWorks IAM user profile.

func (*InMemoryBackend) DeleteApp

func (b *InMemoryBackend) DeleteApp(appID string) error

DeleteApp deletes an app.

func (*InMemoryBackend) DeleteInstance

func (b *InMemoryBackend) DeleteInstance(instanceID string) error

DeleteInstance deletes an instance.

func (*InMemoryBackend) DeleteLayer

func (b *InMemoryBackend) DeleteLayer(layerID string) error

DeleteLayer deletes a layer.

func (*InMemoryBackend) DeleteStack

func (b *InMemoryBackend) DeleteStack(stackID string) error

DeleteStack deletes a stack and all its child resources.

func (*InMemoryBackend) DeleteUserProfile

func (b *InMemoryBackend) DeleteUserProfile(iamUserArn string) error

DeleteUserProfile removes a user profile.

func (*InMemoryBackend) DeregisterEcsCluster

func (b *InMemoryBackend) DeregisterEcsCluster(ecsClusterArn string) error

DeregisterEcsCluster removes a registered ECS cluster.

func (*InMemoryBackend) DeregisterElasticIP

func (b *InMemoryBackend) DeregisterElasticIP(elasticIP string) error

DeregisterElasticIP removes a registered elastic IP.

func (*InMemoryBackend) DeregisterInstance

func (b *InMemoryBackend) DeregisterInstance(instanceID string) error

DeregisterInstance deregisters an instance from OpsWorks.

func (*InMemoryBackend) DeregisterRdsDBInstance

func (b *InMemoryBackend) DeregisterRdsDBInstance(rdsDBInstanceArn string) error

DeregisterRdsDBInstance removes a registered RDS DB instance.

func (*InMemoryBackend) DeregisterVolume

func (b *InMemoryBackend) DeregisterVolume(volumeID string) error

DeregisterVolume removes a registered volume.

func (*InMemoryBackend) DescribeAgentVersions

func (b *InMemoryBackend) DescribeAgentVersions(stackID string) ([]*AgentVersion, error)

DescribeAgentVersions returns a static list of supported OpsWorks agent versions.

func (*InMemoryBackend) DescribeApps

func (b *InMemoryBackend) DescribeApps(stackID string, appIDs []string) ([]*App, error)

DescribeApps returns apps filtered by stack and/or app IDs.

func (*InMemoryBackend) DescribeCommands

func (b *InMemoryBackend) DescribeCommands(deploymentID, instanceID string, commandIDs []string) ([]*Command, error)

DescribeCommands returns commands filtered by deployment, instance, or IDs.

func (*InMemoryBackend) DescribeDeployments

func (b *InMemoryBackend) DescribeDeployments(stackID, appID string, deploymentIDs []string) ([]*Deployment, error)

DescribeDeployments returns deployments filtered by stack, app, or IDs.

func (*InMemoryBackend) DescribeEcsClusters

func (b *InMemoryBackend) DescribeEcsClusters(stackID string, ecsClusterArns []string) ([]*EcsCluster, error)

DescribeEcsClusters returns ECS clusters filtered by stack or ARN list.

func (*InMemoryBackend) DescribeElasticIps

func (b *InMemoryBackend) DescribeElasticIps(stackID, instanceID string, ips []string) ([]*ElasticIP, error)

DescribeElasticIps returns elastic IPs optionally filtered by stack, instance, or IP list. StackId is a real DescribeElasticIpsInput filter member (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_DescribeElasticIps.go), alongside InstanceId and Ips.

func (*InMemoryBackend) DescribeElasticLoadBalancers

func (b *InMemoryBackend) DescribeElasticLoadBalancers(
	stackID string, layerIDs []string,
) ([]*ElasticLoadBalancer, error)

DescribeElasticLoadBalancers returns ELBs optionally filtered by stack and/or layer. LayerIds is a real, plural DescribeElasticLoadBalancersInput filter member (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_DescribeElasticLoadBalancers.go) -- a previous version of this method discarded it entirely.

func (*InMemoryBackend) DescribeInstances

func (b *InMemoryBackend) DescribeInstances(stackID, layerID string, instanceIDs []string) ([]*Instance, error)

DescribeInstances returns instances filtered by stack, layer, or IDs.

func (*InMemoryBackend) DescribeLayers

func (b *InMemoryBackend) DescribeLayers(stackID string, layerIDs []string) ([]*Layer, error)

DescribeLayers returns layers filtered by stack and/or layer IDs.

func (*InMemoryBackend) DescribeLoadBasedAutoScaling

func (b *InMemoryBackend) DescribeLoadBasedAutoScaling(layerIDs []string) ([]*LoadBasedAutoScaling, error)

DescribeLoadBasedAutoScaling returns load-based auto-scaling config for layers.

func (*InMemoryBackend) DescribeMyUserProfile

func (b *InMemoryBackend) DescribeMyUserProfile() (*UserProfile, error)

DescribeMyUserProfile returns a placeholder profile for the current user.

func (*InMemoryBackend) DescribeOperatingSystems

func (b *InMemoryBackend) DescribeOperatingSystems() ([]*OperatingSystem, error)

DescribeOperatingSystems returns a static list of supported OpsWorks operating systems.

func (*InMemoryBackend) DescribePermissions

func (b *InMemoryBackend) DescribePermissions(stackID, iamUserArn string) ([]*Permission, error)

DescribePermissions returns permissions optionally filtered by stack and user.

func (*InMemoryBackend) DescribeRaidArrays

func (b *InMemoryBackend) DescribeRaidArrays(
	_, _ string,
	_ []string,
) ([]map[string]any, error)

DescribeRaidArrays returns RAID arrays (always empty in mock).

func (*InMemoryBackend) DescribeRdsDBInstances

func (b *InMemoryBackend) DescribeRdsDBInstances(stackID string, rdsDBInstanceArns []string) ([]*RdsDBInstance, error)

DescribeRdsDBInstances returns RDS DB instances filtered by stack or ARN list.

func (*InMemoryBackend) DescribeServiceErrors

func (b *InMemoryBackend) DescribeServiceErrors(
	stackID, _ string,
	_ []string,
) ([]map[string]any, error)

DescribeServiceErrors returns service errors (always empty in mock).

func (*InMemoryBackend) DescribeStackProvisioningParameters

func (b *InMemoryBackend) DescribeStackProvisioningParameters(stackID string) (string, map[string]string, error)

DescribeStackProvisioningParameters returns provisioning parameters for a stack. The real DescribeStackProvisioningParametersOutput has AgentInstallerUrl and Parameters as two SEPARATE members (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_DescribeStackProvisioningParameters.go) -- no StackArn, so this returns just the two, not the stack's ARN.

Parameters is returned empty rather than fabricated: AWS's real Parameters map holds internal agent-bootstrap config (e.g. agent_installer_base_url, instance_service_endpoint, ops_works_region, charlie_public_key), none of which this backend tracks. AgentInstallerUrl itself is NOT one of those keys -- a previous version of this method put "AgentInstallerUrl" inside Parameters too, duplicating the dedicated top-level field under a fabricated key.

func (*InMemoryBackend) DescribeStackSummary

func (b *InMemoryBackend) DescribeStackSummary(stackID string) (*StackSummary, error)

DescribeStackSummary returns summary counts for a stack.

func (*InMemoryBackend) DescribeStacks

func (b *InMemoryBackend) DescribeStacks(stackIDs []string) ([]*Stack, error)

DescribeStacks returns stacks, optionally filtered by IDs.

func (*InMemoryBackend) DescribeTimeBasedAutoScaling

func (b *InMemoryBackend) DescribeTimeBasedAutoScaling(instanceIDs []string) ([]*TimeBasedAutoScaling, error)

DescribeTimeBasedAutoScaling returns time-based auto-scaling config for instances.

func (*InMemoryBackend) DescribeUserProfiles

func (b *InMemoryBackend) DescribeUserProfiles(iamUserArns []string) ([]*UserProfile, error)

DescribeUserProfiles returns user profiles optionally filtered by ARN.

func (*InMemoryBackend) DescribeVolumes

func (b *InMemoryBackend) DescribeVolumes(stackID, instanceID, _ string, volumeIDs []string) ([]*Volume, error)

DescribeVolumes returns volumes filtered by stack, instance, RAID array, or IDs. RaidArrayId is accepted (matching the real DescribeVolumesInput shape) but never filters anything: this backend does not model RAID arrays at all (DescribeRaidArrays always returns empty, by design -- see PARITY.md's Misc family note), so no volume ever carries a RAID array association to filter on.

func (*InMemoryBackend) DetachElasticLoadBalancer

func (b *InMemoryBackend) DetachElasticLoadBalancer(elbName, _ string) error

DetachElasticLoadBalancer detaches an ELB from a layer.

func (*InMemoryBackend) DisassociateElasticIP

func (b *InMemoryBackend) DisassociateElasticIP(elasticIP string) error

DisassociateElasticIP removes an elastic IP's instance association.

func (*InMemoryBackend) GetHostnameSuggestion

func (b *InMemoryBackend) GetHostnameSuggestion(layerID string) (string, error)

GetHostnameSuggestion returns a suggested hostname for a new instance on the given layer. The real GetHostnameSuggestionInput has no StackId member -- only LayerId -- so this must key off the layer, not a stack.

func (*InMemoryBackend) GrantAccess

func (b *InMemoryBackend) GrantAccess(instanceID string, validForInMinutes int32) (*TemporaryCredential, error)

GrantAccess returns temporary SSH credentials for an instance.

func (*InMemoryBackend) ListTags

func (b *InMemoryBackend) ListTags(
	resourceARN string,
	maxResults int32,
	nextToken string,
) (map[string]string, string, error)

ListTags lists tags for a resource with pagination support.

func (*InMemoryBackend) RebootInstance

func (b *InMemoryBackend) RebootInstance(instanceID string) error

RebootInstance transitions an instance back to online. See StartInstance's doc comment for why this commits directly to the terminal state instead of parking the instance in a transient status.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the configured region.

func (*InMemoryBackend) RegisterEcsCluster

func (b *InMemoryBackend) RegisterEcsCluster(ecsClusterArn, stackID string) (string, error)

RegisterEcsCluster registers an ECS cluster with a stack. EcsClusterArn and StackId are both "This member is required" on the real RegisterEcsClusterInput (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_RegisterEcsCluster.go).

func (*InMemoryBackend) RegisterElasticIP

func (b *InMemoryBackend) RegisterElasticIP(elasticIP, stackID string) (*ElasticIP, error)

RegisterElasticIP registers an elastic IP address with a stack. ElasticIp and StackId are both "This member is required" on the real RegisterElasticIpInput; there is no Region member on the real input at all (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_RegisterElasticIp.go).

func (*InMemoryBackend) RegisterInstance

func (b *InMemoryBackend) RegisterInstance(stackID, hostname string) (string, error)

RegisterInstance registers an on-premises instance with a stack. StackId is "This member is required" on the real RegisterInstanceInput (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_RegisterInstance.go); Hostname is not.

func (*InMemoryBackend) RegisterRdsDBInstance

func (b *InMemoryBackend) RegisterRdsDBInstance(stackID, rdsDBInstanceArn, dbUser, dbPassword string) error

RegisterRdsDBInstance registers an RDS DB instance with a stack. StackId, RdsDbInstanceArn, DbUser, and DbPassword are all "This member is required" on the real RegisterRdsDbInstanceInput (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_RegisterRdsDbInstance.go). dbPassword is intentionally unused beyond validation: the real DescribeRdsDbInstances response never echoes it back (see storedRdsDBInstance's doc comment), so there is nothing to store it for.

func (*InMemoryBackend) RegisterVolume

func (b *InMemoryBackend) RegisterVolume(ec2VolumeID, stackID string) (string, error)

RegisterVolume registers an EBS volume with a stack. StackId is "This member is required" on the real RegisterVolumeInput (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_RegisterVolume.go); Ec2VolumeId is not.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all stored data.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore deserializes backend state from a snapshot.

func (*InMemoryBackend) SetLoadBasedAutoScaling

func (b *InMemoryBackend) SetLoadBasedAutoScaling(
	layerID string,
	enable bool,
	upScaling, downScaling *ScalingParameters,
) error

SetLoadBasedAutoScaling sets load-based auto-scaling config for a layer.

func (*InMemoryBackend) SetPermission

func (b *InMemoryBackend) SetPermission(stackID, iamUserArn, level string, allowSSH, allowSudo bool) error

SetPermission sets stack permissions for an IAM user. IamUserArn and StackId are both "This member is required" on the real SetPermissionInput (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's api_op_SetPermission.go); Level is optional but, when set, restricted to isValidPermissionLevel's set.

func (*InMemoryBackend) SetTimeBasedAutoScaling

func (b *InMemoryBackend) SetTimeBasedAutoScaling(instanceID string, schedule *AutoScalingSchedule) error

SetTimeBasedAutoScaling sets the time-based auto-scaling schedule for an instance.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state to JSON.

func (*InMemoryBackend) StartInstance

func (b *InMemoryBackend) StartInstance(instanceID string) error

StartInstance transitions an instance to online. Real AWS moves an instance through several transient states (requested, pending, booting, running_setup) before reaching online; this backend has no time-based scheduler, so it commits directly to the terminal state instead of leaving the instance parked in a transient status that nothing ever advances (previously "starting", which is not even a valid AWS OpsWorks instance-status value, and which left DescribeInstances pollers spinning forever since no code ever moved it on to "online").

func (*InMemoryBackend) StartStack

func (b *InMemoryBackend) StartStack(stackID string) error

StartStack transitions all stopped instances in a stack to online. Real AWS OpsWorks moves an instance through several transient states (requested, pending, booting, running_setup) before it reaches online; this backend has no time-based scheduler (see CreateDeployment's synchronous-completion convention), so it commits directly to the terminal state rather than leaving the instance parked in a transient status that nothing ever advances -- a stuck "starting" status previously left DescribeInstances pollers spinning forever.

func (*InMemoryBackend) StopInstance

func (b *InMemoryBackend) StopInstance(instanceID string) error

StopInstance transitions an instance to stopped. See StartInstance's doc comment for why this commits directly to the terminal state instead of parking the instance in the transient "stopping" status.

func (*InMemoryBackend) StopStack

func (b *InMemoryBackend) StopStack(stackID string) error

StopStack transitions all online instances in a stack to stopped. See StartStack's doc comment for why this commits directly to the terminal state instead of parking instances in the transient "stopping" status.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error

TagResource adds or updates tags on a resource.

func (*InMemoryBackend) TaggedResources added in v1.3.1

func (b *InMemoryBackend) TaggedResources() []TaggedEntry

TaggedResources returns every stack or layer ARN with at least one tag, for the resourcegroupstaggingapi integration (cli.go's wireTaggingOpsWorks).

func (*InMemoryBackend) UnassignInstance

func (b *InMemoryBackend) UnassignInstance(instanceID string) error

UnassignInstance removes an instance from its layer.

func (*InMemoryBackend) UnassignVolume

func (b *InMemoryBackend) UnassignVolume(volumeID string) error

UnassignVolume removes a volume's instance assignment.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error

UntagResource removes tags from a resource.

func (*InMemoryBackend) UpdateApp

func (b *InMemoryBackend) UpdateApp(appID, name string) error

UpdateApp updates an app's name.

func (*InMemoryBackend) UpdateElasticIP

func (b *InMemoryBackend) UpdateElasticIP(elasticIP, name string) error

UpdateElasticIP updates the name of a registered elastic IP.

func (*InMemoryBackend) UpdateInstance

func (b *InMemoryBackend) UpdateInstance(instanceID, hostname string) error

UpdateInstance updates an instance's hostname.

func (*InMemoryBackend) UpdateLayer

func (b *InMemoryBackend) UpdateLayer(layerID, name string) error

UpdateLayer updates a layer's name.

func (*InMemoryBackend) UpdateMyUserProfile

func (b *InMemoryBackend) UpdateMyUserProfile(_ string) error

UpdateMyUserProfile updates the SSH public key for the current user.

func (*InMemoryBackend) UpdateRdsDBInstance

func (b *InMemoryBackend) UpdateRdsDBInstance(rdsDBInstanceArn, dbUser, _ string) error

UpdateRdsDBInstance updates the DB user/password for a registered RDS instance.

func (*InMemoryBackend) UpdateStack

func (b *InMemoryBackend) UpdateStack(stackID, name string) error

UpdateStack updates a stack's name.

func (*InMemoryBackend) UpdateUserProfile

func (b *InMemoryBackend) UpdateUserProfile(iamUserArn, sshUsername, sshPublicKey string) error

UpdateUserProfile updates a user profile's SSH settings.

func (*InMemoryBackend) UpdateVolume

func (b *InMemoryBackend) UpdateVolume(volumeID, name, mountPoint string) error

UpdateVolume updates a volume's name and mount point.

type Instance

type Instance struct {
	CreatedAt    time.Time
	StackID      string
	LayerID      string
	InstanceID   string
	Arn          string
	Hostname     string
	InstanceType string
	Status       string
	// Registered indicates this is an on-premises registered instance.
	Registered bool
}

Instance represents an OpsWorks instance. CreatedAt is first: time.Time non-pointer prefix reduces GC pointer bytes.

type InstancesCount

type InstancesCount struct {
	Assigning      int32
	Booting        int32
	ConnectionLost int32
	Deregistering  int32
	Online         int32
	Pending        int32
	Rebooting      int32
	Registered     int32
	Registering    int32
	Requested      int32
	RunningSetup   int32
	SetupFailed    int32
	ShuttingDown   int32
	StartFailed    int32
	StopFailed     int32
	Stopped        int32
	Stopping       int32
	Terminated     int32
	Terminating    int32
	Unassigning    int32
}

InstancesCount holds counts of instances in various states. Field names and set match types.InstancesCount in aws-sdk-go-v2/service/opsworks exactly (19 states, no "Total" or "Starting" -- those were invented by a previous pass and did not exist in the real API; the real enum's transient boot/on-request states are "Requested", not "Starting"). This backend's instance state machine only ever produces "online"/"stopped" (see StartInstance/StopInstance doc comments), so only Online and Stopped are ever non-zero here; the rest exist for wire-shape completeness.

type Layer

type Layer struct {
	CreatedAt time.Time
	StackID   string
	LayerID   string
	Arn       string
	Type      string
	Name      string
	Shortname string
}

Layer represents an OpsWorks layer. CreatedAt is first: time.Time non-pointer prefix reduces GC pointer bytes.

type LoadBasedAutoScaling

type LoadBasedAutoScaling struct {
	UpScaling   *ScalingParameters
	DownScaling *ScalingParameters
	LayerID     string
	Enable      bool
}

LoadBasedAutoScaling associates a layer with load-based auto-scaling settings.

type OperatingSystem

type OperatingSystem struct {
	ID                    string
	Name                  string
	Type                  string
	ReportedVersion       string
	ConfigurationManagers []*ConfigurationManager
	Supported             bool
}

OperatingSystem describes a supported OpsWorks operating system. Strings first: moves slice ptr to later offset, reducing GC pointer scan bytes (80→72).

type Permission

type Permission struct {
	StackID    string
	IamUserArn string
	Level      string
	AllowSSH   bool
	AllowSudo  bool
}

Permission represents OpsWorks stack access permissions for an IAM user.

type Provider

type Provider struct{}

Provider implements service.Provider for Amazon OpsWorks.

func (*Provider) Init

Init initializes the OpsWorks service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type RdsDBInstance

type RdsDBInstance struct {
	RdsDBInstanceArn     string
	DBInstanceIdentifier string
	DBUser               string
	StackID              string
	Region               string
	Address              string
}

RdsDBInstance represents a registered RDS DB instance.

type ScalingParameters

type ScalingParameters struct {
	CPUThreshold       float64 `json:"CpuThreshold"`
	LoadThreshold      float64 `json:"LoadThreshold"`
	MemoryThreshold    float64 `json:"MemoryThreshold"`
	IgnoreMetricsTime  int32   `json:"IgnoreMetricsTime"`
	InstanceCount      int32   `json:"InstanceCount"`
	ThresholdsWaitTime int32   `json:"ThresholdsWaitTime"`
}

ScalingParameters holds scaling trigger thresholds.

type Stack

type Stack struct {
	CreatedAt                 time.Time
	ConfigurationManager      *StackConfigurationManager
	ChefConfiguration         *ChefConfiguration
	Tags                      map[string]string
	Attributes                map[string]string
	StackID                   string
	Arn                       string
	Name                      string
	Region                    string
	DefaultInstanceProfileArn string
	ServiceRoleArn            string
	VpcID                     string
}

Stack represents an OpsWorks stack. CreatedAt is first: time.Time non-pointer prefix reduces GC pointer bytes.

No Status field: the real AWS types.Stack has no such member (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's types.go) -- a previous pass invented one and serialized it on the wire, which this pass removed.

type StackConfigurationManager added in v1.3.1

type StackConfigurationManager struct {
	Name    string
	Version string
}

StackConfigurationManager mirrors the real types.StackConfigurationManager (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's types.go).

type StackSummary

type StackSummary struct {
	InstancesCount   *InstancesCount
	StackID          string
	Arn              string
	Name             string
	LayersCount      int32
	AppsCount        int32
	DeploymentsCount int32
}

StackSummary represents summary information about a stack.

type StorageBackend

type StorageBackend interface {
	// Stack operations
	CreateStack(name, region, defaultInstanceProfileArn, serviceRoleArn string, opts CreateStackOptions) (*Stack, error)
	CloneStack(sourceStackID, name, region string) (*Stack, error)
	DescribeStacks(stackIDs []string) ([]*Stack, error)
	UpdateStack(stackID, name string) error
	DeleteStack(stackID string) error
	StartStack(stackID string) error
	StopStack(stackID string) error
	GetHostnameSuggestion(layerID string) (string, error)
	DescribeStackSummary(stackID string) (*StackSummary, error)
	DescribeStackProvisioningParameters(stackID string) (agentInstallerURL string, params map[string]string, err error)

	// Layer operations
	CreateLayer(stackID, layerType, name, shortname string) (*Layer, error)
	DescribeLayers(stackID string, layerIDs []string) ([]*Layer, error)
	UpdateLayer(layerID, name string) error
	DeleteLayer(layerID string) error

	// Instance operations
	CreateInstance(stackID, layerID, instanceType string) (*Instance, error)
	RegisterInstance(stackID, hostname string) (string, error)
	DeregisterInstance(instanceID string) error
	AssignInstance(instanceID string, layerIDs []string) error
	UnassignInstance(instanceID string) error
	DescribeInstances(stackID, layerID string, instanceIDs []string) ([]*Instance, error)
	UpdateInstance(instanceID, hostname string) error
	DeleteInstance(instanceID string) error
	StartInstance(instanceID string) error
	StopInstance(instanceID string) error
	RebootInstance(instanceID string) error

	// App operations
	CreateApp(stackID, name, appType string) (*App, error)
	DescribeApps(stackID string, appIDs []string) ([]*App, error)
	UpdateApp(appID, name string) error
	DeleteApp(appID string) error

	// Deployment operations
	CreateDeployment(stackID, appID, command string) (*Deployment, error)
	DescribeDeployments(stackID, appID string, deploymentIDs []string) ([]*Deployment, error)

	// Command operations
	DescribeCommands(deploymentID, instanceID string, commandIDs []string) ([]*Command, error)

	// Tag operations
	TagResource(resourceARN string, tags map[string]string) error
	UntagResource(resourceARN string, tagKeys []string) error
	ListTags(resourceARN string, maxResults int32, nextToken string) (map[string]string, string, error)

	// User profile operations
	CreateUserProfile(iamUserArn, sshUsername, sshPublicKey string, allowSelfManagement bool) (*UserProfile, error)
	DeleteUserProfile(iamUserArn string) error
	DescribeUserProfiles(iamUserArns []string) ([]*UserProfile, error)
	UpdateUserProfile(iamUserArn, sshUsername, sshPublicKey string) error
	DescribeMyUserProfile() (*UserProfile, error)
	UpdateMyUserProfile(sshPublicKey string) error

	// Elastic Load Balancer operations
	AttachElasticLoadBalancer(elbName, layerID string) error
	DetachElasticLoadBalancer(elbName, layerID string) error
	DescribeElasticLoadBalancers(stackID string, layerIDs []string) ([]*ElasticLoadBalancer, error)

	// Elastic IP operations
	AssociateElasticIP(elasticIP, instanceID string) error
	DisassociateElasticIP(elasticIP string) error
	RegisterElasticIP(elasticIP, stackID string) (*ElasticIP, error)
	DeregisterElasticIP(elasticIP string) error
	DescribeElasticIps(stackID, instanceID string, ips []string) ([]*ElasticIP, error)
	UpdateElasticIP(elasticIP, name string) error

	// Volume operations
	RegisterVolume(ec2VolumeID, stackID string) (string, error)
	DeregisterVolume(volumeID string) error
	AssignVolume(volumeID, instanceID string) error
	UnassignVolume(volumeID string) error
	DescribeVolumes(stackID, instanceID, raidArrayID string, volumeIDs []string) ([]*Volume, error)
	UpdateVolume(volumeID, name, mountPoint string) error

	// RDS DB Instance operations
	RegisterRdsDBInstance(stackID, rdsDBInstanceArn, dbUser, dbPassword string) error
	DeregisterRdsDBInstance(rdsDBInstanceArn string) error
	DescribeRdsDBInstances(stackID string, rdsDBInstanceArns []string) ([]*RdsDBInstance, error)
	UpdateRdsDBInstance(rdsDBInstanceArn, dbUser, dbPassword string) error

	// ECS Cluster operations
	RegisterEcsCluster(ecsClusterArn, stackID string) (string, error)
	DeregisterEcsCluster(ecsClusterArn string) error
	DescribeEcsClusters(stackID string, ecsClusterArns []string) ([]*EcsCluster, error)

	// Permission operations
	SetPermission(stackID, iamUserArn, level string, allowSSH, allowSudo bool) error
	DescribePermissions(stackID, iamUserArn string) ([]*Permission, error)

	// Auto-scaling operations
	SetTimeBasedAutoScaling(instanceID string, schedule *AutoScalingSchedule) error
	DescribeTimeBasedAutoScaling(instanceIDs []string) ([]*TimeBasedAutoScaling, error)
	SetLoadBasedAutoScaling(layerID string, enable bool, upScaling, downScaling *ScalingParameters) error
	DescribeLoadBasedAutoScaling(layerIDs []string) ([]*LoadBasedAutoScaling, error)

	// Misc operations
	GrantAccess(instanceID string, validForInMinutes int32) (*TemporaryCredential, error)
	DescribeServiceErrors(stackID, instanceID string, serviceErrorIDs []string) ([]map[string]any, error)
	DescribeRaidArrays(instanceID, stackID string, raidArrayIDs []string) ([]map[string]any, error)
	DescribeAgentVersions(stackID string) ([]*AgentVersion, error)
	DescribeOperatingSystems() ([]*OperatingSystem, error)

	AccountID() string
	Region() string
	Reset()
	Snapshot(ctx context.Context) []byte
	Restore(ctx context.Context, data []byte) error
}

StorageBackend is the interface for OpsWorks storage operations.

type TaggedEntry added in v1.3.1

type TaggedEntry struct {
	Tags map[string]string
	ARN  string
}

TaggedEntry pairs a resource ARN with its tags.

type TemporaryCredential

type TemporaryCredential struct {
	InstanceID        string
	Username          string
	Password          string
	ValidForInMinutes int32
}

TemporaryCredential holds short-lived SSH credentials returned by GrantAccess.

type TimeBasedAutoScaling

type TimeBasedAutoScaling struct {
	AutoScalingSchedule *AutoScalingSchedule
	InstanceID          string
}

TimeBasedAutoScaling associates an instance with its auto-scaling schedule.

type UserProfile

type UserProfile struct {
	IamUserArn          string
	Name                string
	SSHUsername         string
	SSHPublicKey        string
	AllowSelfManagement bool
}

UserProfile represents an OpsWorks IAM user profile.

type Volume

type Volume struct {
	RegisteredAt time.Time
	VolumeID     string
	Ec2VolumeID  string
	StackID      string
	InstanceID   string
	Name         string
	MountPoint   string
	Region       string
	Status       string
	Size         int32
}

Volume represents a registered volume.

RegisteredAt is internal bookkeeping only (not serialized -- the real types.Volume has no such field). StackID is kept for stack-scoped lookups (deleteStackAssociations, DescribeVolumes' StackId filter) but likewise not serialized on the wire: the real AWS types.Volume has no StackId member (confirmed against aws-sdk-go-v2/service/opsworks@v1.31.0's types.go) -- only InstanceId and RaidArrayId associate a Volume with other resources on the wire.

Jump to

Keyboard shortcuts

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