applicationautoscaling

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 20 Imported by: 0

README

Application Auto Scaling

Parity grade: A · SDK aws-sdk-go-v2/service/applicationautoscaling@v1.41.12 · last audited 2026-07-13 (a7e2082d)

Coverage

Metric Value
Operations audited 14 (14 ok)
Feature families 1 (1 ok)
Known gaps 3
Deferred items 1
Resource leaks clean
Known gaps
  • DescribeScalingActivities ignores the IncludeNotScaledActivities request flag; gopherstack's mock backend never generates "not scaled" activities (no real metric evaluation loop exists to decide not-to-scale), so there is nothing to surface even if honored. Documented as deferred, not fixed this pass.
  • GetPredictiveScalingForecast returns a flat synthetic capacity/load curve (constant 10.0 per hourly point) rather than any real forecasting simulation. This was true before this audit and is unchanged; only the wire format (epoch vs RFC3339) was fixed.
  • PolicyType/ScalableDimension/ServiceNamespace enum values are accepted permissively (no allowlist validation) rather than validated against the real AWS enum lists. Consistent with this codebase's general emulator philosophy of not over-validating; not treated as a bug.
Deferred
  • CloudWatch alarm auto-creation for TargetTrackingScaling/StepScaling policies (real AWS creates backing CloudWatch alarms; gopherstack's scalingPolicySummary.Alarms field exists on the wire type but is never populated) -- would require cross-service CloudWatch integration, out of scope for this pass.

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a requested resource does not exist.
	ErrNotFound = awserr.New("ObjectNotFoundException", awserr.ErrNotFound)
	// ErrAlreadyExists is returned when a resource already exists.
	ErrAlreadyExists = awserr.New("ValidationException", awserr.ErrAlreadyExists)
	// ErrValidation is returned when a request parameter fails validation.
	ErrValidation = awserr.New("ValidationException", awserr.ErrInvalidParameter)
)

Functions

This section is empty.

Types

type CapacityForecastData

type CapacityForecastData struct {
	Timestamps []time.Time
	Values     []float64
}

CapacityForecastData holds the timestamps and capacity values for a forecast.

type DescribeScalableTargetsFilter

type DescribeScalableTargetsFilter struct {
	ServiceNamespace  string
	ScalableDimension string
	// NextToken is the opaque pagination cursor returned by a prior call.
	NextToken   string
	ResourceIDs []string
	// MaxResults, when > 0, limits the number of returned items. Capped at maxDescribeResults.
	MaxResults int32
}

DescribeScalableTargetsFilter carries optional filters for DescribeScalableTargets.

type DescribeScalingActivitiesFilter

type DescribeScalingActivitiesFilter struct {
	// ServiceNamespace limits results to this namespace when non-empty.
	ServiceNamespace string
	// ResourceID limits results to this resource when non-empty.
	ResourceID string
	// ScalableDimension limits results to this dimension when non-empty.
	ScalableDimension string
	// NextToken is the opaque pagination cursor returned by a prior call.
	NextToken string
	// MaxResults, when > 0, limits the number of returned items. Capped at maxDescribeResults.
	MaxResults int32
}

DescribeScalingActivitiesFilter carries optional filters for DescribeScalingActivities.

type DescribeScalingPoliciesFilter

type DescribeScalingPoliciesFilter struct {
	// ServiceNamespace limits results to this namespace when non-empty.
	ServiceNamespace string
	// ResourceID limits results to this resource when non-empty.
	ResourceID string
	// ScalableDimension limits results to this dimension when non-empty.
	ScalableDimension string
	// PolicyNames, when non-empty, limits results to the named policies.
	PolicyNames []string
	// NextToken is the opaque pagination cursor returned by a prior call.
	NextToken string
	// PolicyARNs, when non-empty, limits results to these ARNs.
	PolicyARNs []string
	// MaxResults, when > 0, limits the number of returned items.
	MaxResults int32
}

DescribeScalingPoliciesFilter carries optional filters for DescribeScalingPolicies.

type DescribeScheduledActionsFilter

type DescribeScheduledActionsFilter struct {
	// ServiceNamespace limits results to this namespace when non-empty.
	ServiceNamespace string
	// ResourceID limits results to this resource when non-empty.
	ResourceID string
	// ScalableDimension limits results to this dimension when non-empty.
	ScalableDimension string
	// NextToken is the opaque pagination cursor returned by a prior call.
	NextToken string
	// ScheduledActionNames, when non-empty, limits results to the named actions.
	ScheduledActionNames []string
	// MaxResults, when > 0, limits the number of returned items.
	MaxResults int32
}

DescribeScheduledActionsFilter carries optional filters for DescribeScheduledActions.

type Handler

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

Handler is the Echo HTTP handler for Application Auto Scaling operations.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a new Application Auto Scaling handler backed by backend. backend must not be nil.

