Help us shape the future of Go! Take the 2026 Go Developer Survey

autoscaling

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoScalingGroup

type AutoScalingGroup struct {
	Name                   string
	ARN                    string
	LaunchConfigName       string
	LaunchTemplateID       string
	LaunchTemplateName     string
	MinSize                int
	MaxSize                int
	DesiredCapacity        int
	DefaultCooldown        int
	AvailabilityZones      []string
	TargetGroupARNs        []string
	HealthCheckType        string
	HealthCheckGracePeriod int
	VPCZoneIdentifier      string
	Status                 string
	Instances              []*AutoScalingInstance
	Tags                   map[string]string
	CreatedTime            time.Time
}

AutoScalingGroup represents an Auto Scaling group.

type AutoScalingInstance

type AutoScalingInstance struct {
	InstanceID           string
	AutoScalingGroupName string
	AvailabilityZone     string
	LifecycleState       string
	HealthStatus         string
	LaunchConfigName     string
	ProtectedFromScaleIn bool
}

AutoScalingInstance represents an instance in an ASG.

type AutoScalingService

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

AutoScalingService is the cloudmock implementation of the AWS Auto Scaling API.

func New

func New(accountID, region string) *AutoScalingService

New returns a new AutoScalingService for the given AWS account ID and region.

func NewWithLocator

func NewWithLocator(accountID, region string, locator ServiceLocator) *AutoScalingService

NewWithLocator returns a new AutoScalingService with a service locator for cross-service communication.

func (*AutoScalingService) Actions

func (s *AutoScalingService) Actions() []service.Action

Actions returns the list of Auto Scaling API actions supported by this service.

func (*AutoScalingService) HandleRequest

func (s *AutoScalingService) HandleRequest(ctx *service.RequestContext) (*service.Response, error)

HandleRequest routes an incoming Auto Scaling request to the appropriate handler. Auto Scaling uses the query protocol (form-encoded, XML responses).

func (*AutoScalingService) HealthCheck

func (s *AutoScalingService) HealthCheck() error

HealthCheck always returns nil (no external dependencies).

func (*AutoScalingService) Name

func (s *AutoScalingService) Name() string

Name returns the AWS service name used for routing.

func (*AutoScalingService) SetEventBus

func (s *AutoScalingService) SetEventBus(bus *eventbus.Bus)

SetEventBus sets the event bus for publishing autoscaling events.

func (*AutoScalingService) SetLocator

func (s *AutoScalingService) SetLocator(locator ServiceLocator)

SetLocator sets the service locator for cross-service communication (EC2 instance creation).

type LaunchConfiguration

type LaunchConfiguration struct {
	Name               string
	ARN                string
	ImageID            string
	InstanceType       string
	KeyName            string
	SecurityGroups     []string
	UserData           string
	IAMInstanceProfile string
	CreatedTime        time.Time
}

LaunchConfiguration represents an Auto Scaling launch configuration.

type LifecycleHook

type LifecycleHook struct {
	LifecycleHookName     string
	AutoScalingGroupName  string
	LifecycleTransition   string // autoscaling:EC2_INSTANCE_LAUNCHING or TERMINATING
	NotificationTargetARN string
	RoleARN               string
	NotificationMetadata  string
	HeartbeatTimeout      int
	DefaultResult         string
}

LifecycleHook represents a lifecycle hook on an ASG.

type ScalingPolicy

type ScalingPolicy struct {
	Name                 string
	ARN                  string
	AutoScalingGroupName string
	PolicyType           string // SimpleScaling, StepScaling, TargetTrackingScaling
	AdjustmentType       string
	ScalingAdjustment    int
	Cooldown             int
	TargetValue          float64
	MetricName           string
	Enabled              bool
}

ScalingPolicy represents an Auto Scaling scaling policy.

type ScheduledAction

type ScheduledAction struct {
	ScheduledActionName  string
	ScheduledActionARN   string
	AutoScalingGroupName string
	DesiredCapacity      int
	MinSize              int
	MaxSize              int
	Recurrence           string
	StartTime            string
	EndTime              string
	TimeZone             string
}

ScheduledAction represents a scheduled scaling action.

type ServiceLocator

type ServiceLocator interface {
	Lookup(name string) (service.Service, error)
}

ServiceLocator provides access to other services for cross-service communication.

type Store

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

Store manages all Auto Scaling resources.

func NewStore

func NewStore(accountID, region string) *Store

NewStore returns a new Store for the given account and region.

func (*Store) AttachInstances

func (s *Store) AttachInstances(asgName string, instanceIDs []string) bool

func (*Store) CreateAutoScalingGroup

func (s *Store) CreateAutoScalingGroup(name, lcName, vpcZoneID, healthCheckType string, minSize, maxSize, desiredCapacity, cooldown, hcGrace int, azs, tgARNs []string, tags map[string]string) (*AutoScalingGroup, bool)

func (*Store) CreateAutoScalingGroupWithEC2

func (s *Store) CreateAutoScalingGroupWithEC2(name, lcName, vpcZoneID, healthCheckType string, minSize, maxSize, desiredCapacity, cooldown, hcGrace int, azs, tgARNs []string, tags map[string]string, locator ServiceLocator, bus *eventbus.Bus) (*AutoScalingGroup, bool)

CreateAutoScalingGroupWithEC2 creates an ASG and provisions instances via EC2 locator.

func (*Store) CreateLaunchConfiguration

