az

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// RecommendedAvailabilityZones defines the default number of required availability zones
	RecommendedAvailabilityZones = api.RecommendedSubnets
	// MinRequiredAvailabilityZones defines the minimum number of required availability zones
	MinRequiredAvailabilityZones = api.MinRequiredSubnets
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AvailabilityZoneSelector

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

AvailabilityZoneSelector used to select availability zones to use

func NewSelectorWithDefaults

func NewSelectorWithDefaults(ec2api ec2iface.EC2API) *AvailabilityZoneSelector

NewSelectorWithDefaults create a new AvailabilityZoneSelector with the default selection strategy and usage rules

func NewSelectorWithMinRequired

func NewSelectorWithMinRequired(ec2api ec2iface.EC2API) *AvailabilityZoneSelector

NewSelectorWithMinRequired create a new AvailabilityZoneSelector with the minimum required selection strategy and usage rules

func (*AvailabilityZoneSelector) SelectZones

func (a *AvailabilityZoneSelector) SelectZones(regionName string) ([]string, error)

SelectZones returns a list fo az zones to use for the supplied region

type RequiredNumberRandomStrategy

type RequiredNumberRandomStrategy struct {
	RequiredAvailabilityZones int
}

RequiredNumberRandomStrategy selects az zones randomly up to a required amount of zones.

func NewMinRequiredNumberRandomStrategy

func NewMinRequiredNumberRandomStrategy() *RequiredNumberRandomStrategy

NewMinRequiredNumberRandomStrategy returns a RequiredNumberRandomStrategy that has the number of required zones set to the default (MinRequiredAvailabilityZones)

func NewRecommendedNumberRandomStrategy

func NewRecommendedNumberRandomStrategy() *RequiredNumberRandomStrategy

NewRecommendedNumberRandomStrategy returns a RequiredNumberRandomStrategy that has the number of required zones set to the default (RecommendedAvailabilityZones)

func (*RequiredNumberRandomStrategy) Select

func (r *RequiredNumberRandomStrategy) Select(availableZones []string) []string

Select will randomly select az from the supplied list. The number of az's selected will be controlled by RequiredAvailabilityZones.

type SelectionStrategy

type SelectionStrategy interface {
	Select(availableZones []string) []string
}

SelectionStrategy provides an interface to allow changing the strategy used to select availability zones to use from a list available.

type ZoneUsageRule

type ZoneUsageRule interface {
	CanUseZone(zone *ec2.AvailabilityZone) bool
}

ZoneUsageRule provides an interface to enable rules to determine if a zone should be used.

type ZonesToAvoidRule

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

ZonesToAvoidRule can be used to ensure that certain az aren't used. This can be used to avoid zones that are know to be overpopulated.

func NewZonesToAvoidRule

func NewZonesToAvoidRule(zonesToAvoid map[string]bool) *ZonesToAvoidRule

NewZonesToAvoidRule returns a new ZonesToAvoidRule with the supplied zones set to avoid

func (*ZonesToAvoidRule) CanUseZone

func (za *ZonesToAvoidRule) CanUseZone(zone *ec2.AvailabilityZone) bool

CanUseZone checks if the supplied zone is in the list of zones to be avoided.

Jump to

Keyboard shortcuts

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