Documentation
¶
Index ¶
- Variables
- 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(_ *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) Snapshot(ctx context.Context) []byte
- type InMemoryBackend
- func (b *InMemoryBackend) AccountID() string
- func (b *InMemoryBackend) DeleteResourceTree(targetARN string) error
- func (b *InMemoryBackend) GetAccuracyMetrics(predictorArn string) (map[string]any, error)
- func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error
- func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error
- func (b *InMemoryBackend) UpdateResourceStatus(resourceARN, newStatus string) error
- type MonitorEvaluation
- type Provider
- type Resource
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned when a requested Forecast resource is absent. ErrNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrAlreadyExists is returned when a Forecast resource name already exists. ErrAlreadyExists = awserr.New("ResourceAlreadyExistsException", awserr.ErrConflict) // ErrValidation is returned when a Forecast request is invalid. ErrValidation = awserr.New("InvalidInputException", awserr.ErrInvalidParameter) // ErrInvalidNextToken is returned when a List* NextToken cannot be decoded. // Real Amazon Forecast models InvalidNextTokenException on every List operation. ErrInvalidNextToken = awserr.New("InvalidNextTokenException", awserr.ErrInvalidParameter) )
var ErrNilAppContext = errors.New("forecast: nil AppContext")
ErrNilAppContext is returned when Init receives nil context.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
Backend *InMemoryBackend
// contains filtered or unexported fields
}
Handler serves Amazon Forecast JSON protocol operations.
func NewHandler ¶
func NewHandler(backend *InMemoryBackend) *Handler
NewHandler creates Forecast HTTP handler.
func (*Handler) ChaosOperations ¶
ChaosOperations returns supported fault injection operations.
func (*Handler) ChaosRegions ¶
ChaosRegions returns regions handled by instance.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns fault injection service identifier.
func (*Handler) ExtractOperation ¶
ExtractOperation extracts operation from Forecast target.
func (*Handler) ExtractResource ¶
ExtractResource returns no generic resource identifier.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations reports implemented Amazon Forecast operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns Echo handler.
func (*Handler) MatchPriority ¶
MatchPriority returns Forecast header match priority.
func (*Handler) Reset ¶
func (h *Handler) Reset()
Reset clears all backend state for the /_gopherstack/reset test hook.
func (*Handler) RouteMatcher ¶
RouteMatcher matches Forecast target requests.
func (*Handler) Snapshot ¶
Snapshot implements persistence.Persistable by delegating to the backend. Handler previously had no Snapshot/Restore of its own -- and neither did InMemoryBackend -- so cli.go's generic setupPersistence never picked Forecast up at all: dead wiring, with no persistence underneath it either. This delegation (matching the cleanrooms/codecommit/codepipeline/emr/ workmail pattern) is what wires Forecast into persistence for the first time.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend stores Amazon Forecast state with concurrency-safe transitions.
func NewInMemoryBackend ¶
func NewInMemoryBackend(accountID, region string) *InMemoryBackend
NewInMemoryBackend returns a stateful Amazon Forecast backend.
func (*InMemoryBackend) AccountID ¶
func (b *InMemoryBackend) AccountID() string
AccountID returns backend account.
func (*InMemoryBackend) DeleteResourceTree ¶
func (b *InMemoryBackend) DeleteResourceTree(targetARN string) error
DeleteResourceTree deletes a resource and all dependent child resources transitively, mirroring AWS Forecast behavior.
func (*InMemoryBackend) GetAccuracyMetrics ¶
func (b *InMemoryBackend) GetAccuracyMetrics(predictorArn string) (map[string]any, error)
GetAccuracyMetrics returns deterministic backtest accuracy metrics for a predictor, modeled on the AWS Forecast GetAccuracyMetrics response shape (PredictorEvaluationResults -> TestWindows -> Metrics with RMSE, weighted quantile losses, and WAPE/MAPE/MASE error metrics). Values are derived from a stable hash of the predictor ARN so repeated calls return identical numbers, which is what a Terraform/SDK client comparing state expects. This exceeds LocalStack, which returns no evaluation results at all.
func (*InMemoryBackend) ListTagsForResource ¶
func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
ListTagsForResource lists tags for a resource. Real Amazon Forecast returns ResourceNotFoundException when resourceARN does not identify an existing resource.
func (*InMemoryBackend) Region ¶
func (b *InMemoryBackend) Region() string
Region returns backend region.
func (*InMemoryBackend) Reset ¶
func (b *InMemoryBackend) Reset()
Reset clears all in-memory Forecast state. It supports the /_gopherstack/reset test hook so suites start from a clean slate.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore deserializes backend state from a snapshot. It implements persistence.Persistable.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serializes the backend state to JSON. It implements persistence.Persistable.
func (*InMemoryBackend) TagResource ¶
func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error
TagResource adds tags to a resource. Real Amazon Forecast returns ResourceNotFoundException when resourceARN does not identify an existing resource -- TagResource does not silently create tag state for ARNs no resource ever owned.
func (*InMemoryBackend) UntagResource ¶
func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error
UntagResource removes tags from a resource. Real Amazon Forecast returns ResourceNotFoundException when resourceARN does not identify an existing resource.
func (*InMemoryBackend) UpdateResourceStatus ¶
func (b *InMemoryBackend) UpdateResourceStatus(resourceARN, newStatus string) error
UpdateResourceStatus handles StopResource and ResumeResource.
type MonitorEvaluation ¶
type MonitorEvaluation struct {
CreationTime time.Time `json:"CreationTime"`
EvaluationTime time.Time `json:"EvaluationTime"`
PredictorEvent any `json:"PredictorEvent,omitempty"`
Message string `json:"Message,omitempty"`
MonitorArn string `json:"MonitorArn"`
MonitorName string `json:"MonitorName"`
ResourceArn string `json:"ResourceArn,omitempty"`
Status string `json:"Status"`
EvaluationState string `json:"EvaluationState"`
MetricResults []any `json:"MetricResults"`
}
MonitorEvaluation represents one completed evaluation emitted by a predictor monitor.
type Provider ¶
type Provider struct{}
Provider initializes Amazon Forecast.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes Amazon Forecast backend and handler.