func (s *Store) CreateLaunchConfiguration(name, imageID, instanceType, keyName, userData, iamProfile string, securityGroups []string) (*LaunchConfiguration, bool)

func (*Store) CreateOrUpdateTags

func (s *Store) CreateOrUpdateTags(tags []Tag)

func (*Store) DeleteAutoScalingGroup

func (s *Store) DeleteAutoScalingGroup(name string) bool

func (*Store) DeleteAutoScalingGroupWithEC2

func (s *Store) DeleteAutoScalingGroupWithEC2(name string, locator ServiceLocator, bus *eventbus.Bus) bool

DeleteAutoScalingGroupWithEC2 deletes an ASG and terminates its EC2 instances.

func (*Store) DeleteLaunchConfiguration

func (s *Store) DeleteLaunchConfiguration(name string) bool

func (*Store) DeleteLifecycleHook

func (s *Store) DeleteLifecycleHook(asgName, hookName string) bool

DeleteLifecycleHook removes a lifecycle hook.

func (*Store) DeleteScalingPolicy

func (s *Store) DeleteScalingPolicy(asgName, policyName string) bool

func (*Store) DeleteScheduledAction

func (s *Store) DeleteScheduledAction(asgName, actionName string) bool

DeleteScheduledAction removes a scheduled action.

func (*Store) DeleteTags

func (s *Store) DeleteTags(tags []Tag)

func (*Store) DescribeLifecycleHooks

func (s *Store) DescribeLifecycleHooks(asgName string, hookNames []string) []*LifecycleHook

DescribeLifecycleHooks returns lifecycle hooks for an ASG.

func (*Store) DescribeScheduledActions

func (s *Store) DescribeScheduledActions(asgName string, actionNames []string) []*ScheduledAction

DescribeScheduledActions returns scheduled actions for an ASG.

func (*Store) DetachInstances

func (s *Store) DetachInstances(asgName string, instanceIDs []string, decrementDesired bool) ([]*AutoScalingInstance, bool)

func (*Store) DisableMetricsCollection

func (s *Store) DisableMetricsCollection(asgName string) bool

DisableMetricsCollection disables metrics collection for an ASG.

func (*Store) EnableMetricsCollection

func (s *Store) EnableMetricsCollection(asgName, granularity string) bool

EnableMetricsCollection enables metrics collection for an ASG.

func (*Store) ExecutePolicy

func (s *Store) ExecutePolicy(asgName, policyName string) bool

ExecutePolicy simulates executing a scaling policy by adjusting desired capacity.

func (*Store) GetAutoScalingGroup

func (s *Store) GetAutoScalingGroup(name string) (*AutoScalingGroup, bool)

func (*Store) GetLaunchConfiguration

func (s *Store) GetLaunchConfiguration(name string) (*LaunchConfiguration, bool)

func (*Store) ListAutoScalingGroups

func (s *Store) ListAutoScalingGroups(names []string) []*AutoScalingGroup

func (*Store) ListAutoScalingInstances

func (s *Store) ListAutoScalingInstances() []*AutoScalingInstance

func (*Store) ListLaunchConfigurations

func (s *Store) ListLaunchConfigurations(names []string) []*LaunchConfiguration

func (*Store) ListScalingPolicies

func (s *Store) ListScalingPolicies(asgName string, policyNames []string) []*ScalingPolicy

func (*Store) ListTags

func (s *Store) ListTags(asgName string) []Tag

func (*Store) PutLifecycleHook

func (s *Store) PutLifecycleHook(asgName, hookName, transition, targetARN, roleARN, metadata, defaultResult string, heartbeatTimeout int) (*LifecycleHook, bool)

PutLifecycleHook creates or updates a lifecycle hook.

func (*Store) PutScalingPolicy

func (s *Store) PutScalingPolicy(asgName, policyName, policyType, adjustmentType string, scalingAdjustment, cooldown int, targetValue float64, metricName string) (*ScalingPolicy, bool)

func (*Store) PutScheduledAction

func (s *Store) PutScheduledAction(asgName, actionName, recurrence, startTime, endTime, timeZone string, desiredCapacity, minSize, maxSize int) (*ScheduledAction, bool)

PutScheduledAction creates or updates a scheduled action.

func (*Store) SetDesiredCapacity

func (s *Store) SetDesiredCapacity(name string, capacity int) bool

func (*Store) SetDesiredCapacityWithEC2

func (s *Store) SetDesiredCapacityWithEC2(name string, capacity int, locator ServiceLocator, bus *eventbus.Bus) bool

SetDesiredCapacityWithEC2 sets desired capacity and reconciles via EC2.

func (*Store) UpdateAutoScalingGroup

func (s *Store) UpdateAutoScalingGroup(name, lcName, vpcZoneID, healthCheckType string, minSize, maxSize, desiredCapacity, cooldown, hcGrace int) (*AutoScalingGroup, bool)

func (*Store) UpdateAutoScalingGroupWithEC2

func (s *Store) UpdateAutoScalingGroupWithEC2(name, lcName, vpcZoneID, healthCheckType string, minSize, maxSize, desiredCapacity, cooldown, hcGrace int, locator ServiceLocator, bus *eventbus.Bus) (*AutoScalingGroup, bool)

UpdateAutoScalingGroupWithEC2 updates an ASG and reconciles via EC2 if capacity changed.

type Tag

type Tag struct {
	Key               string
	Value             string
	ResourceID        string
	ResourceType      string
	PropagateAtLaunch bool
}

Tag represents an Auto Scaling tag.

Jump to

Keyboard shortcuts

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