arczonalshift

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 28 Imported by: 0

README

ARC Zonal Shift

Parity grade: A · SDK aws-sdk-go-v2/service/arczonalshift@v1.34.1 · last audited 2026-10-14 (80b7bb8b3)

Coverage

Metric Value
PARITY entries audited 15 (15 ok)
Feature families 2 (2 ok)
Known gaps none
Structural gaps (can't be emulated) 1
Deferred items 0
Resource leaks clean
Structural gaps

These do not block an A grade — no implementation could produce real data here because the underlying data source cannot exist in an emulator.

  • ListAutoshifts always empty: autoshifts are initiated by AWS from internal Availability Zone health telemetry, which cannot exist in an emulator

More

Documentation

Overview

Package arczonalshift emulates Application Recovery Controller zonal shift and zonal autoshift.

Index

Constants

This section is empty.

Variables

View Source
var ErrNilAppContext = errors.New("arczonalshift: AppContext must not be nil")

ErrNilAppContext is returned by Init when no AppContext is supplied.

Functions

This section is empty.

Types

type Alarm

type Alarm struct {
	AlarmIdentifier string `json:"alarmIdentifier"`
	Type            string `json:"type"`
}

Alarm is a practice-run alarm condition.

type AutoshiftInResource

type AutoshiftInResource struct {
	AppliedStatus string  `json:"appliedStatus"`
	AwayFrom      string  `json:"awayFrom"`
	StartTime     float64 `json:"startTime"`
}

AutoshiftInResource is an autoshift as shown inside a managed resource.

type AutoshiftSummary

type AutoshiftSummary struct {
	EndTime   *float64 `json:"endTime,omitempty"`
	AwayFrom  string   `json:"awayFrom"`
	Status    string   `json:"status"`
	StartTime float64  `json:"startTime"`
}

AutoshiftSummary is one AWS-initiated autoshift.

type Handler

type Handler struct {
	Backend *InMemoryBackend

	DefaultRegion string
	// contains filtered or unexported fields
}

Handler serves the ARC zonal shift API.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates the handler.

func (*Handler) ChaosOperations

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

ChaosOperations returns the fault-injectable operations.

func (*Handler) ChaosRegions

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

ChaosRegions returns the regions served.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase service name for fault rules.

func (*Handler) ExtractOperation

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

ExtractOperation returns the operation name for metrics.

func (*Handler) ExtractResource

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

ExtractResource returns the first path label for metrics.

func (*Handler) GetSupportedOperations

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

GetSupportedOperations lists every implemented operation.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all state.

func (*Handler) Restore

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

Restore implements persistence.Persistable.

func (*Handler) RouteMatcher

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

RouteMatcher matches by SigV4 signing name (or SDK user agent) plus a known path shape.

func (*Handler) Snapshot

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

Snapshot implements persistence.Persistable.

type InMemoryBackend

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

InMemoryBackend holds zonal shift state; managed resources are read live from ELBv2.

func NewInMemoryBackend

func NewInMemoryBackend(accountID string) *InMemoryBackend

NewInMemoryBackend creates an empty backend for accountID.

func (*InMemoryBackend) CancelPracticeRun

func (b *InMemoryBackend) CancelPracticeRun(id string) (ShiftView, error)

CancelPracticeRun ends an active practice run immediately.

func (*InMemoryBackend) CancelZonalShift

func (b *InMemoryBackend) CancelZonalShift(id string) (ShiftView, error)

CancelZonalShift ends an active customer zonal shift immediately.

func (*InMemoryBackend) CreatePracticeRunConfiguration

func (b *InMemoryBackend) CreatePracticeRunConfiguration(cfg PracticeConfig) (PracticeOut, error)

CreatePracticeRunConfiguration defines the practice run schedule and alarms for a managed resource.

func (*InMemoryBackend) DeletePracticeRunConfiguration

func (b *InMemoryBackend) DeletePracticeRunConfiguration(resource string) (PracticeOut, error)

DeletePracticeRunConfiguration removes a configuration; zonal autoshift must be disabled first.

func (*InMemoryBackend) GetManagedResource

func (b *InMemoryBackend) GetManagedResource(resource string) (ManagedDetail, error)

GetManagedResource describes one managed resource.

func (*InMemoryBackend) ListAutoshifts

func (b *InMemoryBackend) ListAutoshifts(status, token string, maxResults int) ([]AutoshiftSummary, string, error)

ListAutoshifts lists AWS-initiated autoshifts; this emulator never initiates one, so only the filter is validated.

func (*InMemoryBackend) ListManagedResources

func (b *InMemoryBackend) ListManagedResources(region, token string, maxResults int) ([]ManagedSummary, string, error)

ListManagedResources lists the load balancers of region as zonal-shift managed resources.

func (*InMemoryBackend) ListZonalShifts

func (b *InMemoryBackend) ListZonalShifts(status, resource, token string, maxResults int) ([]ShiftView, string, error)

ListZonalShifts lists shifts, optionally filtered by status and resource.

func (*InMemoryBackend) ObserverNotificationStatus

func (b *InMemoryBackend) ObserverNotificationStatus() string

ObserverNotificationStatus returns the account's autoshift observer notification status.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all state.

func (*InMemoryBackend) Restore

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

Restore loads a snapshot; an incompatible version starts empty. It implements persistence.Persistable.

func (*InMemoryBackend) SetAppConfig

func (b *InMemoryBackend) SetAppConfig(cfg any)

SetAppConfig records service.AppContext.Config so siblings are resolved at call time.

func (*InMemoryBackend) SetObserverNotificationStatus

func (b *InMemoryBackend) SetObserverNotificationStatus(status string) (string, error)

SetObserverNotificationStatus enables or disables autoshift observer notifications.

func (*InMemoryBackend) SetPracticeRunDuration

func (b *InMemoryBackend) SetPracticeRunDuration(d time.Duration)

SetPracticeRunDuration sets how long a practice run stays ACTIVE (default 30 minutes); d <= 0 restores the default.

func (*InMemoryBackend) Snapshot

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

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

func (*InMemoryBackend) StartPracticeRun

func (b *InMemoryBackend) StartPracticeRun(resource, awayFrom, comment string) (ShiftView, error)

StartPracticeRun starts a practice run zonal shift if the practice configuration allows it right now.

func (*InMemoryBackend) StartZonalShift

func (b *InMemoryBackend) StartZonalShift(resource, awayFrom, comment, expiresIn string) (ShiftView, error)

StartZonalShift moves traffic for a managed resource away from one Availability Zone until it expires.

func (*InMemoryBackend) UpdatePracticeRunConfiguration

func (b *InMemoryBackend) UpdatePracticeRunConfiguration(
	resource string,
	patch PracticeConfig,
	set map[string]bool,
) (PracticeOut, error)

UpdatePracticeRunConfiguration replaces the supplied parts of a practice run configuration.

func (*InMemoryBackend) UpdateZonalAutoshiftConfiguration

func (b *InMemoryBackend) UpdateZonalAutoshiftConfiguration(resource, status string) (string, error)

UpdateZonalAutoshiftConfiguration enables or disables zonal autoshift for a managed resource.

func (*InMemoryBackend) UpdateZonalShift

func (b *InMemoryBackend) UpdateZonalShift(id, comment, expiresIn string) (ShiftView, error)

UpdateZonalShift changes the comment and/or resets the expiry of an active zonal shift.

type ManagedDetail

type ManagedDetail struct {
	AppliedWeights           map[string]float32    `json:"appliedWeights"`
	PracticeRunConfiguration *PracticeView         `json:"practiceRunConfiguration,omitempty"`
	Arn                      string                `json:"arn"`
	Name                     string                `json:"name"`
	ZonalAutoshiftStatus     string                `json:"zonalAutoshiftStatus"`
	Autoshifts               []AutoshiftInResource `json:"autoshifts"`
	ZonalShifts              []ShiftInResource     `json:"zonalShifts"`
}

ManagedDetail is the wire form of GetManagedResource.

type ManagedSummary

type ManagedSummary struct {
	AppliedWeights       map[string]float32    `json:"appliedWeights"`
	Arn                  string                `json:"arn"`
	Name                 string                `json:"name"`
	PracticeRunStatus    string                `json:"practiceRunStatus"`
	ZonalAutoshiftStatus string                `json:"zonalAutoshiftStatus"`
	AvailabilityZones    []string              `json:"availabilityZones"`
	Autoshifts           []AutoshiftInResource `json:"autoshifts"`
	ZonalShifts          []ShiftInResource     `json:"zonalShifts"`
}

ManagedSummary is the wire form of a managed resource in ListManagedResources.

type PracticeConfig

type PracticeConfig struct {
	Resource       string   `json:"resource"`
	OutcomeAlarms  []Alarm  `json:"outcomeAlarms"`
	BlockingAlarms []Alarm  `json:"blockingAlarms,omitempty"`
	AllowedWindows []string `json:"allowedWindows,omitempty"`
	BlockedWindows []string `json:"blockedWindows,omitempty"`
	BlockedDates   []string `json:"blockedDates,omitempty"`
}

PracticeConfig is a resource's practice run configuration.

type PracticeOut

type PracticeOut struct {
	Config               *PracticeView `json:"practiceRunConfiguration,omitempty"`
	Arn                  string        `json:"arn"`
	Name                 string        `json:"name"`
	ZonalAutoshiftStatus string        `json:"zonalAutoshiftStatus"`
}

PracticeOut is the output of the practice run configuration operations.

type PracticeView

type PracticeView struct {
	OutcomeAlarms  []Alarm  `json:"outcomeAlarms"`
	AllowedWindows []string `json:"allowedWindows,omitempty"`
	BlockedDates   []string `json:"blockedDates,omitempty"`
	BlockedWindows []string `json:"blockedWindows,omitempty"`
	BlockingAlarms []Alarm  `json:"blockingAlarms,omitempty"`
}

PracticeView is the wire form of a practice run configuration.

type Provider

type Provider struct{}

Provider implements service.Provider.

func (*Provider) Init

Init builds the backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type ResourceSettings

type ResourceSettings struct {
	Resource  string `json:"resource"`
	Autoshift string `json:"autoshift"`
}

ResourceSettings is the per-resource autoshift status; present once any setting is changed.

type Settings

type Settings struct {
	ID       string `json:"id"`
	Observer string `json:"observer"`
}

Settings holds account-level options.

type Shift

type Shift struct {
	StartTime  time.Time  `json:"startTime"`
	ExpiryTime time.Time  `json:"expiryTime"`
	CanceledAt *time.Time `json:"canceledAt,omitempty"`
	ID         string     `json:"id"`
	Resource   string     `json:"resource"`
	AwayFrom   string     `json:"awayFrom"`
	Comment    string     `json:"comment"`
	Type       string     `json:"type"`
	Outcome    string     `json:"outcome,omitempty"`
}

Shift is a customer-started zonal shift or practice run.

type ShiftInResource

type ShiftInResource struct {
	AppliedStatus      string  `json:"appliedStatus"`
	AwayFrom           string  `json:"awayFrom"`
	Comment            string  `json:"comment"`
	ResourceIdentifier string  `json:"resourceIdentifier"`
	ZonalShiftID       string  `json:"zonalShiftId"`
	PracticeRunOutcome string  `json:"practiceRunOutcome,omitempty"`
	ShiftType          string  `json:"shiftType,omitempty"`
	ExpiryTime         float64 `json:"expiryTime"`
	StartTime          float64 `json:"startTime"`
}

ShiftInResource is a shift as shown inside a managed resource.

type ShiftView

type ShiftView struct {
	AwayFrom           string  `json:"awayFrom"`
	Comment            string  `json:"comment"`
	ResourceIdentifier string  `json:"resourceIdentifier"`
	Status             string  `json:"status"`
	ZonalShiftID       string  `json:"zonalShiftId"`
	PracticeRunOutcome string  `json:"practiceRunOutcome,omitempty"`
	ShiftType          string  `json:"shiftType,omitempty"`
	ExpiryTime         float64 `json:"expiryTime"`
	StartTime          float64 `json:"startTime"`
}

ShiftView is the wire form of a zonal shift (summary and Start/Update/Cancel output).

Jump to

Keyboard shortcuts

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