Documentation
¶
Overview ¶
Package route53recoverycontrolconfig emulates the Route 53 Application Recovery Controller control plane.
Index ¶
- Variables
- type Cluster
- type ConflictError
- type ControlPanel
- 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) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) RoutingControlIsOn(arn string) (bool, bool)
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type InMemoryBackend
- func (b *InMemoryBackend) AssociatedHealthCheckIDs(routingControlArn string) ([]string, error)
- func (b *InMemoryBackend) CreateCluster(ctx context.Context, name, networkType, token string, tags map[string]string) (wireCluster, error)
- func (b *InMemoryBackend) CreateControlPanel(clusterArn, name, token string, tags map[string]string) (wireControlPanel, error)
- func (b *InMemoryBackend) CreateRoutingControl(clusterArn, panelArn, name, token string) (wireRoutingControl, error)
- func (b *InMemoryBackend) CreateSafetyRule(spec *NewRuleSpec, token string, tags map[string]string) (wireRule, error)
- func (b *InMemoryBackend) DeleteCluster(arn string) error
- func (b *InMemoryBackend) DeleteControlPanel(arn string) error
- func (b *InMemoryBackend) DeleteRoutingControl(arn string) error
- func (b *InMemoryBackend) DeleteSafetyRule(arn string) error
- func (b *InMemoryBackend) DescribeCluster(ctx context.Context, arn string) (wireCluster, error)
- func (b *InMemoryBackend) DescribeControlPanel(arn string) (wireControlPanel, error)
- func (b *InMemoryBackend) DescribeRoutingControl(arn string) (wireRoutingControl, error)
- func (b *InMemoryBackend) DescribeSafetyRule(arn string) (wireRule, error)
- func (b *InMemoryBackend) ListClusters(ctx context.Context, token string, maxResults int) ([]wireCluster, string, error)
- func (b *InMemoryBackend) ListControlPanels(clusterArn, token string, maxResults int) ([]wireControlPanel, string, error)
- func (b *InMemoryBackend) ListRoutingControlStates(panelArn, clusterID, token string, maxResults int) ([]StateView, string, error)
- func (b *InMemoryBackend) ListRoutingControls(panelArn, token string, maxResults int) ([]wireRoutingControl, string, error)
- func (b *InMemoryBackend) ListSafetyRules(panelArn, token string, maxResults int) ([]wireRule, string, error)
- func (b *InMemoryBackend) ListTagsForResource(arn string) (map[string]string, error)
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) RoutingControlIsOn(arn string) (bool, bool)
- func (b *InMemoryBackend) RoutingControlState(arn, clusterID string) (StateView, error)
- func (b *InMemoryBackend) SetActivationDelay(d time.Duration)
- func (b *InMemoryBackend) SetAppConfig(cfg any)
- func (b *InMemoryBackend) SetExternalEndpoint(base string)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) TagResource(arn string, tags map[string]string) error
- func (b *InMemoryBackend) UntagResource(arn string, keys []string) error
- func (b *InMemoryBackend) UpdateCluster(ctx context.Context, arn, networkType string) (wireCluster, error)
- func (b *InMemoryBackend) UpdateControlPanel(arn, name string) (wireControlPanel, error)
- func (b *InMemoryBackend) UpdateRoutingControl(arn, name string) (wireRoutingControl, error)
- func (b *InMemoryBackend) UpdateRoutingControlStates(updates []StateUpdate, overrides []string, clusterID string) error
- func (b *InMemoryBackend) UpdateSafetyRule(kind, arn, name string, waitPeriodMs int32) (wireRule, error)
- type NewRuleSpec
- type Provider
- type RoutingControl
- type SafetyRule
- type StateUpdate
- type StateView
Constants ¶
This section is empty.
Variables ¶
var ErrNilAppContext = errors.New("route53recoverycontrolconfig: AppContext must not be nil")
ErrNilAppContext is returned by Init when no AppContext is supplied.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct {
CreatedAt time.Time `json:"createdAt"`
DeletedAt *time.Time `json:"deletedAt,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
ARN string `json:"arn"`
Name string `json:"name"`
NetworkType string `json:"networkType"`
}
Cluster is a Route 53 ARC cluster.
type ConflictError ¶
ConflictError is a data-plane rejection naming the safety rule that blocked an update.
func (*ConflictError) Error ¶
func (e *ConflictError) Error() string
type ControlPanel ¶
type ControlPanel struct {
CreatedAt time.Time `json:"createdAt"`
DeletedAt *time.Time `json:"deletedAt,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
ARN string `json:"arn"`
ClusterARN string `json:"clusterArn"`
Name string `json:"name"`
Default bool `json:"default,omitempty"`
}
ControlPanel groups routing controls and safety rules inside a cluster.
type Handler ¶
type Handler struct {
Backend *InMemoryBackend
DefaultRegion string
// contains filtered or unexported fields
}
Handler serves the Route 53 Recovery Control Config control plane.
func NewHandler ¶
func NewHandler(backend *InMemoryBackend) *Handler
NewHandler creates the handler.
func (*Handler) ChaosOperations ¶
ChaosOperations returns the fault-injectable operations.
func (*Handler) ChaosRegions ¶
ChaosRegions returns the regions served.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase service name for fault rules.
func (*Handler) ExtractOperation ¶
ExtractOperation returns the operation name for metrics.
func (*Handler) ExtractResource ¶
ExtractResource returns the primary ARN label for metrics.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations lists every implemented operation.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) RouteMatcher ¶
RouteMatcher matches by SigV4 signing name (or SDK user agent) plus a known path shape.
func (*Handler) RoutingControlIsOn ¶
RoutingControlIsOn reports (on, found) for a routing control, for sibling services.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend holds the Route 53 ARC control plane: clusters, control panels, routing controls, safety rules.
func NewInMemoryBackend ¶
func NewInMemoryBackend(accountID string) *InMemoryBackend
NewInMemoryBackend creates an empty backend for accountID.
func (*InMemoryBackend) AssociatedHealthCheckIDs ¶
func (b *InMemoryBackend) AssociatedHealthCheckIDs(routingControlArn string) ([]string, error)
AssociatedHealthCheckIDs lists the Route 53 RECOVERY_CONTROL health checks bound to a routing control.
func (*InMemoryBackend) CreateCluster ¶
func (b *InMemoryBackend) CreateCluster( ctx context.Context, name, networkType, token string, tags map[string]string, ) (wireCluster, error)
CreateCluster creates a cluster together with its default control panel.
func (*InMemoryBackend) CreateControlPanel ¶
func (b *InMemoryBackend) CreateControlPanel( clusterArn, name, token string, tags map[string]string, ) (wireControlPanel, error)
CreateControlPanel creates a custom control panel in a cluster.
func (*InMemoryBackend) CreateRoutingControl ¶
func (b *InMemoryBackend) CreateRoutingControl(clusterArn, panelArn, name, token string) (wireRoutingControl, error)
CreateRoutingControl creates a routing control (state Off) in the given or the cluster's default control panel.
func (*InMemoryBackend) CreateSafetyRule ¶
func (b *InMemoryBackend) CreateSafetyRule(spec *NewRuleSpec, token string, tags map[string]string) (wireRule, error)
CreateSafetyRule creates an assertion or gating rule.
func (*InMemoryBackend) DeleteCluster ¶
func (b *InMemoryBackend) DeleteCluster(arn string) error
DeleteCluster removes a cluster; it must not hold custom control panels, routing controls or safety rules.
func (*InMemoryBackend) DeleteControlPanel ¶
func (b *InMemoryBackend) DeleteControlPanel(arn string) error
DeleteControlPanel deletes an empty, non-default control panel.
func (*InMemoryBackend) DeleteRoutingControl ¶
func (b *InMemoryBackend) DeleteRoutingControl(arn string) error
DeleteRoutingControl deletes a routing control that no safety rule references.
func (*InMemoryBackend) DeleteSafetyRule ¶
func (b *InMemoryBackend) DeleteSafetyRule(arn string) error
DeleteSafetyRule deletes a rule.
func (*InMemoryBackend) DescribeCluster ¶
func (b *InMemoryBackend) DescribeCluster(ctx context.Context, arn string) (wireCluster, error)
DescribeCluster returns one cluster.
func (*InMemoryBackend) DescribeControlPanel ¶
func (b *InMemoryBackend) DescribeControlPanel(arn string) (wireControlPanel, error)
DescribeControlPanel returns one control panel.
func (*InMemoryBackend) DescribeRoutingControl ¶
func (b *InMemoryBackend) DescribeRoutingControl(arn string) (wireRoutingControl, error)
DescribeRoutingControl returns one routing control.
func (*InMemoryBackend) DescribeSafetyRule ¶
func (b *InMemoryBackend) DescribeSafetyRule(arn string) (wireRule, error)
DescribeSafetyRule returns one rule.
func (*InMemoryBackend) ListClusters ¶
func (b *InMemoryBackend) ListClusters( ctx context.Context, token string, maxResults int, ) ([]wireCluster, string, error)
ListClusters lists clusters.
func (*InMemoryBackend) ListControlPanels ¶
func (b *InMemoryBackend) ListControlPanels( clusterArn, token string, maxResults int, ) ([]wireControlPanel, string, error)
ListControlPanels lists panels, optionally restricted to one cluster.
func (*InMemoryBackend) ListRoutingControlStates ¶
func (b *InMemoryBackend) ListRoutingControlStates( panelArn, clusterID, token string, maxResults int, ) ([]StateView, string, error)
ListRoutingControlStates lists routing control states, optionally by control panel and/or cluster.
func (*InMemoryBackend) ListRoutingControls ¶
func (b *InMemoryBackend) ListRoutingControls( panelArn, token string, maxResults int, ) ([]wireRoutingControl, string, error)
ListRoutingControls lists the routing controls of a control panel.
func (*InMemoryBackend) ListSafetyRules ¶
func (b *InMemoryBackend) ListSafetyRules(panelArn, token string, maxResults int) ([]wireRule, string, error)
ListSafetyRules lists the rules of a control panel.
func (*InMemoryBackend) ListTagsForResource ¶
func (b *InMemoryBackend) ListTagsForResource(arn string) (map[string]string, error)
ListTagsForResource returns a resource's tags.
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) RoutingControlIsOn ¶
func (b *InMemoryBackend) RoutingControlIsOn(arn string) (bool, bool)
RoutingControlIsOn reports (on, found) for a routing control, for sibling services (Route 53 health checks).
func (*InMemoryBackend) RoutingControlState ¶
func (b *InMemoryBackend) RoutingControlState(arn, clusterID string) (StateView, error)
RoutingControlState returns one routing control's state; clusterID, when set, scopes it to that cluster.
func (*InMemoryBackend) SetActivationDelay ¶
func (b *InMemoryBackend) SetActivationDelay(d time.Duration)
SetActivationDelay keeps new resources PENDING (and deleted ones PENDING_DELETION) for d; 0 makes both instant.
func (*InMemoryBackend) SetAppConfig ¶
func (b *InMemoryBackend) SetAppConfig(cfg any)
SetAppConfig records service.AppContext.Config so siblings are resolved at call time, after every provider exists.
func (*InMemoryBackend) SetExternalEndpoint ¶
func (b *InMemoryBackend) SetExternalEndpoint(base string)
SetExternalEndpoint pins the base URL of cluster endpoints, overriding the caller's host.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises the backend state. It implements persistence.Persistable.
func (*InMemoryBackend) TagResource ¶
func (b *InMemoryBackend) TagResource(arn string, tags map[string]string) error
TagResource adds or overwrites tags.
func (*InMemoryBackend) UntagResource ¶
func (b *InMemoryBackend) UntagResource(arn string, keys []string) error
UntagResource removes tags by key.
func (*InMemoryBackend) UpdateCluster ¶
func (b *InMemoryBackend) UpdateCluster(ctx context.Context, arn, networkType string) (wireCluster, error)
UpdateCluster changes the network type.
func (*InMemoryBackend) UpdateControlPanel ¶
func (b *InMemoryBackend) UpdateControlPanel(arn, name string) (wireControlPanel, error)
UpdateControlPanel renames a control panel.
func (*InMemoryBackend) UpdateRoutingControl ¶
func (b *InMemoryBackend) UpdateRoutingControl(arn, name string) (wireRoutingControl, error)
UpdateRoutingControl renames a routing control.
func (*InMemoryBackend) UpdateRoutingControlStates ¶
func (b *InMemoryBackend) UpdateRoutingControlStates( updates []StateUpdate, overrides []string, clusterID string, ) error
UpdateRoutingControlStates applies all updates atomically after evaluating every affected safety rule.
func (*InMemoryBackend) UpdateSafetyRule ¶
func (b *InMemoryBackend) UpdateSafetyRule(kind, arn, name string, waitPeriodMs int32) (wireRule, error)
UpdateSafetyRule changes a rule's name and wait period; kind must match the stored rule.
type NewRuleSpec ¶
type NewRuleSpec struct {
Name string
PanelARN string
Kind string
RuleType string
Controls []string
Targets []string
Threshold int32
WaitPeriodMs int32
Inverted bool
}
NewRuleSpec is the validated input of CreateSafetyRule.
type Provider ¶
type Provider struct{}
Provider implements service.Provider.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init builds the backend and handler.
type RoutingControl ¶
type RoutingControl struct {
CreatedAt time.Time `json:"createdAt"`
DeletedAt *time.Time `json:"deletedAt,omitempty"`
ARN string `json:"arn"`
PanelARN string `json:"panelArn"`
ClusterARN string `json:"clusterArn"`
Name string `json:"name"`
State string `json:"state"`
}
RoutingControl is an On/Off switch inside a control panel.
type SafetyRule ¶
type SafetyRule struct {
CreatedAt time.Time `json:"createdAt"`
LastChangeAt time.Time `json:"lastChangeAt"`
DeletedAt *time.Time `json:"deletedAt,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
ARN string `json:"arn"`
PanelARN string `json:"panelArn"`
Name string `json:"name"`
Kind string `json:"kind"`
RuleType string `json:"ruleType"`
Controls []string `json:"controls"`
Targets []string `json:"targets,omitempty"`
Threshold int32 `json:"threshold"`
WaitPeriodMs int32 `json:"waitPeriodMs"`
Inverted bool `json:"inverted"`
}
SafetyRule is an ASSERTION or GATING rule guarding routing control updates.
type StateUpdate ¶
StateUpdate is one requested routing control state change.