timestreaminfluxdb

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: 29 Imported by: 0

README

Timestreaminfluxdb

Parity grade: B · SDK aws-sdk-go-v2/service/timestreaminfluxdb@v1.29.4 · last audited 2026-10-18 (c1af87ba3)

Coverage

Metric Value
PARITY entries audited 24 (24 ok)
Feature families 6 (6 ok)
Known gaps 10
Structural gaps (can't be emulated) 2
Deferred items 0
Resource leaks clean
Known gaps
  • DockerEngine: only CreateDbInstance starts a container; cluster members and restored instances stay metadata-only, and a restored instance starts empty because backups carry no data
  • DockerEngine: RebootDbInstance does not restart the container and UpdateDbInstance does not reconfigure it (no volume is kept, so a restart would lose data)
  • InfluxAuthParametersSecretArn: no Secrets Manager secret is created, so instances report no secret ARN; log in to a docker-backed instance with the username and password
  • DbParameterGroup: parameters are stored and returned but not applied to the engine; InfluxDBv3 parameter groups have no matching engine
  • DbBackupConfigurations: schedules are stored and NextAutomatedBackupTime is computed for HOURLY, DAILY, WEEKLY and MONTHLY, but automated and CONTINUOUS backups are never taken, so ListDbBackups only shows ON_DEMAND backups
  • LogDeliveryConfiguration: the S3 bucket name is checked for shape only and no logs are delivered
  • MaintenanceSchedule: NextMaintenanceTime is derived from the window but no maintenance ever runs (LastMaintenanceTime is never set)
  • VpcSubnetIds: existence is checked through EC2 when wired, but all subnets belonging to one VPC and the security groups are not verified
  • AccessDeniedException: never raised; no IAM authorization is modeled
  • ResourceGroupsTaggingAPI: Timestream for InfluxDB tags are not exposed through the tagging API
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.

  • InfluxDB v3 Core and Enterprise engines and multi-node clusters have no container image the emulator can run; cluster data planes cannot exist.
  • Multi-AZ standby failover, storage throughput tiers and instance classes are labels only: a single local container has no standby or hardware.

More

Documentation

Overview

Package timestreaminfluxdb emulates Amazon Timestream for InfluxDB: DB instances, clusters, parameter groups and backups, with an opt-in docker engine that runs a real InfluxDB 2 server per instance.

Index

Constants

View Source
const (
	// EngineEnv selects the engine mode: "stub" (metadata only, default) or "docker".
	EngineEnv = "TIMESTREAM_INFLUXDB_ENGINE"
	// HostEnv is the address engine-backed instances are reached on; default 127.0.0.1.
	HostEnv = "TIMESTREAM_INFLUXDB_HOST"
	// EngineDockerMode runs a real influxdb:2 container per instance.
	EngineDockerMode = "docker"
)
View Source
const (
	// Image is the InfluxDB 2 image each engine-backed instance runs.
	Image = "influxdb:2"
)

Variables

View Source
var (
	ErrAccessDenied     = errors.New("access denied")
	ErrConflict         = errors.New("conflict")
	ErrInternalServer   = errors.New("internal server error")
	ErrResourceNotFound = errors.New("resource not found")
	ErrQuotaExceeded    = errors.New("service quota exceeded")
	ErrThrottling       = errors.New("throttling")
	ErrValidation       = errors.New("validation")
)

Sentinels, one per exception in the pinned SDK's error set.

Functions

This section is empty.

Types

type BackupConfig

type BackupConfig struct {
	CustomSchedule string `json:"customSchedule,omitempty"`
	Type           string `json:"type"`
	RetentionDays  int32  `json:"retentionDays"`
	Enabled        bool   `json:"enabled"`
}

BackupConfig is an automated backup schedule.

type BackupInput

type BackupInput struct {
	RetentionDays *int32
	Tags          map[string]string
	ResourceID    string
	Name          string
}

BackupInput holds CreateDbBackup parameters.

type ClusterConfig

type ClusterConfig struct {
	DedicatedCompactor   *bool  `json:"dedicatedCompactor,omitempty"`
	IngestQueryInstances *int32 `json:"ingestQueryInstances,omitempty"`
	QueryOnlyInstances   *int32 `json:"queryOnlyInstances,omitempty"`
}

ClusterConfig describes a cluster's node roles.

type ClusterInput

type ClusterInput struct {
	Tags             map[string]string
	LogDelivery      *LogDelivery
	Maintenance      *Maintenance
	AllocatedStorage *int32
	Port             *int32
	Name             string
	Username         string
	Password         string
	Organization     string
	Bucket           string
	DBInstanceType   string
	DBStorageType    string
	DeploymentType   string
	NetworkType      string
	FailoverMode     string
	KMSKeyID         string
	ParameterGroupID string
	SubnetIDs        []string
	SecurityGroupIDs []string
	BackupConfigs    []BackupConfig
	Publicly         bool
}

ClusterInput holds CreateDbCluster parameters.

type ClusterUpdate

type ClusterUpdate struct {
	LogDelivery      *LogDelivery
	Maintenance      *Maintenance
	Port             *int32
	DBInstanceType   string
	ParameterGroupID string
	FailoverMode     string
	BackupConfigs    []BackupConfig
	HasBackupConfigs bool
}

ClusterUpdate holds UpdateDbCluster parameters.

type ContainerRuntime

type ContainerRuntime interface {
	HasImage(ctx context.Context, imageRef string) (bool, error)
	PullImage(ctx context.Context, imageRef string) error
	CreateAndStart(ctx context.Context, spec container.Spec) (string, error)
	StopAndRemove(ctx context.Context, containerID string) error
}

ContainerRuntime is the slice of container.Runtime the docker engine needs.

type DBBackup

type DBBackup struct {
	CreatedAt     time.Time         `json:"createdAt"`
	Tags          map[string]string `json:"tags,omitempty"`
	ClusterConfig *ClusterConfig    `json:"clusterConfig,omitempty"`
	Pending       Pending           `json:"pending"`
	ID            string            `json:"id"`
	Name          string            `json:"name"`
	ARN           string            `json:"arn"`
	AccountID     string            `json:"accountId"`
	Region        string            `json:"region"`
	ResourceID    string            `json:"resourceId"`
	ResourceType  string            `json:"resourceType"`
	EngineType    string            `json:"engineType"`
	FailoverMode  string            `json:"failoverMode,omitempty"`
	Type          string            `json:"type"`
	Username      string            `json:"username"`
	Organization  string            `json:"organization"`
	Bucket        string            `json:"bucket"`
	Placement     Placement         `json:"placement"`
	RetentionDays int32             `json:"retentionDays"`
}

DBBackup is a backup of an instance or cluster.

type DBCluster

type DBCluster struct {
	CreatedAt    time.Time         `json:"createdAt"`
	Tags         map[string]string `json:"tags,omitempty"`
	Config       *ClusterConfig    `json:"config,omitempty"`
	Password     string            `json:"-"`
	Pending      Pending           `json:"pending"`
	ID           string            `json:"id"`
	Name         string            `json:"name"`
	ARN          string            `json:"arn"`
	AccountID    string            `json:"accountId"`
	Region       string            `json:"region"`
	Username     string            `json:"username"`
	Organization string            `json:"organization"`
	Bucket       string            `json:"bucket"`
	EngineType   string            `json:"engineType"`
	FailoverMode string            `json:"failoverMode"`
	Placement    Placement         `json:"placement"`
}

DBCluster is a Timestream for InfluxDB cluster.

type DBInstance

type DBInstance struct {
	CreatedAt    time.Time         `json:"createdAt"`
	Tags         map[string]string `json:"tags,omitempty"`
	Mode         string            `json:"mode,omitempty"`
	Username     string            `json:"username"`
	ID           string            `json:"id"`
	Name         string            `json:"name"`
	ARN          string            `json:"arn"`
	AccountID    string            `json:"accountId"`
	Region       string            `json:"region"`
	ClusterID    string            `json:"clusterId,omitempty"`
	Password     string            `json:"-"`
	Failed       string            `json:"failed,omitempty"`
	Organization string            `json:"organization"`
	Bucket       string            `json:"bucket"`
	AZ           string            `json:"az"`
	StandbyAZ    string            `json:"standbyAz,omitempty"`
	EngineType   string            `json:"engineType"`
	EngineHost   string            `json:"engineHost,omitempty"`
	Pending      Pending           `json:"pending"`
	Placement    Placement         `json:"placement"`
	EnginePort   int32             `json:"enginePort,omitempty"`
}

DBInstance is a Timestream for InfluxDB instance.

type DBParameterGroup

type DBParameterGroup struct {
	Tags        map[string]string `json:"tags,omitempty"`
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	ARN         string            `json:"arn"`
	Description string            `json:"description,omitempty"`
	AccountID   string            `json:"accountId"`
	Region      string            `json:"region"`
	Parameters  json.RawMessage   `json:"parameters,omitempty"`
}

DBParameterGroup is a named set of InfluxDB parameters.

type DockerEngine

type DockerEngine struct {
	Runtime ContainerRuntime
	Ports   *portalloc.Allocator
	HTTP    HTTPDoer
	Host    string
	Image   string
	// PollInterval and StartTimeout bound the readiness wait; zero uses the defaults.
	PollInterval time.Duration
	StartTimeout time.Duration
}

DockerEngine runs one influxdb:2 container per instance.

func (*DockerEngine) Start

func (d *DockerEngine) Start(ctx context.Context, spec EngineSpec) (EngineHandle, error)

Start pulls the image if needed, runs the container initialised from spec and waits for /health.

func (*DockerEngine) Stop

func (d *DockerEngine) Stop(ctx context.Context, h EngineHandle) error

Stop removes the container and frees its host port.

type Engine

type Engine interface {
	// Start launches a server initialised from spec and returns once it accepts connections.
	Start(ctx context.Context, spec EngineSpec) (EngineHandle, error)
	// Stop removes the server.
	Stop(ctx context.Context, h EngineHandle) error
}

Engine runs real InfluxDB servers for instances; nil keeps instances metadata-only.

type EngineHandle

type EngineHandle struct {
	ContainerID string
	Host        string
	Port        int32
}

EngineHandle identifies a running InfluxDB container and where it is reachable.

type EngineSpec

type EngineSpec struct {
	Name         string
	Username     string
	Password     string
	Organization string
	Bucket       string
}

EngineSpec describes the InfluxDB container to run for one instance.

type GroupInput

type GroupInput struct {
	Tags        map[string]string
	Name        string
	Description string
	Parameters  json.RawMessage
}

GroupInput holds CreateDbParameterGroup parameters.

type HTTPDoer

type HTTPDoer interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPDoer sends the readiness probe.

type Handler

type Handler struct {
	Backend       *InMemoryBackend
	DefaultRegion string
}

Handler serves the Timestream for InfluxDB awsjson1.0 API.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler wraps a backend.

func (*Handler) ChaosOperations

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

ChaosOperations lists the fault-injectable operations.

func (*Handler) ChaosRegions

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

ChaosRegions lists the regions this handler serves.

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 from X-Amz-Target.

func (*Handler) ExtractResource

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

ExtractResource returns the operation name; the API has no single resource key.

func (*Handler) GetSupportedOperations

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

GetSupportedOperations lists every routed 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 the AmazonTimestreamInfluxDB X-Amz-Target prefix.

func (*Handler) Shutdown

func (h *Handler) Shutdown(_ context.Context)

Shutdown stops every engine container.

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 is the Timestream for InfluxDB state; one coarse lock guards every table.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates an empty backend.

func (*InMemoryBackend) Close

func (b *InMemoryBackend) Close()

Close stops every engine container and waits for in-flight starts.

func (*InMemoryBackend) CreateDBBackup

func (b *InMemoryBackend) CreateDBBackup(ctx context.Context, in BackupInput) (wBackup, error)

CreateDBBackup takes an on-demand backup of an instance or cluster.

func (*InMemoryBackend) CreateDBCluster

func (b *InMemoryBackend) CreateDBCluster(ctx context.Context, in ClusterInput) (string, string, error)

CreateDBCluster creates a cluster and its member instances in CREATING state.

func (*InMemoryBackend) CreateDBInstance

func (b *InMemoryBackend) CreateDBInstance(ctx context.Context, in InstanceInput) (wInstance, error)

CreateDBInstance creates an instance in CREATING state.

func (*InMemoryBackend) CreateDBParameterGroup

func (b *InMemoryBackend) CreateDBParameterGroup(ctx context.Context, in GroupInput) (wParameterGroup, error)

CreateDBParameterGroup creates a parameter group.

func (*InMemoryBackend) DeleteDBBackup

func (b *InMemoryBackend) DeleteDBBackup(ctx context.Context, id string) (wBackup, error)

DeleteDBBackup starts backup deletion.

func (*InMemoryBackend) DeleteDBCluster

func (b *InMemoryBackend) DeleteDBCluster(ctx context.Context, id string) (string, error)

DeleteDBCluster starts cluster deletion with its member instances.

func (*InMemoryBackend) DeleteDBInstance

func (b *InMemoryBackend) DeleteDBInstance(ctx context.Context, id string) (wInstance, error)

DeleteDBInstance starts instance deletion.

func (*InMemoryBackend) GetDBBackup

func (b *InMemoryBackend) GetDBBackup(ctx context.Context, id string) (wBackup, error)

GetDBBackup returns a backup.

func (*InMemoryBackend) GetDBCluster

func (b *InMemoryBackend) GetDBCluster(ctx context.Context, id string) (wCluster, error)

GetDBCluster returns a cluster.

func (*InMemoryBackend) GetDBInstance

func (b *InMemoryBackend) GetDBInstance(ctx context.Context, id string) (wInstance, error)

GetDBInstance returns an instance.

func (*InMemoryBackend) GetDBParameterGroup

func (b *InMemoryBackend) GetDBParameterGroup(ctx context.Context, id string) (wParameterGroup, error)

GetDBParameterGroup returns a parameter group.

func (*InMemoryBackend) ListDBBackups

func (b *InMemoryBackend) ListDBBackups(
	ctx context.Context, resourceID, token string, maxResults int32,
) (page.Page[wBackupSummary], error)

ListDBBackups lists backups, optionally for one resource, newest first.

func (*InMemoryBackend) ListDBClusters

func (b *InMemoryBackend) ListDBClusters(
	ctx context.Context, token string, maxResults int32,
) (page.Page[wClusterSummary], error)

ListDBClusters lists clusters ordered by name.

func (*InMemoryBackend) ListDBInstances

func (b *InMemoryBackend) ListDBInstances(
	ctx context.Context, token string, maxResults int32,
) (page.Page[wInstanceSummary], error)

ListDBInstances lists instances ordered by name.

func (*InMemoryBackend) ListDBInstancesForCluster

func (b *InMemoryBackend) ListDBInstancesForCluster(
	ctx context.Context, clusterID, token string, maxResults int32,
) (page.Page[wInstanceSummary], error)

ListDBInstancesForCluster lists a cluster's member instances.

func (*InMemoryBackend) ListDBParameterGroups

func (b *InMemoryBackend) ListDBParameterGroups(
	ctx context.Context, token string, maxResults int32,
) (page.Page[wParameterGroupSummary], error)

ListDBParameterGroups lists parameter groups ordered by name.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(ctx context.Context, resourceARN string) (map[string]string, error)

ListTagsForResource returns a resource's tags.

func (*InMemoryBackend) RebootDBCluster

func (b *InMemoryBackend) RebootDBCluster(ctx context.Context, id string, instanceIDs []string) (string, error)

RebootDBCluster reboots a cluster, or only the listed member instances.

func (*InMemoryBackend) RebootDBInstance

func (b *InMemoryBackend) RebootDBInstance(ctx context.Context, id string) (wInstance, error)

RebootDBInstance moves an instance through REBOOTING back to AVAILABLE.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the default region.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears every table and stops engine containers.

func (*InMemoryBackend) Restore

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

Restore loads a snapshot; an incompatible version is discarded.

func (*InMemoryBackend) RestoreFromDBBackup

func (b *InMemoryBackend) RestoreFromDBBackup(ctx context.Context, in RestoreInput) (RestoreResult, error)

RestoreFromDBBackup creates a resource from a backup, or resets the original one.

func (*InMemoryBackend) SetEngine

func (b *InMemoryBackend) SetEngine(e Engine)

SetEngine switches the backend to engine mode: new instances run a real InfluxDB server.

func (*InMemoryBackend) SetLifecycleDelay

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

SetLifecycleDelay overrides the transitional status window.

func (*InMemoryBackend) SetSubnetResolver

func (b *InMemoryBackend) SetSubnetResolver(r SubnetResolver)

SetSubnetResolver wires the EC2 lookup used to validate subnets.

func (*InMemoryBackend) Snapshot

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

Snapshot serialises the backend state.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(ctx context.Context, resourceARN string, add map[string]string) error

TagResource adds or replaces tags.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(ctx context.Context, resourceARN string, keys []string) error

UntagResource removes tags by key.

func (*InMemoryBackend) UpdateDBCluster

func (b *InMemoryBackend) UpdateDBCluster(ctx context.Context, id string, u ClusterUpdate) (string, error)

UpdateDBCluster changes a cluster and moves it to an updating status.

func (*InMemoryBackend) UpdateDBInstance

func (b *InMemoryBackend) UpdateDBInstance(ctx context.Context, id string, u InstanceUpdate) (wInstance, error)

UpdateDBInstance changes an instance and moves it to an updating status.

type InstanceInput

type InstanceInput struct {
	Tags               map[string]string
	LogDelivery        *LogDelivery
	Maintenance        *Maintenance
	Name               string
	Username           string
	Password           string
	Organization       string
	Bucket             string
	DBInstanceType     string
	DBStorageType      string
	DeploymentType     string
	NetworkType        string
	KMSKeyID           string
	ParameterGroupID   string
	SubnetIDs          []string
	SecurityGroupIDs   []string
	BackupConfigs      []BackupConfig
	AllocatedStorage   int32
	Port               int32
	PubliclyAccessible bool
}

InstanceInput holds CreateDbInstance parameters.

type InstanceUpdate

type InstanceUpdate struct {
	LogDelivery      *LogDelivery
	Maintenance      *Maintenance
	AllocatedStorage *int32
	Port             *int32
	DBInstanceType   string
	DBStorageType    string
	DeploymentType   string
	ParameterGroupID string
	BackupConfigs    []BackupConfig
	HasBackupConfigs bool
}

InstanceUpdate holds UpdateDbInstance parameters; nil or empty fields are unchanged.

type LogDelivery

type LogDelivery struct {
	Bucket  string `json:"bucket"`
	Enabled bool   `json:"enabled"`
}

LogDelivery is the S3 log delivery configuration.

type Maintenance

type Maintenance struct {
	Window   string `json:"window"`
	Timezone string `json:"timezone"`
}

Maintenance is the maintenance window.

type Pending

type Pending struct {
	Until  time.Time `json:"until"`
	Kind   string    `json:"kind"`
	Engine bool      `json:"engine,omitempty"`
}

Pending is a transitional status that lasts until Until, or until the engine reports when Engine is set.

type Placement

type Placement struct {
	LogDelivery        *LogDelivery   `json:"logDelivery,omitempty"`
	Maintenance        *Maintenance   `json:"maintenance,omitempty"`
	DBInstanceType     string         `json:"dbInstanceType"`
	DBStorageType      string         `json:"dbStorageType"`
	DeploymentType     string         `json:"deploymentType"`
	NetworkType        string         `json:"networkType"`
	KMSKeyID           string         `json:"kmsKeyId,omitempty"`
	ParameterGroupID   string         `json:"parameterGroupId,omitempty"`
	SubnetIDs          []string       `json:"subnetIds"`
	SecurityGroupIDs   []string       `json:"securityGroupIds"`
	BackupConfigs      []BackupConfig `json:"backupConfigs,omitempty"`
	AllocatedStorage   int32          `json:"allocatedStorage"`
	Port               int32          `json:"port"`
	PubliclyAccessible bool           `json:"publiclyAccessible"`
}

Placement holds the settings shared by instances, clusters and the backups of both.

type Provider

type Provider struct{}

Provider implements service.Provider for Amazon Timestream for InfluxDB.

func (*Provider) Init

Init builds the backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type RestoreInput

type RestoreInput struct {
	RestoreToTime    *time.Time
	Port             *int32
	Publicly         *bool
	LogDelivery      *LogDelivery
	Maintenance      *Maintenance
	Tags             map[string]string
	BackupID         string
	Name             string
	DeploymentType   string
	KMSKeyID         string
	NetworkType      string
	RestoreMode      string
	SubnetIDs        []string
	SecurityGroupIDs []string
	BackupConfigs    []BackupConfig
	HasBackupConfigs bool
}

RestoreInput holds RestoreFromDbBackup parameters.

type RestoreResult

type RestoreResult struct {
	DeploymentType string
	EngineType     string
	ResourceType   string
	ResourceID     string
}

RestoreResult describes the resource a restore produced.

type SubnetResolver

type SubnetResolver interface {
	SubnetCIDR(region, subnetID string) (string, bool)
}

SubnetResolver looks up the IPv4 CIDR of a VPC subnet.

Jump to

Keyboard shortcuts

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