Documentation
¶
Index ¶
- Variables
- type CapacityForecastData
- type DescribeScalableTargetsFilter
- type DescribeScalingActivitiesFilter
- type DescribeScalingPoliciesFilter
- type DescribeScheduledActionsFilter
- 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(_ *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) DeleteScalingPolicy(serviceNamespace, resourceID, scalableDimension, policyName string) error
- func (b *InMemoryBackend) DeleteScheduledAction(serviceNamespace, resourceID, scalableDimension, scheduledActionName string) error
- func (b *InMemoryBackend) DeregisterScalableTarget(serviceNamespace, resourceID, scalableDimension string) error
- func (b *InMemoryBackend) DescribeScalableTargets(f DescribeScalableTargetsFilter) ([]*ScalableTarget, string)
- func (b *InMemoryBackend) DescribeScalingActivities(f DescribeScalingActivitiesFilter) ([]*ScalingActivity, string)
- func (b *InMemoryBackend) DescribeScalingPolicies(f DescribeScalingPoliciesFilter) ([]*ScalingPolicy, string)
- func (b *InMemoryBackend) DescribeScheduledActions(f DescribeScheduledActionsFilter) ([]*ScheduledAction, string)
- func (b *InMemoryBackend) GetPredictiveScalingForecast(serviceNamespace, resourceID, scalableDimension, policyName string, ...) (*CapacityForecastData, []LoadForecastData, time.Time, error)
- func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
- func (b *InMemoryBackend) Purge()
- func (b *InMemoryBackend) PutScalingPolicy(serviceNamespace, resourceID, scalableDimension, policyName, policyType string, ...) (*ScalingPolicy, error)
- func (b *InMemoryBackend) PutScheduledAction(...) (*ScheduledAction, error)
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) RegisterScalableTarget(serviceNamespace, resourceID, scalableDimension string, ...) (*ScalableTarget, 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) TagResource(resourceARN string, kv map[string]string) error
- func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error
- type LoadForecastData
- type Provider
- type ScalableTarget
- type ScalableTargetAction
- type ScalingActivity
- type ScalingPolicy
- type ScheduledAction
- type SuspendedState
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
ChaosOperations returns all operations that can be fault-injected.
func (*Handler) ChaosRegions ¶
ChaosRegions returns all regions this handler instance handles.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase AWS service name for fault rule matching.
func (*Handler) ExtractOperation ¶
ExtractOperation extracts the Application Auto Scaling action from the X-Amz-Target header.
func (*Handler) ExtractResource ¶
ExtractResource extracts the resource identifier from the request body.
func (*Handler) GetSupportedOperations ¶
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 ¶
MatchPriority returns the routing priority.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a function that matches Application Auto Scaling requests.
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 ¶
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 ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the Application Auto Scaling backend and handler.
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.
Source Files
¶
- errors.go
- forecast.go
- handler.go
- handler_forecast.go
- handler_scalable_targets.go
- handler_scaling_activities.go
- handler_scaling_policies.go
- handler_scheduled_actions.go
- handler_tags.go
- models.go
- persistence.go
- provider.go
- scalable_targets.go
- scaling_activities.go
- scaling_policies.go
- scheduled_actions.go
- store.go
- store_setup.go
- tags.go