func (*Handler) ChaosOperations

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

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

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

ChaosRegions returns all regions this handler instance handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

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

ExtractOperation extracts the Application Auto Scaling action from the X-Amz-Target header.

func (*Handler) ExtractResource

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

ExtractResource extracts the resource identifier from the request body.

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 Application Auto Scaling 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 clears all backend state.

func (*Handler) Restore

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

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

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

RouteMatcher returns a function that matches Application Auto Scaling requests.

func (*Handler) Snapshot

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

Snapshot implements persistence.Persistable by delegating to the backend.

type InMemoryBackend

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

InMemoryBackend stores Application Auto Scaling state in memory.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new InMemoryBackend.

func (*InMemoryBackend) DeleteScalingPolicy

func (b *InMemoryBackend) DeleteScalingPolicy(
	serviceNamespace, resourceID, scalableDimension, policyName string,
) error

DeleteScalingPolicy removes a scaling policy by name.

func (*InMemoryBackend) DeleteScheduledAction

func (b *InMemoryBackend) DeleteScheduledAction(
	serviceNamespace, resourceID, scalableDimension, scheduledActionName string,
) error

DeleteScheduledAction removes a scheduled action.

func (*InMemoryBackend) DeregisterScalableTarget

func (b *InMemoryBackend) DeregisterScalableTarget(serviceNamespace, resourceID, scalableDimension string) error

DeregisterScalableTarget removes a scalable target. DeregisterScalableTarget removes a scalable target and cascades the deletion to all scaling policies and scheduled actions that belong to the same resource (AWS behaviour).

func (*InMemoryBackend) DescribeScalableTargets

func (b *InMemoryBackend) DescribeScalableTargets(f DescribeScalableTargetsFilter) ([]*ScalableTarget, string)

DescribeScalableTargets lists scalable targets, optionally filtered, and returns the NextToken for the following page (empty on the last page).

func (*InMemoryBackend) DescribeScalingActivities

func (b *InMemoryBackend) DescribeScalingActivities(f DescribeScalingActivitiesFilter) ([]*ScalingActivity, string)

DescribeScalingActivities returns recorded scaling activities filtered by the optional fields in f, most recent first, with pagination.

func (*InMemoryBackend) DescribeScalingPolicies

func (b *InMemoryBackend) DescribeScalingPolicies(f DescribeScalingPoliciesFilter) ([]*ScalingPolicy, string)

DescribeScalingPolicies lists scaling policies, optionally filtered, and returns the NextToken for the following page (empty on the last page).

func (*InMemoryBackend) DescribeScheduledActions

func (b *InMemoryBackend) DescribeScheduledActions(f DescribeScheduledActionsFilter) ([]*ScheduledAction, string)

DescribeScheduledActions lists scheduled actions, optionally filtered, and returns the NextToken for the following page (empty on the last page).

func (*InMemoryBackend) GetPredictiveScalingForecast

func (b *InMemoryBackend) GetPredictiveScalingForecast(
	serviceNamespace, resourceID, scalableDimension, policyName string,
	startTime, endTime time.Time,
) (*CapacityForecastData, []LoadForecastData, time.Time, error)

GetPredictiveScalingForecast returns simulated hourly forecast data for the requested policy over the given time window. It verifies the associated scaling policy exists.

func (*InMemoryBackend) ListTagsForResource

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

ListTagsForResource returns tags for a scalable target identified by its ARN.

func (*InMemoryBackend) Purge

func (b *InMemoryBackend) Purge()

Purge removes all resources from the backend. It is safe to call concurrently.

func (*InMemoryBackend) PutScalingPolicy

func (b *InMemoryBackend) PutScalingPolicy(
	serviceNamespace, resourceID, scalableDimension, policyName, policyType string,
	targetTrackingConfig, stepScalingConfig map[string]any,
) (*ScalingPolicy, error)

PutScalingPolicy upserts a scaling policy (update if policyName matches for resource, create otherwise).

func (*InMemoryBackend) PutScheduledAction

func (b *InMemoryBackend) PutScheduledAction(
	serviceNamespace, resourceID, scalableDimension, scheduledActionName, schedule, timezone string,
	startTime, endTime *time.Time,
	scalableTargetAction *ScalableTargetAction,
) (*ScheduledAction, error)

PutScheduledAction upserts a scheduled action.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the AWS region this backend is configured for.

func (*InMemoryBackend) RegisterScalableTarget

func (b *InMemoryBackend) RegisterScalableTarget(
	serviceNamespace, resourceID, scalableDimension string,
	minCapacity, maxCapacity int32,
	tags map[string]string,
	roleARN string,
	suspendedState *SuspendedState,
) (*ScalableTarget, error)

