Documentation
¶
Index ¶
- Variables
- type AccountLimits
- type AutoScalingGroup
- type AvailabilityZoneDistribution
- type AvailabilityZoneImpairmentPolicy
- type BlockDeviceMapping
- type CapacityReservationSpecification
- type CapacityReservationTarget
- type CompleteLifecycleActionInput
- type CreateAutoScalingGroupInput
- type CreateLaunchConfigurationInput
- type EC2Launcher
- type ELBTarget
- type ELBv2TargetRegistrar
- type EbsBlockDevice
- type ExecutePolicyInput
- type FailedScheduledAction
- 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) Purge(ctx context.Context, cutoff time.Time)
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Shutdown(ctx context.Context)
- func (h *Handler) Snapshot(ctx context.Context) []byte
- func (h *Handler) StartWorker(ctx context.Context) error
- type InMemoryBackend
- func (b *InMemoryBackend) AddInstanceRefresh(refresh InstanceRefresh) error
- func (b *InMemoryBackend) AddLifecycleHook(hook LifecycleHook) error
- func (b *InMemoryBackend) AttachInstances(groupName string, instanceIDs []string) error
- func (b *InMemoryBackend) AttachLoadBalancerTargetGroups(groupName string, targetGroupARNs []string) error
- func (b *InMemoryBackend) AttachLoadBalancers(groupName string, loadBalancerNames []string) error
- func (b *InMemoryBackend) AttachTrafficSources(groupName string, trafficSources []TrafficSource) error
- func (b *InMemoryBackend) BatchDeleteScheduledAction(groupName string, scheduledActionNames []string) ([]FailedScheduledAction, error)
- func (b *InMemoryBackend) BatchPutScheduledUpdateGroupAction(groupName string, actions []ScheduledUpdateGroupAction) ([]FailedScheduledAction, error)
- func (b *InMemoryBackend) CancelInstanceRefresh(groupName string) (string, error)
- func (b *InMemoryBackend) Close()
- func (b *InMemoryBackend) CompleteLifecycleAction(input CompleteLifecycleActionInput) error
- func (b *InMemoryBackend) CreateAutoScalingGroup(input CreateAutoScalingGroupInput) (*AutoScalingGroup, error)
- func (b *InMemoryBackend) CreateLaunchConfiguration(input CreateLaunchConfigurationInput) (*LaunchConfiguration, error)
- func (b *InMemoryBackend) CreateOrUpdateTags(tags []ResourceTag) error
- func (b *InMemoryBackend) DeleteAutoScalingGroup(name string, forceDelete bool) error
- func (b *InMemoryBackend) DeleteLaunchConfiguration(name string) error
- func (b *InMemoryBackend) DeleteLifecycleHook(groupName, hookName string) error
- func (b *InMemoryBackend) DeleteNotificationConfiguration(groupName, topicARN string) error
- func (b *InMemoryBackend) DeletePolicy(groupName, policyNameOrARN string) error
- func (b *InMemoryBackend) DeleteScheduledAction(groupName, scheduledActionName string) error
- func (b *InMemoryBackend) DeleteTags(tags []ResourceTag) error
- func (b *InMemoryBackend) DeleteWarmPool(groupName string) error
- func (b *InMemoryBackend) DescribeAccountLimits() (*AccountLimits, error)
- func (b *InMemoryBackend) DescribeAdjustmentTypes() ([]string, error)
- func (b *InMemoryBackend) DescribeAutoScalingGroups(names []string) ([]AutoScalingGroup, error)
- func (b *InMemoryBackend) DescribeAutoScalingInstances(instanceIDs []string) ([]InstanceDetails, error)
- func (b *InMemoryBackend) DescribeAutoScalingNotificationTypes() ([]string, error)
- func (b *InMemoryBackend) DescribeInstanceRefreshes(groupName string, refreshIDs []string) ([]InstanceRefresh, error)
- func (b *InMemoryBackend) DescribeLaunchConfigurations(names []string) ([]LaunchConfiguration, error)
- func (b *InMemoryBackend) DescribeLifecycleHookTypes() ([]string, error)
- func (b *InMemoryBackend) DescribeLifecycleHooks(groupName string, hookNames []string) ([]LifecycleHook, error)
- func (b *InMemoryBackend) DescribeLoadBalancerTargetGroups(groupName string) ([]LoadBalancerTargetGroupState, error)
- func (b *InMemoryBackend) DescribeLoadBalancers(groupName string) ([]LoadBalancerState, error)
- func (b *InMemoryBackend) DescribeMetricCollectionTypes() ([]MetricCollectionType, error)
- func (b *InMemoryBackend) DescribeNotificationConfigurations(groupNames []string) ([]NotificationConfiguration, error)
- func (b *InMemoryBackend) DescribePolicies(groupName string, policyNames []string) ([]ScalingPolicy, error)
- func (b *InMemoryBackend) DescribeScalingActivities(groupName string) ([]ScalingActivity, error)
- func (b *InMemoryBackend) DescribeScalingProcessTypes() ([]string, error)
- func (b *InMemoryBackend) DescribeScheduledActions(groupName string, actionNames []string) ([]ScheduledAction, error)
- func (b *InMemoryBackend) DescribeTags(filters []TagFilter) ([]ResourceTag, error)
- func (b *InMemoryBackend) DescribeTerminationPolicyTypes() ([]string, error)
- func (b *InMemoryBackend) DescribeTrafficSources(groupName string) ([]TrafficSourceState, error)
- func (b *InMemoryBackend) DescribeWarmPool(groupName string) (*WarmPool, error)
- func (b *InMemoryBackend) DetachInstances(groupName string, instanceIDs []string, shouldDecrement bool) ([]ScalingActivity, error)
- func (b *InMemoryBackend) DetachLoadBalancerTargetGroups(groupName string, targetGroupARNs []string) error
- func (b *InMemoryBackend) DetachLoadBalancers(groupName string, lbNames []string) error
- func (b *InMemoryBackend) DetachTrafficSources(groupName string, trafficSources []TrafficSource) error
- func (b *InMemoryBackend) DisableMetricsCollection(groupName string, metrics []string) error
- func (b *InMemoryBackend) EnableMetricsCollection(groupName string, metrics []string, _ string) error
- func (b *InMemoryBackend) EnterStandby(groupName string, instanceIDs []string, decrementCapacity bool) ([]ScalingActivity, error)
- func (b *InMemoryBackend) ExecutePolicy(input ExecutePolicyInput) error
- func (b *InMemoryBackend) ExitStandby(groupName string, instanceIDs []string) ([]ScalingActivity, error)
- func (b *InMemoryBackend) GetPredictiveScalingForecast(groupName string) error
- func (b *InMemoryBackend) LaunchInstances(groupName string, count int32) ([]Instance, error)
- func (b *InMemoryBackend) Purge(ctx context.Context, cutoff time.Time)
- func (b *InMemoryBackend) PutLifecycleHook(hook LifecycleHook) error
- func (b *InMemoryBackend) PutNotificationConfiguration(groupName, topicARN string, types []string) error
- func (b *InMemoryBackend) PutScalingPolicy(input ScalingPolicyInput) (*ScalingPolicy, error)
- func (b *InMemoryBackend) PutScheduledUpdateGroupAction(groupName string, action ScheduledUpdateGroupAction) error
- func (b *InMemoryBackend) PutWarmPool(input WarmPoolInput) error
- func (b *InMemoryBackend) RecordLifecycleActionHeartbeat(input RecordLifecycleActionHeartbeatInput) error
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) ResumeProcesses(groupName string, processes []string) error
- func (b *InMemoryBackend) RollbackInstanceRefresh(groupName string) (string, error)
- func (b *InMemoryBackend) SetDesiredCapacity(groupName string, desiredCapacity int32) error
- func (b *InMemoryBackend) SetEC2Launcher(l EC2Launcher)
- func (b *InMemoryBackend) SetELBv2Registrar(r ELBv2TargetRegistrar)
- func (b *InMemoryBackend) SetInstanceHealth(instanceID string, healthStatus string, shouldRespectGracePeriod bool) error
- func (b *InMemoryBackend) SetInstanceProtection(groupName string, instanceIDs []string, protectedFromScaleIn bool) error
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) StartInstanceRefresh(groupName string) (*InstanceRefresh, error)
- func (b *InMemoryBackend) StartInstanceRefreshWithInput(input StartInstanceRefreshInput) (*InstanceRefresh, error)
- func (b *InMemoryBackend) SuspendProcesses(groupName string, processes []string) error
- func (b *InMemoryBackend) TerminateInstanceInAutoScalingGroup(instanceID string, shouldDecrement bool) (*ScalingActivity, error)
- func (b *InMemoryBackend) UpdateAutoScalingGroup(input UpdateAutoScalingGroupInput) (*AutoScalingGroup, error)
- type Instance
- type InstanceDetails
- type InstanceLaunchSpec
- type InstanceLifecyclePolicy
- type InstanceMaintenancePolicy
- type InstanceRefresh
- type InstanceRefreshPreferences
- type InstanceReusePolicy
- type InstancesDistribution
- type LaunchConfiguration
- type LaunchTemplateOverride
- type LaunchTemplateSpecification
- type LifecycleHook
- type LoadBalancerState
- type LoadBalancerTargetGroupState
- type MetricCollectionType
- type MixedInstancesLaunchTemplate
- type MixedInstancesPolicy
- type NotificationConfiguration
- type Provider
- type RecordLifecycleActionHeartbeatInput
- type ResourceTag
- type RetentionTriggers
- type ScalingActivity
- type ScalingPolicy
- type ScalingPolicyInput
- type ScheduledAction
- type ScheduledActionScheduler
- type ScheduledUpdateGroupAction
- type StartInstanceRefreshInput
- type StepAdjustment
- type StorageBackend
- type Tag
- type TagFilter
- type TrafficSource
- type TrafficSourceState
- type UpdateAutoScalingGroupInput
- type WarmPool
- type WarmPoolInput
Constants ¶
This section is empty.
Variables ¶
var ( // ErrGroupNotFound is returned when the requested Auto Scaling group does not exist. ErrGroupNotFound = errors.New("AutoScalingGroupNotFound") // ErrGroupAlreadyExists is returned when an Auto Scaling group with that name already exists. ErrGroupAlreadyExists = errors.New("AlreadyExists") // ErrLaunchConfigurationNotFound is returned when a launch configuration does not exist. ErrLaunchConfigurationNotFound = errors.New("LaunchConfigurationNotFound") // ErrLaunchConfigurationAlreadyExists is returned when a launch configuration already exists. ErrLaunchConfigurationAlreadyExists = errors.New("AlreadyExists") // ErrUnknownAction is returned when the requested action is not recognized. ErrUnknownAction = errors.New("InvalidAction") // ErrInvalidParameter is returned when a request parameter is invalid. ErrInvalidParameter = errors.New("ValidationError") // ErrActiveInstanceRefreshNotFound is returned when no active instance refresh exists. ErrActiveInstanceRefreshNotFound = errors.New("ActiveInstanceRefreshNotFound") // ErrLifecycleHookNotFound is returned when the specified lifecycle hook does not exist. ErrLifecycleHookNotFound = errors.New("ValidationError") // ErrScalingActivityInProgress is returned when a delete is attempted on a group with active instances // and ForceDelete is not set. ErrScalingActivityInProgress = errors.New("ScalingActivityInProgress") // ErrInstanceNotFound is returned when a specific instance ID is not found in an ASG. ErrInstanceNotFound = errors.New("ValidationError") // ErrWarmPoolNotFound is returned when no warm pool exists for the group. ErrWarmPoolNotFound = errors.New("ValidationError") // ErrPolicyNotFound is returned when the specified scaling policy does not exist. ErrPolicyNotFound = errors.New("ValidationError") // ErrDeletionProtected is returned when DeleteAutoScalingGroup is called on a // group whose DeletionProtection setting forbids the requested delete. // Matches the real SDK's ResourceInUseFault, whose ErrorCode() is "ResourceInUse". ErrDeletionProtected = errors.New("ResourceInUse") )
var ErrInvalidRecurrence = errors.New("invalid Recurrence cron expression")
ErrInvalidRecurrence is returned when a ScheduledUpdateGroupAction's Recurrence field is not a valid 5-field Unix cron expression.
Functions ¶
This section is empty.
Types ¶
type AccountLimits ¶
type AccountLimits struct {
MaxNumberOfAutoScalingGroups int32 `json:"MaxNumberOfAutoScalingGroups"`
MaxNumberOfLaunchConfigurations int32 `json:"MaxNumberOfLaunchConfigurations"`
NumberOfAutoScalingGroups int32 `json:"NumberOfAutoScalingGroups"`
NumberOfLaunchConfigurations int32 `json:"NumberOfLaunchConfigurations"`
}
AccountLimits represents AWS Auto Scaling account limits.
type AutoScalingGroup ¶
type AutoScalingGroup struct {
LastScalingActivity time.Time `json:"LastScalingActivity,omitzero"`
CreatedTime time.Time `json:"CreatedTime"`
LaunchTemplate *LaunchTemplateSpecification `json:"LaunchTemplate,omitempty"`
InstanceMaintenancePolicy *InstanceMaintenancePolicy `json:"InstanceMaintenancePolicy,omitempty"`
InstanceLifecyclePolicy *InstanceLifecyclePolicy `json:"InstanceLifecyclePolicy,omitempty"`
CapacityReservationSpecification *CapacityReservationSpecification `json:"CapacityReservationSpecification,omitempty"`
AvailabilityZoneImpairmentPolicy *AvailabilityZoneImpairmentPolicy `json:"AvailabilityZoneImpairmentPolicy,omitempty"`
AvailabilityZoneDistribution *AvailabilityZoneDistribution `json:"AvailabilityZoneDistribution,omitempty"`
MixedInstancesPolicy *MixedInstancesPolicy `json:"MixedInstancesPolicy,omitempty"`
DeletionProtection string `json:"DeletionProtection,omitempty"`
VPCZoneIdentifier string `json:"VPCZoneIdentifier,omitempty"`
Context string `json:"Context,omitempty"`
PlacementGroup string `json:"PlacementGroup,omitempty"`
AutoScalingGroupName string `json:"AutoScalingGroupName"`
Status string `json:"Status,omitempty"`
HealthCheckType string `json:"HealthCheckType"`
LaunchConfigurationName string `json:"LaunchConfigurationName,omitempty"`
DesiredCapacityType string `json:"DesiredCapacityType,omitempty"`
AutoScalingGroupARN string `json:"AutoScalingGroupARN"`
Instances []Instance `json:"Instances,omitempty"`
EnabledMetrics []string `json:"EnabledMetrics,omitempty"`
TerminationPolicies []string `json:"TerminationPolicies,omitempty"`
SuspendedProcesses []string `json:"SuspendedProcesses,omitempty"`
Tags []Tag `json:"Tags,omitempty"`
AvailabilityZones []string `json:"AvailabilityZones,omitempty"`
TrafficSources []TrafficSource `json:"TrafficSources,omitempty"`
TargetGroupARNs []string `json:"TargetGroupARNs,omitempty"`
LoadBalancerNames []string `json:"LoadBalancerNames,omitempty"`
MinSize int32 `json:"MinSize"`
MaxSize int32 `json:"MaxSize"`
DesiredCapacity int32 `json:"DesiredCapacity"`
DefaultCooldown int32 `json:"DefaultCooldown"`
HealthCheckGracePeriod int32 `json:"HealthCheckGracePeriod"`
MaxInstanceLifetime int32 `json:"MaxInstanceLifetime,omitempty"`
DefaultInstanceWarmup int32 `json:"DefaultInstanceWarmup,omitempty"`
NewInstancesProtectedFromScaleIn bool `json:"NewInstancesProtectedFromScaleIn,omitempty"`
CapacityRebalance bool `json:"CapacityRebalance,omitempty"`
SkipZonalShiftValidation bool `json:"SkipZonalShiftValidation,omitempty"`
}
AutoScalingGroup represents an EC2 Auto Scaling group.
type AvailabilityZoneDistribution ¶ added in v1.2.0
type AvailabilityZoneDistribution struct {
// CapacityDistributionStrategy is "balanced-only" or "balanced-best-effort".
CapacityDistributionStrategy string `json:"CapacityDistributionStrategy,omitempty"`
}
AvailabilityZoneDistribution controls how launch failures are handled across AZs.
type AvailabilityZoneImpairmentPolicy ¶ added in v1.2.0
type AvailabilityZoneImpairmentPolicy struct {
// ImpairedZoneHealthCheckBehavior is "ReplaceUnhealthy" or "IgnoreUnhealthy".
ImpairedZoneHealthCheckBehavior string `json:"ImpairedZoneHealthCheckBehavior,omitempty"`
ZonalShiftEnabled bool `json:"ZonalShiftEnabled,omitempty"`
}
AvailabilityZoneImpairmentPolicy controls instance replacement behavior during a zonal shift.
type BlockDeviceMapping ¶
type BlockDeviceMapping struct {
Ebs *EbsBlockDevice `json:"Ebs,omitempty"`
VirtualName string `json:"VirtualName,omitempty"`
DeviceName string `json:"DeviceName"`
NoDevice string `json:"NoDevice,omitempty"`
}
BlockDeviceMapping represents an EBS or ephemeral block device mapping.
type CapacityReservationSpecification ¶ added in v1.2.0
type CapacityReservationSpecification struct {
CapacityReservationTarget *CapacityReservationTarget `json:"CapacityReservationTarget,omitempty"`
// CapacityReservationPreference is one of "capacity-reservations-only",
// "capacity-reservations-first", "none", or "default".
CapacityReservationPreference string `json:"CapacityReservationPreference,omitempty"`
}
CapacityReservationSpecification controls how the group uses EC2 Capacity Reservations.
type CapacityReservationTarget ¶ added in v1.2.0
type CapacityReservationTarget struct {
CapacityReservationIDs []string `json:"CapacityReservationIds,omitempty"`
CapacityReservationResourceGroupARNs []string `json:"CapacityReservationResourceGroupArns,omitempty"`
}
CapacityReservationTarget identifies specific Capacity Reservations or resource groups to target.
type CompleteLifecycleActionInput ¶
type CompleteLifecycleActionInput struct {
AutoScalingGroupName string
LifecycleHookName string
LifecycleActionToken string
InstanceID string
LifecycleActionResult string
}
CompleteLifecycleActionInput holds the input for CompleteLifecycleAction.
type CreateAutoScalingGroupInput ¶
type CreateAutoScalingGroupInput struct {
MixedInstancesPolicy *MixedInstancesPolicy
LaunchTemplate *LaunchTemplateSpecification
AvailabilityZoneDistribution *AvailabilityZoneDistribution
AvailabilityZoneImpairmentPolicy *AvailabilityZoneImpairmentPolicy
CapacityReservationSpecification *CapacityReservationSpecification
InstanceLifecyclePolicy *InstanceLifecyclePolicy
InstanceMaintenancePolicy *InstanceMaintenancePolicy
AutoScalingGroupName string
LaunchConfigurationName string
HealthCheckType string
VPCZoneIdentifier string
PlacementGroup string
Context string
DesiredCapacityType string
DeletionProtection string
LoadBalancerNames []string
TargetGroupARNs []string
TerminationPolicies []string
Tags []Tag
AvailabilityZones []string
TrafficSources []TrafficSource
LifecycleHookSpecificationList []LifecycleHook
MinSize int32
DefaultCooldown int32
HealthCheckGracePeriod int32
MaxInstanceLifetime int32
DefaultInstanceWarmup int32
MaxSize int32
DesiredCapacity int32
NewInstancesProtectedFromScaleIn bool
CapacityRebalance bool
SkipZonalShiftValidation bool
}
CreateAutoScalingGroupInput holds the input for CreateAutoScalingGroup.
type CreateLaunchConfigurationInput ¶
type CreateLaunchConfigurationInput struct {
LaunchConfigurationName string
ImageID string
InstanceType string
KeyName string
IAMInstanceProfile string
UserData string
KernelID string
RamdiskID string
SpotPrice string
PlacementTenancy string
ClassicLinkVPCID string
SecurityGroups []string
ClassicLinkVPCSecurityGroups []string
BlockDeviceMappings []BlockDeviceMapping
AssociatePublicIPAddress bool
EbsOptimized bool
InstanceMonitoring bool
}
CreateLaunchConfigurationInput holds the input for CreateLaunchConfiguration.
type EC2Launcher ¶
type EC2Launcher interface {
// LaunchInstances launches count instances per spec and returns the real
// EC2 instance IDs created. A partial success (fewer IDs than count) is
// treated as the actual outcome, not an error.
LaunchInstances(ctx context.Context, spec InstanceLaunchSpec, count int) ([]string, error)
// TerminateInstances terminates the given real EC2 instance IDs.
TerminateInstances(ctx context.Context, ids []string) error
}
EC2Launcher lets the Auto Scaling backend create and destroy real (mock) EC2 instances backing an Auto Scaling group's members, so instances an ASG scales out are visible to EC2 DescribeInstances and instances it scales in are actually terminated there too. When no EC2Launcher is configured (the default), the backend falls back to its historical behavior of fabricating instance IDs with no EC2-side record — see SetEC2Launcher.
Only groups using a LaunchConfiguration resolve to a launch spec today (ImageId/InstanceType/KeyName/SecurityGroups all live on LaunchConfiguration and are directly readable here). Groups using LaunchTemplate or MixedInstancesPolicy still fabricate instances even with a launcher configured, because the EC2 backend does not currently expose a way to resolve a launch template ID/name+version to its ImageId/InstanceType from outside the ec2 package.
type ELBTarget ¶
ELBTarget identifies a single ELBv2 target to register or deregister. ID is the EC2 instance ID. Port is left zero so the target group's own configured port applies, matching how ELBv2 RegisterTargets/DeregisterTargets default an omitted target port from the target group itself.
type ELBv2TargetRegistrar ¶
type ELBv2TargetRegistrar interface {
// RegisterTargets registers targets with the given target group.
RegisterTargets(ctx context.Context, targetGroupARN string, targets []ELBTarget) error
// DeregisterTargets deregisters targets from the given target group.
DeregisterTargets(ctx context.Context, targetGroupARN string, targets []ELBTarget) error
}
ELBv2TargetRegistrar lets the Auto Scaling backend register/deregister real ELBv2 targets as group membership and TargetGroupARNs change, so ELBv2 DescribeTargetHealth reflects ASG-managed instances instead of TargetGroupARNs/LoadBalancerNames being stored and echoed with no effect. When no registrar is configured (the default), behavior is unchanged from before this feature existed.
type EbsBlockDevice ¶
type EbsBlockDevice struct {
SnapshotID string `json:"SnapshotId,omitempty"`
VolumeType string `json:"VolumeType,omitempty"`
KmsKeyID string `json:"KmsKeyId,omitempty"`
VolumeSize int32 `json:"VolumeSize,omitempty"`
Iops int32 `json:"Iops,omitempty"`
Throughput int32 `json:"Throughput,omitempty"`
DeleteOnTermination bool `json:"DeleteOnTermination,omitempty"`
Encrypted bool `json:"Encrypted,omitempty"`
}
EbsBlockDevice describes an EBS volume configuration in a block device mapping.
type ExecutePolicyInput ¶
type ExecutePolicyInput struct {
MetricValue *float64
BreachThreshold *float64
AutoScalingGroupName string
PolicyName string
HonorCooldown bool
}
ExecutePolicyInput holds the input for ExecutePolicy. MetricValue and BreachThreshold are required (and only meaningful) when the target policy's PolicyType is StepScaling: AWS uses (MetricValue-BreachThreshold) to select which StepAdjustment interval applies.
type FailedScheduledAction ¶
type FailedScheduledAction struct {
ScheduledActionName string `json:"ScheduledActionName"`
ErrorCode string `json:"ErrorCode"`
ErrorMessage string `json:"ErrorMessage"`
}
FailedScheduledAction represents a scheduled action that failed during a batch operation.
type Handler ¶
type Handler struct {
Backend StorageBackend
// contains filtered or unexported fields
}
Handler is the Echo HTTP handler for Autoscaling operations.
func NewHandler ¶
func NewHandler(backend StorageBackend) *Handler
NewHandler creates a new Autoscaling handler. If backend is an *InMemoryBackend, a ScheduledActionScheduler is attached automatically (see StartWorker/Shutdown) so PutScheduledUpdateGroupAction/ BatchPutScheduledUpdateGroupAction actions actually fire at their scheduled time instead of only being reflected by DescribeScheduledActions.
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 Autoscaling action from the request.
func (*Handler) ExtractResource ¶
ExtractResource extracts the Auto Scaling group name from the request.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations returns the list of supported Autoscaling operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler function for Autoscaling operations.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) Purge ¶
Purge implements service.Purgeable by removing all Auto Scaling resources older than cutoff.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a function that matches Autoscaling requests. Autoscaling requests are form-encoded POSTs with Version=2011-01-01.
func (*Handler) Shutdown ¶
Shutdown stops the scheduled-action scheduler and the backend's in-flight lifecycle-hook timers so no goroutine outlives the service. Invoked on server shutdown via service.Shutdowner.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend implements StorageBackend using in-memory maps.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
NewInMemoryBackend creates a new InMemoryBackend.
func (*InMemoryBackend) AddInstanceRefresh ¶
func (b *InMemoryBackend) AddInstanceRefresh(refresh InstanceRefresh) error
AddInstanceRefresh stores an instance refresh for the given group (used for testing CancelInstanceRefresh).
func (*InMemoryBackend) AddLifecycleHook ¶
func (b *InMemoryBackend) AddLifecycleHook(hook LifecycleHook) error
AddLifecycleHook stores a lifecycle hook for the given group. This is the backend helper used by PutLifecycleHook and by tests.
func (*InMemoryBackend) AttachInstances ¶
func (b *InMemoryBackend) AttachInstances(groupName string, instanceIDs []string) error
AttachInstances adds the given instance IDs to the specified Auto Scaling group.
func (*InMemoryBackend) AttachLoadBalancerTargetGroups ¶
func (b *InMemoryBackend) AttachLoadBalancerTargetGroups(groupName string, targetGroupARNs []string) error
AttachLoadBalancerTargetGroups adds target group ARNs to the specified Auto Scaling group.
func (*InMemoryBackend) AttachLoadBalancers ¶
func (b *InMemoryBackend) AttachLoadBalancers(groupName string, loadBalancerNames []string) error
AttachLoadBalancers adds load balancer names to the specified Auto Scaling group.
func (*InMemoryBackend) AttachTrafficSources ¶
func (b *InMemoryBackend) AttachTrafficSources(groupName string, trafficSources []TrafficSource) error
AttachTrafficSources adds traffic sources to the specified Auto Scaling group.
func (*InMemoryBackend) BatchDeleteScheduledAction ¶
func (b *InMemoryBackend) BatchDeleteScheduledAction( groupName string, scheduledActionNames []string, ) ([]FailedScheduledAction, error)
BatchDeleteScheduledAction removes the named scheduled actions from the group. Actions that cannot be found are returned as failures.
func (*InMemoryBackend) BatchPutScheduledUpdateGroupAction ¶
func (b *InMemoryBackend) BatchPutScheduledUpdateGroupAction( groupName string, actions []ScheduledUpdateGroupAction, ) ([]FailedScheduledAction, error)
BatchPutScheduledUpdateGroupAction creates or updates scheduled actions for the group.
func (*InMemoryBackend) CancelInstanceRefresh ¶
func (b *InMemoryBackend) CancelInstanceRefresh(groupName string) (string, error)
CancelInstanceRefresh cancels an active instance refresh for the group. It returns the ID of the cancelled refresh.
func (*InMemoryBackend) Close ¶
func (b *InMemoryBackend) Close()
Close stops any in-flight lifecycle-hook expiry timers so their goroutines do not outlive the backend. It is safe to call multiple times.
func (*InMemoryBackend) CompleteLifecycleAction ¶
func (b *InMemoryBackend) CompleteLifecycleAction(input CompleteLifecycleActionInput) error
CompleteLifecycleAction completes a lifecycle action for the given group and hook.
func (*InMemoryBackend) CreateAutoScalingGroup ¶
func (b *InMemoryBackend) CreateAutoScalingGroup(input CreateAutoScalingGroupInput) (*AutoScalingGroup, error)
CreateAutoScalingGroup creates a new Auto Scaling group.
func (*InMemoryBackend) CreateLaunchConfiguration ¶
func (b *InMemoryBackend) CreateLaunchConfiguration( input CreateLaunchConfigurationInput, ) (*LaunchConfiguration, error)
CreateLaunchConfiguration creates a new launch configuration.
func (*InMemoryBackend) CreateOrUpdateTags ¶
func (b *InMemoryBackend) CreateOrUpdateTags(tags []ResourceTag) error
CreateOrUpdateTags creates or updates tags on Auto Scaling resources. Only group (auto-scaling-group) resource tags are currently supported.
func (*InMemoryBackend) DeleteAutoScalingGroup ¶
func (b *InMemoryBackend) DeleteAutoScalingGroup(name string, forceDelete bool) error
DeleteAutoScalingGroup removes an Auto Scaling group by name. When forceDelete is false, AWS rejects the delete if the group has active instances.
func (*InMemoryBackend) DeleteLaunchConfiguration ¶
func (b *InMemoryBackend) DeleteLaunchConfiguration(name string) error
DeleteLaunchConfiguration removes a launch configuration by name.
func (*InMemoryBackend) DeleteLifecycleHook ¶
func (b *InMemoryBackend) DeleteLifecycleHook(groupName, hookName string) error
DeleteLifecycleHook removes a lifecycle hook from the specified Auto Scaling group.
func (*InMemoryBackend) DeleteNotificationConfiguration ¶
func (b *InMemoryBackend) DeleteNotificationConfiguration(groupName, topicARN string) error
DeleteNotificationConfiguration removes notification configs for a group+topic.
func (*InMemoryBackend) DeletePolicy ¶
func (b *InMemoryBackend) DeletePolicy(groupName, policyNameOrARN string) error
DeletePolicy removes a scaling policy from the ASG.
func (*InMemoryBackend) DeleteScheduledAction ¶
func (b *InMemoryBackend) DeleteScheduledAction(groupName, scheduledActionName string) error
DeleteScheduledAction removes a single scheduled action from the ASG.
func (*InMemoryBackend) DeleteTags ¶
func (b *InMemoryBackend) DeleteTags(tags []ResourceTag) error
DeleteTags removes tags from Auto Scaling resources. Only auto-scaling-group resource tags are supported.
func (*InMemoryBackend) DeleteWarmPool ¶
func (b *InMemoryBackend) DeleteWarmPool(groupName string) error
DeleteWarmPool removes the warm pool for the ASG.
func (*InMemoryBackend) DescribeAccountLimits ¶
func (b *InMemoryBackend) DescribeAccountLimits() (*AccountLimits, error)
DescribeAccountLimits returns account limits for Auto Scaling.
func (*InMemoryBackend) DescribeAdjustmentTypes ¶
func (b *InMemoryBackend) DescribeAdjustmentTypes() ([]string, error)
DescribeAdjustmentTypes returns the supported scaling adjustment types.
func (*InMemoryBackend) DescribeAutoScalingGroups ¶
func (b *InMemoryBackend) DescribeAutoScalingGroups(names []string) ([]AutoScalingGroup, error)
DescribeAutoScalingGroups returns Auto Scaling groups, optionally filtered by name.
func (*InMemoryBackend) DescribeAutoScalingInstances ¶
func (b *InMemoryBackend) DescribeAutoScalingInstances(instanceIDs []string) ([]InstanceDetails, error)
DescribeAutoScalingInstances returns instance details across all ASGs, optionally filtered by instance ID.
func (*InMemoryBackend) DescribeAutoScalingNotificationTypes ¶
func (b *InMemoryBackend) DescribeAutoScalingNotificationTypes() ([]string, error)
DescribeAutoScalingNotificationTypes returns the supported notification types.
func (*InMemoryBackend) DescribeInstanceRefreshes ¶
func (b *InMemoryBackend) DescribeInstanceRefreshes(groupName string, refreshIDs []string) ([]InstanceRefresh, error)
DescribeInstanceRefreshes returns instance refreshes for the group, optionally filtered by ID.
func (*InMemoryBackend) DescribeLaunchConfigurations ¶
func (b *InMemoryBackend) DescribeLaunchConfigurations(names []string) ([]LaunchConfiguration, error)
DescribeLaunchConfigurations returns launch configurations, optionally filtered by name.
func (*InMemoryBackend) DescribeLifecycleHookTypes ¶
func (b *InMemoryBackend) DescribeLifecycleHookTypes() ([]string, error)
DescribeLifecycleHookTypes returns the supported lifecycle hook transition types.
func (*InMemoryBackend) DescribeLifecycleHooks ¶
func (b *InMemoryBackend) DescribeLifecycleHooks(groupName string, hookNames []string) ([]LifecycleHook, error)
DescribeLifecycleHooks returns lifecycle hooks for the given group, optionally filtered by name.
func (*InMemoryBackend) DescribeLoadBalancerTargetGroups ¶
func (b *InMemoryBackend) DescribeLoadBalancerTargetGroups(groupName string) ([]LoadBalancerTargetGroupState, error)
DescribeLoadBalancerTargetGroups returns the target groups attached to the group.
func (*InMemoryBackend) DescribeLoadBalancers ¶
func (b *InMemoryBackend) DescribeLoadBalancers(groupName string) ([]LoadBalancerState, error)
DescribeLoadBalancers returns the load balancers attached to the group.
func (*InMemoryBackend) DescribeMetricCollectionTypes ¶
func (b *InMemoryBackend) DescribeMetricCollectionTypes() ([]MetricCollectionType, error)
DescribeMetricCollectionTypes returns the supported metric collection types.
func (*InMemoryBackend) DescribeNotificationConfigurations ¶
func (b *InMemoryBackend) DescribeNotificationConfigurations(groupNames []string) ([]NotificationConfiguration, error)
DescribeNotificationConfigurations returns notification configs for the given groups.
func (*InMemoryBackend) DescribePolicies ¶
func (b *InMemoryBackend) DescribePolicies(groupName string, policyNames []string) ([]ScalingPolicy, error)
DescribePolicies returns scaling policies for the given group, optionally filtered by name.
func (*InMemoryBackend) DescribeScalingActivities ¶
func (b *InMemoryBackend) DescribeScalingActivities(groupName string) ([]ScalingActivity, error)
DescribeScalingActivities returns scaling activities for the given group.
func (*InMemoryBackend) DescribeScalingProcessTypes ¶
func (b *InMemoryBackend) DescribeScalingProcessTypes() ([]string, error)
DescribeScalingProcessTypes returns the supported scaling process types.
func (*InMemoryBackend) DescribeScheduledActions ¶
func (b *InMemoryBackend) DescribeScheduledActions( groupName string, actionNames []string, ) ([]ScheduledAction, error)
DescribeScheduledActions returns scheduled actions for the given group, optionally filtered by name.
func (*InMemoryBackend) DescribeTags ¶
func (b *InMemoryBackend) DescribeTags(filters []TagFilter) ([]ResourceTag, error)
DescribeTags returns tags for Auto Scaling resources, with optional filtering.
func (*InMemoryBackend) DescribeTerminationPolicyTypes ¶
func (b *InMemoryBackend) DescribeTerminationPolicyTypes() ([]string, error)
DescribeTerminationPolicyTypes returns the supported termination policy types.
func (*InMemoryBackend) DescribeTrafficSources ¶
func (b *InMemoryBackend) DescribeTrafficSources(groupName string) ([]TrafficSourceState, error)
DescribeTrafficSources returns the traffic sources attached to the group.
func (*InMemoryBackend) DescribeWarmPool ¶
func (b *InMemoryBackend) DescribeWarmPool(groupName string) (*WarmPool, error)
DescribeWarmPool returns the warm pool configuration for the ASG.
func (*InMemoryBackend) DetachInstances ¶
func (b *InMemoryBackend) DetachInstances( groupName string, instanceIDs []string, shouldDecrement bool, ) ([]ScalingActivity, error)
DetachInstances removes instances from the ASG, optionally decrementing desired capacity.
func (*InMemoryBackend) DetachLoadBalancerTargetGroups ¶
func (b *InMemoryBackend) DetachLoadBalancerTargetGroups(groupName string, targetGroupARNs []string) error
DetachLoadBalancerTargetGroups removes target group ARNs from the ASG.
func (*InMemoryBackend) DetachLoadBalancers ¶
func (b *InMemoryBackend) DetachLoadBalancers(groupName string, lbNames []string) error
DetachLoadBalancers removes load balancer names from the ASG.
func (*InMemoryBackend) DetachTrafficSources ¶
func (b *InMemoryBackend) DetachTrafficSources(groupName string, trafficSources []TrafficSource) error
DetachTrafficSources removes traffic sources from the ASG.
func (*InMemoryBackend) DisableMetricsCollection ¶
func (b *InMemoryBackend) DisableMetricsCollection(groupName string, metrics []string) error
DisableMetricsCollection removes metrics from the ASG's enabled metrics list.
func (*InMemoryBackend) EnableMetricsCollection ¶
func (b *InMemoryBackend) EnableMetricsCollection(groupName string, metrics []string, _ string) error
EnableMetricsCollection adds metrics to the ASG's enabled metrics list.
func (*InMemoryBackend) EnterStandby ¶
func (b *InMemoryBackend) EnterStandby( groupName string, instanceIDs []string, decrementCapacity bool, ) ([]ScalingActivity, error)
EnterStandby puts instances into standby mode.
func (*InMemoryBackend) ExecutePolicy ¶
func (b *InMemoryBackend) ExecutePolicy(input ExecutePolicyInput) error
ExecutePolicy executes a scaling policy on the ASG.
func (*InMemoryBackend) ExitStandby ¶
func (b *InMemoryBackend) ExitStandby(groupName string, instanceIDs []string) ([]ScalingActivity, error)
ExitStandby moves instances from standby back to InService.
func (*InMemoryBackend) GetPredictiveScalingForecast ¶
func (b *InMemoryBackend) GetPredictiveScalingForecast(groupName string) error
GetPredictiveScalingForecast validates the group exists (stub implementation).
func (*InMemoryBackend) LaunchInstances ¶
func (b *InMemoryBackend) LaunchInstances(groupName string, count int32) ([]Instance, error)
LaunchInstances adds new instances to the ASG.
func (*InMemoryBackend) Purge ¶
func (b *InMemoryBackend) Purge(ctx context.Context, cutoff time.Time)
Purge removes all AutoScaling groups and launch configurations created before the cutoff time.
func (*InMemoryBackend) PutLifecycleHook ¶
func (b *InMemoryBackend) PutLifecycleHook(hook LifecycleHook) error
PutLifecycleHook creates or updates a lifecycle hook on an Auto Scaling group.
func (*InMemoryBackend) PutNotificationConfiguration ¶
func (b *InMemoryBackend) PutNotificationConfiguration(groupName, topicARN string, types []string) error
PutNotificationConfiguration stores or updates a notification configuration.
func (*InMemoryBackend) PutScalingPolicy ¶
func (b *InMemoryBackend) PutScalingPolicy(input ScalingPolicyInput) (*ScalingPolicy, error)
PutScalingPolicy creates or updates a scaling policy.
func (*InMemoryBackend) PutScheduledUpdateGroupAction ¶
func (b *InMemoryBackend) PutScheduledUpdateGroupAction(groupName string, action ScheduledUpdateGroupAction) error
PutScheduledUpdateGroupAction creates or updates a single scheduled action.
func (*InMemoryBackend) PutWarmPool ¶
func (b *InMemoryBackend) PutWarmPool(input WarmPoolInput) error
PutWarmPool creates or updates a warm pool configuration for the ASG.
func (*InMemoryBackend) RecordLifecycleActionHeartbeat ¶
func (b *InMemoryBackend) RecordLifecycleActionHeartbeat(input RecordLifecycleActionHeartbeatInput) error
RecordLifecycleActionHeartbeat resets or validates a lifecycle action heartbeat.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore populates the backend from a JSON payload.
func (*InMemoryBackend) ResumeProcesses ¶
func (b *InMemoryBackend) ResumeProcesses(groupName string, processes []string) error
ResumeProcesses removes processes from the ASG's suspended processes list.
func (*InMemoryBackend) RollbackInstanceRefresh ¶
func (b *InMemoryBackend) RollbackInstanceRefresh(groupName string) (string, error)
RollbackInstanceRefresh rolls back an in-progress instance refresh for the group.
func (*InMemoryBackend) SetDesiredCapacity ¶
func (b *InMemoryBackend) SetDesiredCapacity(groupName string, desiredCapacity int32) error
SetDesiredCapacity adjusts the DesiredCapacity of an Auto Scaling group immediately.
func (*InMemoryBackend) SetEC2Launcher ¶
func (b *InMemoryBackend) SetEC2Launcher(l EC2Launcher)
SetEC2Launcher wires an EC2Launcher so subsequent scale-out/scale-in operations launch and terminate real (mock) EC2 instances instead of fabricating instance IDs. Passing nil restores the historical, fabrication-only behavior. Intended to be called once during service wiring, before the backend serves traffic.
func (*InMemoryBackend) SetELBv2Registrar ¶
func (b *InMemoryBackend) SetELBv2Registrar(r ELBv2TargetRegistrar)
SetELBv2Registrar wires an ELBv2TargetRegistrar so subsequent instance launches/terminations and TargetGroupARNs attach/detach calls register or deregister real ELBv2 targets. Passing nil restores the historical, registration-less behavior. Intended to be called once during service wiring, before the backend serves traffic.
func (*InMemoryBackend) SetInstanceHealth ¶
func (b *InMemoryBackend) SetInstanceHealth( instanceID string, healthStatus string, shouldRespectGracePeriod bool, ) error
SetInstanceHealth sets the health status of an instance across all ASGs. When shouldRespectGracePeriod is true and the instance launched within the group's HealthCheckGracePeriod, the unhealthy mark is silently ignored (AWS behavior).
func (*InMemoryBackend) SetInstanceProtection ¶
func (b *InMemoryBackend) SetInstanceProtection( groupName string, instanceIDs []string, protectedFromScaleIn bool, ) error
SetInstanceProtection sets the protected-from-scale-in flag on instances.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises the backend state to JSON.
func (*InMemoryBackend) StartInstanceRefresh ¶
func (b *InMemoryBackend) StartInstanceRefresh(groupName string) (*InstanceRefresh, error)
StartInstanceRefresh creates a new instance refresh for the group.
func (*InMemoryBackend) StartInstanceRefreshWithInput ¶
func (b *InMemoryBackend) StartInstanceRefreshWithInput(input StartInstanceRefreshInput) (*InstanceRefresh, error)
StartInstanceRefreshWithInput creates a new instance refresh for the group with full input.
func (*InMemoryBackend) SuspendProcesses ¶
func (b *InMemoryBackend) SuspendProcesses(groupName string, processes []string) error
SuspendProcesses adds processes to the ASG's suspended processes list.
func (*InMemoryBackend) TerminateInstanceInAutoScalingGroup ¶
func (b *InMemoryBackend) TerminateInstanceInAutoScalingGroup( instanceID string, shouldDecrement bool, ) (*ScalingActivity, error)
TerminateInstanceInAutoScalingGroup terminates a specific instance in an ASG. When shouldDecrement is true, MinSize is decremented (capped at 0) and DesiredCapacity is decreased by 1 without a replacement. Otherwise a replacement is launched.
func (*InMemoryBackend) UpdateAutoScalingGroup ¶
func (b *InMemoryBackend) UpdateAutoScalingGroup(input UpdateAutoScalingGroupInput) (*AutoScalingGroup, error)
UpdateAutoScalingGroup updates an existing Auto Scaling group.
type Instance ¶
type Instance struct {
LaunchTime time.Time `json:"LaunchTime,omitzero"`
InstanceID string `json:"InstanceID"`
AvailabilityZone string `json:"AvailabilityZone"`
LifecycleState string `json:"LifecycleState"`
HealthStatus string `json:"HealthStatus"`
LaunchConfigurationName string `json:"LaunchConfigurationName,omitempty"`
InstanceType string `json:"InstanceType,omitempty"`
ProtectedFromScaleIn bool `json:"ProtectedFromScaleIn,omitempty"`
}
Instance represents an EC2 instance in an Auto Scaling group.
type InstanceDetails ¶
type InstanceDetails struct {
AutoScalingGroupName string `json:"AutoScalingGroupName"`
InstanceID string `json:"InstanceId"`
AvailabilityZone string `json:"AvailabilityZone"`
LifecycleState string `json:"LifecycleState"`
HealthStatus string `json:"HealthStatus"`
LaunchConfigurationName string `json:"LaunchConfigurationName,omitempty"`
InstanceType string `json:"InstanceType,omitempty"`
ProtectedFromScaleIn bool `json:"ProtectedFromScaleIn"`
}
InstanceDetails holds detailed information about an EC2 instance in an ASG.
type InstanceLaunchSpec ¶
type InstanceLaunchSpec struct {
Tags map[string]string
ImageID string
InstanceType string
SubnetID string
AvailabilityZone string
KeyName string
SecurityGroups []string
}
InstanceLaunchSpec carries the EC2 launch parameters an Auto Scaling group derives from its LaunchConfiguration (LaunchTemplate/MixedInstancesPolicy support is a follow-up — see EC2Launcher doc comment) for a single scale-out batch, passed to an EC2Launcher so it can create real backing EC2 instances.
type InstanceLifecyclePolicy ¶ added in v1.2.0
type InstanceLifecyclePolicy struct {
RetentionTriggers *RetentionTriggers `json:"RetentionTriggers,omitempty"`
}
InstanceLifecyclePolicy controls instance retention behavior on lifecycle transitions.
type InstanceMaintenancePolicy ¶ added in v1.2.0
type InstanceMaintenancePolicy struct {
MinHealthyPercentage *int32 `json:"MinHealthyPercentage,omitempty"`
MaxHealthyPercentage *int32 `json:"MaxHealthyPercentage,omitempty"`
}
InstanceMaintenancePolicy bounds the in-service/healthy percentage window used when replacing instances. Pointers distinguish "unset" from the valid value 0 (and the AWS "-1 clears a previously set value" sentinel).
type InstanceRefresh ¶
type InstanceRefresh struct {
StartTime time.Time `json:"StartTime"`
EndTime time.Time `json:"EndTime,omitzero"`
InstanceRefreshID string `json:"InstanceRefreshId"`
AutoScalingGroupName string `json:"AutoScalingGroupName"`
Status string `json:"Status"`
StatusReason string `json:"StatusReason,omitempty"`
// Strategy is the instance refresh strategy; defaults to "Rolling".
Strategy string `json:"Strategy,omitempty"`
Preferences InstanceRefreshPreferences `json:"Preferences"`
PercentageComplete int32 `json:"PercentageComplete,omitempty"`
InstancesToUpdate int32 `json:"InstancesToUpdate,omitempty"`
}
InstanceRefresh represents an instance refresh operation for an Auto Scaling group.
type InstanceRefreshPreferences ¶
type InstanceRefreshPreferences struct {
ScaleInProtectedInstances string `json:"ScaleInProtectedInstances,omitempty"`
StandbyInstances string `json:"StandbyInstances,omitempty"`
CheckpointPercentages []int32 `json:"CheckpointPercentages,omitempty"`
MinHealthyPercentage int32 `json:"MinHealthyPercentage,omitempty"`
MaxHealthyPercentage int32 `json:"MaxHealthyPercentage,omitempty"`
InstanceWarmup int32 `json:"InstanceWarmup,omitempty"`
CheckpointDelay int32 `json:"CheckpointDelay,omitempty"`
SkipMatching bool `json:"SkipMatching,omitempty"`
AutoRollback bool `json:"AutoRollback,omitempty"`
}
InstanceRefreshPreferences holds the preferences for an instance refresh operation.
type InstanceReusePolicy ¶
type InstanceReusePolicy struct {
ReuseOnScaleIn bool `json:"ReuseOnScaleIn,omitempty"`
}
InstanceReusePolicy controls whether warm-pool instances are reused on scale-in.
type InstancesDistribution ¶
type InstancesDistribution struct {
OnDemandAllocationStrategy string `json:"OnDemandAllocationStrategy,omitempty"`
SpotAllocationStrategy string `json:"SpotAllocationStrategy,omitempty"`
SpotMaxPrice string `json:"SpotMaxPrice,omitempty"`
OnDemandBaseCapacity int32 `json:"OnDemandBaseCapacity,omitempty"`
OnDemandPercentageAboveBaseCapacity int32 `json:"OnDemandPercentageAboveBaseCapacity,omitempty"`
SpotInstancePools int32 `json:"SpotInstancePools,omitempty"`
}
InstancesDistribution controls on-demand vs spot allocation in MixedInstancesPolicy.
type LaunchConfiguration ¶
type LaunchConfiguration struct {
CreatedTime time.Time `json:"CreatedTime"`
LaunchConfigurationName string `json:"LaunchConfigurationName"`
LaunchConfigurationARN string `json:"LaunchConfigurationARN"`
ImageID string `json:"ImageID"`
InstanceType string `json:"InstanceType"`
KeyName string `json:"KeyName,omitempty"`
IAMInstanceProfile string `json:"IAMInstanceProfile,omitempty"`
UserData string `json:"UserData,omitempty"`
KernelID string `json:"KernelID,omitempty"`
RamdiskID string `json:"RamdiskID,omitempty"`
SpotPrice string `json:"SpotPrice,omitempty"`
PlacementTenancy string `json:"PlacementTenancy,omitempty"`
ClassicLinkVPCID string `json:"ClassicLinkVpcId,omitempty"`
BlockDeviceMappings []BlockDeviceMapping `json:"BlockDeviceMappings,omitempty"`
ClassicLinkVPCSecurityGroups []string `json:"ClassicLinkVpcSecurityGroups,omitempty"`
SecurityGroups []string `json:"SecurityGroups,omitempty"`
AssociatePublicIPAddress bool `json:"AssociatePublicIpAddress,omitempty"`
EbsOptimized bool `json:"EbsOptimized,omitempty"`
InstanceMonitoring bool `json:"InstanceMonitoring,omitempty"`
}
LaunchConfiguration represents an Auto Scaling launch configuration.
type LaunchTemplateOverride ¶
type LaunchTemplateOverride struct {
InstanceType string `json:"InstanceType,omitempty"`
LaunchTemplateSpecification *LaunchTemplateSpecification `json:"LaunchTemplateSpecification,omitempty"`
WeightedCapacity string `json:"WeightedCapacity,omitempty"`
}
LaunchTemplateOverride allows specifying per-instance-type overrides in a MixedInstancesPolicy.
type LaunchTemplateSpecification ¶
type LaunchTemplateSpecification struct {
LaunchTemplateID string `json:"LaunchTemplateId,omitempty"`
LaunchTemplateName string `json:"LaunchTemplateName,omitempty"`
Version string `json:"Version,omitempty"`
}
LaunchTemplateSpecification identifies an EC2 launch template.
type LifecycleHook ¶
type LifecycleHook struct {
LifecycleHookName string `json:"LifecycleHookName"`
AutoScalingGroupName string `json:"AutoScalingGroupName"`
LifecycleTransition string `json:"LifecycleTransition,omitempty"`
DefaultResult string `json:"DefaultResult,omitempty"`
NotificationTargetARN string `json:"NotificationTargetARN,omitempty"`
NotificationMetadata string `json:"NotificationMetadata,omitempty"`
RoleARN string `json:"RoleARN,omitempty"`
HeartbeatTimeout int32 `json:"HeartbeatTimeout,omitempty"`
GlobalTimeout int32 `json:"GlobalTimeout,omitempty"`
}
LifecycleHook represents a lifecycle hook attached to an Auto Scaling group.
type LoadBalancerState ¶
type LoadBalancerState struct {
LoadBalancerName string `json:"LoadBalancerName"`
State string `json:"State"`
}
LoadBalancerState represents the state of a load balancer attached to an ASG.
type LoadBalancerTargetGroupState ¶
type LoadBalancerTargetGroupState struct {
LoadBalancerTargetGroupARN string `json:"LoadBalancerTargetGroupARN"`
State string `json:"State"`
}
LoadBalancerTargetGroupState represents the state of a target group attached to an ASG.
type MetricCollectionType ¶
type MetricCollectionType struct {
Metric string `json:"Metric"`
Granularity string `json:"Granularity,omitempty"`
}
MetricCollectionType represents a type of metric that can be collected.
type MixedInstancesLaunchTemplate ¶
type MixedInstancesLaunchTemplate struct {
LaunchTemplateSpecification LaunchTemplateSpecification `json:"LaunchTemplateSpecification"`
Overrides []LaunchTemplateOverride `json:"Overrides,omitempty"`
}
MixedInstancesLaunchTemplate is the launch template component of MixedInstancesPolicy.
type MixedInstancesPolicy ¶
type MixedInstancesPolicy struct {
LaunchTemplate MixedInstancesLaunchTemplate `json:"LaunchTemplate"`
InstancesDistribution InstancesDistribution `json:"InstancesDistribution"`
}
MixedInstancesPolicy allows combining on-demand and spot instances with multiple instance types.
type NotificationConfiguration ¶
type NotificationConfiguration struct {
AutoScalingGroupName string `json:"AutoScalingGroupName"`
TopicARN string `json:"TopicARN"`
NotificationType string `json:"NotificationType"`
}
NotificationConfiguration represents a notification configuration for an Auto Scaling group.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for the Autoscaling service.
func (*Provider) Init ¶
func (p *Provider) Init(_ *service.AppContext) (service.Registerable, error)
Init initializes the Autoscaling backend and handler.
type RecordLifecycleActionHeartbeatInput ¶
type RecordLifecycleActionHeartbeatInput struct {
AutoScalingGroupName string
LifecycleHookName string
LifecycleActionToken string
InstanceID string
}
RecordLifecycleActionHeartbeatInput holds the input for RecordLifecycleActionHeartbeat.
type ResourceTag ¶
type ResourceTag struct {
ResourceID string `json:"ResourceId"`
ResourceType string `json:"ResourceType"`
Key string `json:"Key"`
Value string `json:"Value"`
PropagateAtLaunch bool `json:"PropagateAtLaunch,omitempty"`
}
ResourceTag is a tag scoped to a specific resource (used by CreateOrUpdateTags).
type RetentionTriggers ¶ added in v1.2.0
type RetentionTriggers struct {
// TerminateHookAbandon is "retain" or "terminate".
TerminateHookAbandon string `json:"TerminateHookAbandon,omitempty"`
}
RetentionTriggers defines the failure conditions that move an instance to a Retained state instead of terminating it.
type ScalingActivity ¶
type ScalingActivity struct {
StartTime time.Time `json:"StartTime"`
EndTime time.Time `json:"EndTime"`
ActivityID string `json:"ActivityID"`
AutoScalingGroupName string `json:"AutoScalingGroupName"`
Description string `json:"Description,omitempty"`
StatusCode string `json:"StatusCode"`
StatusMessage string `json:"StatusMessage,omitempty"`
Progress int32 `json:"Progress"`
}
ScalingActivity represents an Auto Scaling activity.
type ScalingPolicy ¶
type ScalingPolicy struct {
CustomizedMetricSpecification string `json:"CustomizedMetricSpecification,omitempty"`
PolicyName string `json:"PolicyName"`
AutoScalingGroupName string `json:"AutoScalingGroupName"`
PolicyType string `json:"PolicyType,omitempty"`
AdjustmentType string `json:"AdjustmentType,omitempty"`
MetricType string `json:"MetricType,omitempty"`
CustomMetricSpec string `json:"CustomMetricSpec,omitempty"`
MetricAggregationType string `json:"MetricAggregationType,omitempty"`
PolicyARN string `json:"PolicyARN"`
StepAdjustments []StepAdjustment `json:"StepAdjustments,omitempty"`
TargetValue float64 `json:"TargetValue,omitempty"`
MinAdjustmentStep int32 `json:"MinAdjustmentStep,omitempty"`
MinAdjustmentMagnitude int32 `json:"MinAdjustmentMagnitude,omitempty"`
Cooldown int32 `json:"Cooldown,omitempty"`
EstimatedWarmup int32 `json:"EstimatedWarmup,omitempty"`
ScalingAdjustment int32 `json:"ScalingAdjustment,omitempty"`
DisableScaleIn bool `json:"DisableScaleIn,omitempty"`
}
ScalingPolicy represents a scaling policy for an Auto Scaling group.
type ScalingPolicyInput ¶
type ScalingPolicyInput struct {
CustomizedMetricSpecification string
PolicyName string
PolicyType string
AdjustmentType string
MetricType string
MetricAggregationType string
AutoScalingGroupName string
StepAdjustments []StepAdjustment
TargetValue float64
MinAdjustmentStep int32
ScalingAdjustment int32
Cooldown int32
EstimatedWarmup int32
MinAdjustmentMagnitude int32
DisableScaleIn bool
}
ScalingPolicyInput holds the input for PutScalingPolicy.
type ScheduledAction ¶
type ScheduledAction struct {
StartTime time.Time `json:"StartTime,omitzero"`
EndTime time.Time `json:"EndTime,omitzero"`
// LastExecutedTime records when the background scheduler last applied this
// action's capacity change. For a one-time action (empty Recurrence) it
// gates against re-firing; for a recurring action it is the baseline
// NextAfter is computed from. Internal bookkeeping only -- AWS's real
// ScheduledUpdateGroupAction wire shape has no equivalent field, so this is
// deliberately not projected onto the DescribeScheduledActions XML response.
LastExecutedTime time.Time `json:"LastExecutedTime,omitzero"`
DesiredCapacity *int32 `json:"DesiredCapacity,omitempty"`
MinSize *int32 `json:"MinSize,omitempty"`
MaxSize *int32 `json:"MaxSize,omitempty"`
ScheduledActionName string `json:"ScheduledActionName"`
ScheduledActionARN string `json:"ScheduledActionARN,omitempty"`
AutoScalingGroupName string `json:"AutoScalingGroupName"`
Recurrence string `json:"Recurrence,omitempty"`
TimeZone string `json:"TimeZone,omitempty"`
}
ScheduledAction represents a scheduled scaling action for an Auto Scaling group.
type ScheduledActionScheduler ¶ added in v1.2.0
type ScheduledActionScheduler struct {
// contains filtered or unexported fields
}
ScheduledActionScheduler evaluates every Auto Scaling group's scheduled actions on a regular tick and applies any that are due, closing the gap documented in PARITY.md / bd gopherstack-6ys: PutScheduledUpdateGroupAction and BatchPutScheduledUpdateGroupAction persisted StartTime/EndTime/Recurrence, but nothing ever evaluated them against wall-clock time.
func NewScheduledActionScheduler ¶ added in v1.2.0
func NewScheduledActionScheduler(backend *InMemoryBackend, tickInterval time.Duration) *ScheduledActionScheduler
NewScheduledActionScheduler creates a scheduler for backend. A zero tickInterval uses defaultScheduledActionTickInterval.
func (*ScheduledActionScheduler) Run ¶ added in v1.2.0
func (s *ScheduledActionScheduler) Run(ctx context.Context)
Run implements pkgs/worker.Runner: it ticks until ctx is cancelled, applying any scheduled actions that have become due on each tick. Every tick is independent (no per-tick goroutine, no unbounded state) so Run returns promptly once ctx is done, with nothing left running behind it.
type ScheduledUpdateGroupAction ¶
type ScheduledUpdateGroupAction struct {
StartTime time.Time `json:"StartTime,omitzero"`
EndTime time.Time `json:"EndTime,omitzero"`
DesiredCapacity *int32 `json:"DesiredCapacity,omitempty"`
MinSize *int32 `json:"MinSize,omitempty"`
MaxSize *int32 `json:"MaxSize,omitempty"`
ScheduledActionName string `json:"ScheduledActionName"`
Recurrence string `json:"Recurrence,omitempty"`
TimeZone string `json:"TimeZone,omitempty"`
}
ScheduledUpdateGroupAction is the input for a single action in BatchPutScheduledUpdateGroupAction.
type StartInstanceRefreshInput ¶
type StartInstanceRefreshInput struct {
AutoScalingGroupName string
Strategy string
Preferences InstanceRefreshPreferences
}
StartInstanceRefreshInput holds the input for StartInstanceRefresh.
type StepAdjustment ¶
type StepAdjustment struct {
MetricIntervalLowerBound *float64 `json:"MetricIntervalLowerBound,omitempty"`
MetricIntervalUpperBound *float64 `json:"MetricIntervalUpperBound,omitempty"`
ScalingAdjustment int32 `json:"ScalingAdjustment"`
}
StepAdjustment defines a scaling adjustment with a metric interval bound.
type StorageBackend ¶
type StorageBackend interface {
CreateAutoScalingGroup(input CreateAutoScalingGroupInput) (*AutoScalingGroup, error)
DescribeAutoScalingGroups(names []string) ([]AutoScalingGroup, error)
UpdateAutoScalingGroup(input UpdateAutoScalingGroupInput) (*AutoScalingGroup, error)
DeleteAutoScalingGroup(name string, forceDelete bool) error
CreateLaunchConfiguration(input CreateLaunchConfigurationInput) (*LaunchConfiguration, error)
DescribeLaunchConfigurations(names []string) ([]LaunchConfiguration, error)
DeleteLaunchConfiguration(name string) error
DescribeScalingActivities(groupName string) ([]ScalingActivity, error)
AttachInstances(groupName string, instanceIDs []string) error
AttachLoadBalancerTargetGroups(groupName string, targetGroupARNs []string) error
AttachLoadBalancers(groupName string, loadBalancerNames []string) error
AttachTrafficSources(groupName string, trafficSources []TrafficSource) error
BatchDeleteScheduledAction(
groupName string,
scheduledActionNames []string,
) ([]FailedScheduledAction, error)
BatchPutScheduledUpdateGroupAction(
groupName string,
actions []ScheduledUpdateGroupAction,
) ([]FailedScheduledAction, error)
CancelInstanceRefresh(groupName string) (string, error)
CompleteLifecycleAction(input CompleteLifecycleActionInput) error
CreateOrUpdateTags(tags []ResourceTag) error
DeleteLifecycleHook(groupName, hookName string) error
SetDesiredCapacity(groupName string, desiredCapacity int32) error
TerminateInstanceInAutoScalingGroup(instanceID string, shouldDecrement bool) (*ScalingActivity, error)
PutLifecycleHook(hook LifecycleHook) error
DescribeLifecycleHooks(groupName string, hookNames []string) ([]LifecycleHook, error)
DescribeScheduledActions(groupName string, actionNames []string) ([]ScheduledAction, error)
DeleteTags(tags []ResourceTag) error
DescribeTags(filters []TagFilter) ([]ResourceTag, error)
DescribeAutoScalingInstances(instanceIDs []string) ([]InstanceDetails, error)
// Static describe methods
DescribeAccountLimits() (*AccountLimits, error)
DescribeAdjustmentTypes() ([]string, error)
DescribeAutoScalingNotificationTypes() ([]string, error)
DescribeLifecycleHookTypes() ([]string, error)
DescribeMetricCollectionTypes() ([]MetricCollectionType, error)
DescribeScalingProcessTypes() ([]string, error)
DescribeTerminationPolicyTypes() ([]string, error)
// Instance refresh
StartInstanceRefresh(groupName string) (*InstanceRefresh, error)
StartInstanceRefreshWithInput(input StartInstanceRefreshInput) (*InstanceRefresh, error)
RollbackInstanceRefresh(groupName string) (string, error)
DescribeInstanceRefreshes(groupName string, refreshIDs []string) ([]InstanceRefresh, error)
// LB/TG/Traffic describe
DescribeLoadBalancers(groupName string) ([]LoadBalancerState, error)
DescribeLoadBalancerTargetGroups(groupName string) ([]LoadBalancerTargetGroupState, error)
DescribeTrafficSources(groupName string) ([]TrafficSourceState, error)
// Detach operations
DetachInstances(groupName string, instanceIDs []string, shouldDecrement bool) ([]ScalingActivity, error)
DetachLoadBalancerTargetGroups(groupName string, targetGroupARNs []string) error
DetachLoadBalancers(groupName string, lbNames []string) error
DetachTrafficSources(groupName string, trafficSources []TrafficSource) error
// Metrics
EnableMetricsCollection(groupName string, metrics []string, granularity string) error
DisableMetricsCollection(groupName string, metrics []string) error
// Process ops
SuspendProcesses(groupName string, processes []string) error
ResumeProcesses(groupName string, processes []string) error
// Standby
EnterStandby(groupName string, instanceIDs []string, decrementCapacity bool) ([]ScalingActivity, error)
ExitStandby(groupName string, instanceIDs []string) ([]ScalingActivity, error)
// Instance state
SetInstanceHealth(instanceID string, healthStatus string, shouldRespectGracePeriod bool) error
SetInstanceProtection(groupName string, instanceIDs []string, protectedFromScaleIn bool) error
// Lifecycle heartbeat
RecordLifecycleActionHeartbeat(input RecordLifecycleActionHeartbeatInput) error
// Execute policy
ExecutePolicy(input ExecutePolicyInput) error
// Launch instances
LaunchInstances(groupName string, count int32) ([]Instance, error)
// Predictive scaling
GetPredictiveScalingForecast(groupName string) error
// Notification configs
PutNotificationConfiguration(groupName, topicARN string, types []string) error
DeleteNotificationConfiguration(groupName, topicARN string) error
DescribeNotificationConfigurations(groupNames []string) ([]NotificationConfiguration, error)
// Scaling policies
PutScalingPolicy(input ScalingPolicyInput) (*ScalingPolicy, error)
DeletePolicy(groupName, policyNameOrARN string) error
DescribePolicies(groupName string, policyNames []string) ([]ScalingPolicy, error)
// Scheduled actions (single)
PutScheduledUpdateGroupAction(groupName string, action ScheduledUpdateGroupAction) error
DeleteScheduledAction(groupName, scheduledActionName string) error
// Warm pool
PutWarmPool(input WarmPoolInput) error
DeleteWarmPool(groupName string) error
DescribeWarmPool(groupName string) (*WarmPool, error)
}
StorageBackend is the interface for the Autoscaling in-memory store.
type Tag ¶
type Tag struct {
Key string `json:"Key"`
Value string `json:"Value"`
PropagateAtLaunch bool `json:"PropagateAtLaunch,omitempty"`
}
Tag is a key/value pair attached to a resource, optionally propagated to new instances.
type TrafficSource ¶
TrafficSource identifies a traffic source attached to an Auto Scaling group.
type TrafficSourceState ¶
type TrafficSourceState struct {
Identifier string `json:"Identifier"`
Type string `json:"Type"`
State string `json:"State"`
}
TrafficSourceState represents the state of a traffic source attached to an ASG.
type UpdateAutoScalingGroupInput ¶
type UpdateAutoScalingGroupInput struct {
LaunchTemplate *LaunchTemplateSpecification
MaxSize *int32
DesiredCapacity *int32
DefaultCooldown *int32
HealthCheckGracePeriod *int32
MaxInstanceLifetime *int32
DefaultInstanceWarmup *int32
NewInstancesProtectedFromScaleIn *bool
CapacityRebalance *bool
SkipZonalShiftValidation *bool
MixedInstancesPolicy *MixedInstancesPolicy
AvailabilityZoneDistribution *AvailabilityZoneDistribution
AvailabilityZoneImpairmentPolicy *AvailabilityZoneImpairmentPolicy
CapacityReservationSpecification *CapacityReservationSpecification
InstanceLifecyclePolicy *InstanceLifecyclePolicy
InstanceMaintenancePolicy *InstanceMaintenancePolicy
MinSize *int32
LaunchConfigurationName string
VPCZoneIdentifier string
PlacementGroup string
Context string
DesiredCapacityType string
HealthCheckType string
AutoScalingGroupName string
DeletionProtection string
AvailabilityZones []string
TerminationPolicies []string
}
UpdateAutoScalingGroupInput holds the input for UpdateAutoScalingGroup.
type WarmPool ¶
type WarmPool struct {
AutoScalingGroupName string `json:"AutoScalingGroupName"`
PoolState string `json:"PoolState,omitempty"`
Status string `json:"Status,omitempty"`
MinSize int32 `json:"MinSize,omitempty"`
MaxGroupPreparedCapacity int32 `json:"MaxGroupPreparedCapacity,omitempty"`
InstanceReusePolicy InstanceReusePolicy `json:"InstanceReusePolicy"`
}
WarmPool represents a warm pool configuration for an Auto Scaling group.
type WarmPoolInput ¶
type WarmPoolInput struct {
AutoScalingGroupName string
PoolState string
MinSize int32
MaxGroupPreparedCapacity int32
InstanceReusePolicy InstanceReusePolicy
}
WarmPoolInput holds the input for PutWarmPool.
Source Files
¶
- activities.go
- auto_scaling_groups.go
- ec2_launch.go
- elbv2_targets.go
- errors.go
- handler.go
- handler_activities.go
- handler_auto_scaling_groups.go
- handler_instance_refreshes.go
- handler_instances.go
- handler_launch_configurations.go
- handler_lifecycle_hooks.go
- handler_load_balancers.go
- handler_metrics.go
- handler_notifications.go
- handler_predictive_scaling.go
- handler_scaling_policies.go
- handler_scheduled_actions.go
- handler_tags.go
- handler_traffic_sources.go
- handler_warm_pools.go
- instance_refreshes.go
- instances.go
- interfaces.go
- launch_configurations.go
- lifecycle_hooks.go
- load_balancers.go
- metrics.go
- models.go
- notifications.go
- persistence.go
- predictive_scaling.go
- provider.go
- scaling_policies.go
- scheduled_action_cron.go
- scheduled_action_scheduler.go
- scheduled_actions.go
- store.go
- store_setup.go
- tags.go
- traffic_sources.go
- warm_pools.go