RegisterScalableTarget upserts a scalable target (creates or updates).

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all backend state, resetting to an empty store.

func (*InMemoryBackend) Restore

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

Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) Snapshot

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

Snapshot serialises the backend state to JSON. It implements persistence.Persistable.

func (*InMemoryBackend) TagResource

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

TagResource adds or updates tags on a scalable target identified by its ARN.

func (*InMemoryBackend) UntagResource

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

UntagResource removes tags from a scalable target identified by its ARN.

type LoadForecastData

type LoadForecastData struct {
	MetricSpecification string
	Timestamps          []time.Time
	Values              []float64
}

LoadForecastData holds the timestamps, values, and a metric specification label for a load forecast.

type Provider

type Provider struct{}

Provider implements service.Provider for Application Auto Scaling.

func (*Provider) Init

Init initializes the Application Auto Scaling backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type ScalableTarget

type ScalableTarget struct {
	CreationTime      time.Time         `json:"creationTime"`
	LastModifiedTime  time.Time         `json:"lastModifiedTime"`
	SuspendedState    *SuspendedState   `json:"suspendedState,omitempty"`
	Tags              map[string]string `json:"tags,omitempty"`
	ResourceID        string            `json:"resourceId"`
	ARN               string            `json:"arn"`
	RoleARN           string            `json:"roleArn,omitempty"`
	ScalableDimension string            `json:"scalableDimension"`
	ServiceNamespace  string            `json:"serviceNamespace"`
	AccountID         string            `json:"accountID"`
	Region            string            `json:"region"`
	MinCapacity       int32             `json:"minCapacity"`
	MaxCapacity       int32             `json:"maxCapacity"`
}

ScalableTarget represents a registered Application Auto Scaling scalable target.

type ScalableTargetAction

type ScalableTargetAction struct {
	MinCapacity *int32 `json:"minCapacity,omitempty"`
	MaxCapacity *int32 `json:"maxCapacity,omitempty"`
}

ScalableTargetAction holds the capacity bounds for a scheduled action.

type ScalingActivity

type ScalingActivity struct {
	StartTime         time.Time `json:"StartTime"`
	EndTime           time.Time `json:"EndTime"`
	ActivityID        string    `json:"ActivityId"`
	ServiceNamespace  string    `json:"ServiceNamespace"`
	ResourceID        string    `json:"ResourceId"`
	ScalableDimension string    `json:"ScalableDimension"`
	Description       string    `json:"Description"`
	Cause             string    `json:"Cause"`
	StatusCode        string    `json:"StatusCode"`
	StatusMessage     string    `json:"StatusMessage"`
}

ScalingActivity records a capacity-changing activity on a scalable target, returned by DescribeScalingActivities.

type ScalingPolicy

type ScalingPolicy struct {
	CreationTime         time.Time      `json:"creationTime"`
	LastModifiedTime     time.Time      `json:"lastModifiedTime"`
	TargetTrackingConfig map[string]any `json:"targetTrackingConfig,omitempty"`
	StepScalingConfig    map[string]any `json:"stepScalingConfig,omitempty"`
	PolicyType           string         `json:"policyType"`
	PolicyName           string         `json:"policyName"`
	ResourceID           string         `json:"resourceId"`
	ARN                  string         `json:"arn"`
	ScalableDimension    string         `json:"scalableDimension"`
	ServiceNamespace     string         `json:"serviceNamespace"`
}

ScalingPolicy represents an Application Auto Scaling scaling policy.

type ScheduledAction

type ScheduledAction struct {
	StartTime            *time.Time            `json:"startTime,omitempty"`
	EndTime              *time.Time            `json:"endTime,omitempty"`
	CreationTime         time.Time             `json:"creationTime"`
	LastModifiedTime     time.Time             `json:"lastModifiedTime"`
	ScalableTargetAction *ScalableTargetAction `json:"scalableTargetAction,omitempty"`
	ScheduledActionName  string                `json:"scheduledActionName"`
	ResourceID           string                `json:"resourceId"`
	ARN                  string                `json:"arn"`
	Schedule             string                `json:"schedule"`
	ScalableDimension    string                `json:"scalableDimension"`
	ServiceNamespace     string                `json:"serviceNamespace"`
	Timezone             string                `json:"timezone,omitempty"`
}

ScheduledAction represents an Application Auto Scaling scheduled action.

type SuspendedState

type SuspendedState struct {
	DynamicScalingInSuspended  bool `json:"dynamicScalingInSuspended"`
	DynamicScalingOutSuspended bool `json:"dynamicScalingOutSuspended"`
	ScheduledScalingSuspended  bool `json:"scheduledScalingSuspended"`
}

SuspendedState represents the suspension configuration for a scalable target. Each field independently suspends a category of scaling activity.

Jump to

Keyboard shortcuts

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