docdb

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 23 Imported by: 0

README

DocumentDB

Parity grade: A · SDK aws-sdk-go-v2/service/docdb@v1.48.11 · last audited 2026-07-23 (04b49136)

Coverage

Metric Value
Operations audited 55 (55 ok)
Feature families 9 (9 ok)
Known gaps none
Deferred items 1
Resource leaks clean
Deferred
  • GlobalCluster member-promotion for a Failover/Switchover target that is neither an existing member, an ARN, nor a locally-known DB cluster identifier is a silent no-op rather than an error -- real AWS would reject an unresolvable target, but this backend has no "join global cluster" operation to have modeled a genuine not-yet-attached secondary (same documented precedent as the already-completed neptune service), so it cannot distinguish that case from a typo without one.

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClusterNotFound                    = awserr.New("DBClusterNotFoundFault", awserr.ErrNotFound)
	ErrClusterAlreadyExists               = awserr.New("DBClusterAlreadyExistsFault", awserr.ErrAlreadyExists)
	ErrInstanceNotFound                   = awserr.New("DBInstanceNotFound", awserr.ErrNotFound)
	ErrInstanceAlreadyExists              = awserr.New("DBInstanceAlreadyExists", awserr.ErrAlreadyExists)
	ErrSubnetGroupNotFound                = awserr.New("DBSubnetGroupNotFoundFault", awserr.ErrNotFound)
	ErrSubnetGroupAlreadyExists           = awserr.New("DBSubnetGroupAlreadyExists", awserr.ErrAlreadyExists)
	ErrSubnetGroupInUse                   = awserr.New("InvalidDBSubnetGroupStateFault", awserr.ErrInvalidParameter)
	ErrClusterParameterGroupNotFound      = awserr.New("DBParameterGroupNotFound", awserr.ErrNotFound)
	ErrClusterParameterGroupAlreadyExists = awserr.New(
		"DBParameterGroupAlreadyExists",
		awserr.ErrAlreadyExists,
	)
	ErrParameterGroupInUse            = awserr.New("InvalidDBParameterGroupState", awserr.ErrInvalidParameter)
	ErrClusterSnapshotNotFound        = awserr.New("DBClusterSnapshotNotFoundFault", awserr.ErrNotFound)
	ErrClusterSnapshotAlreadyExists   = awserr.New("DBClusterSnapshotAlreadyExistsFault", awserr.ErrAlreadyExists)
	ErrEventSubscriptionNotFound      = awserr.New("SubscriptionNotFound", awserr.ErrNotFound)
	ErrEventSubscriptionAlreadyExists = awserr.New("SubscriptionAlreadyExist", awserr.ErrAlreadyExists)
	ErrGlobalClusterNotFound          = awserr.New("GlobalClusterNotFoundFault", awserr.ErrNotFound)
	ErrGlobalClusterAlreadyExists     = awserr.New("GlobalClusterAlreadyExistsFault", awserr.ErrAlreadyExists)
	ErrInvalidParameter               = awserr.New("InvalidParameterValue", awserr.ErrInvalidParameter)
	ErrUnknownAction                  = awserr.New("InvalidAction", awserr.ErrInvalidParameter)
	ErrInvalidClusterState            = awserr.New("InvalidDBClusterStateFault", awserr.ErrInvalidParameter)
)

Error code strings below are the literal wire values the real aws-sdk-go-v2/service/docdb query-protocol error deserializers switch on (see deserializers.go's awsAwsquery_deserializeOpError* functions for each operation), NOT the Go SDK type names (which all end in "...Fault"). AWS's DocDB API is inconsistent here: some resources put "Fault" on the wire code (DBCluster, DBClusterSnapshot, GlobalCluster, InvalidDBClusterStateFault, InvalidDBSubnetGroupStateFault), while others strip it (DBInstance, DBSubnetGroup-already-exists) or additionally drop "Cluster" and reuse the plain RDS DBParameterGroup codes for DBClusterParameterGroup operations (CreateDBClusterParameterGroup, ModifyDBClusterParameterGroup, etc. all switch on "DBParameterGroupNotFound"/"DBParameterGroupAlreadyExists"/ "InvalidDBParameterGroupState", never "DBClusterParameterGroup...Fault"). A wire code that doesn't match the SDK's switch falls through to smithy.GenericAPIError, so real callers doing errors.As against the typed fault (e.g. *types.DBInstanceNotFoundFault) silently stop matching.

View Source
var ErrNilAppContext = errors.New("AppContext is required")

ErrNilAppContext is returned when Init is called with a nil AppContext.

Functions

This section is empty.

Types

type Certificate

type Certificate struct {
	CertificateIdentifier string
	CertificateType       string
	Thumbprint            string
	ValidFrom             string
	ValidTill             string
}

type CreateDBClusterOptions

type CreateDBClusterOptions struct {
	KmsKeyID                         string
	VpcSecurityGroupIDs              []string
	EnabledCloudwatchLogsExports     []string
	IAMDatabaseAuthenticationEnabled bool
}

CreateDBClusterOptions holds optional parameters for CreateDBCluster.

type CreateDBInstanceOptions

type CreateDBInstanceOptions struct {
	CACertificateIdentifier string
	CopyTagsToSnapshot      bool
}

CreateDBInstanceOptions holds optional parameters for CreateDBInstance.

type DBCluster

type DBCluster struct {
	Tags                             map[string]string `json:"tags"`
	DBClusterArn                     string            `json:"dbClusterArn"`
	EngineVersion                    string            `json:"engineVersion"`
	Engine                           string            `json:"engine"`
	PreferredMaintenanceWindow       string            `json:"preferredMaintenanceWindow"`
	MasterUsername                   string            `json:"masterUsername"`
	DatabaseName                     string            `json:"databaseName"`
	DBClusterParameterGroupName      string            `json:"dbClusterParameterGroupName"`
	Endpoint                         string            `json:"endpoint"`
	DBClusterIdentifier              string            `json:"dbClusterIdentifier"`
	ReaderEndpoint                   string            `json:"readerEndpoint"`
	Status                           string            `json:"status"`
	DBSubnetGroupName                string            `json:"dbSubnetGroupName"`
	PreferredBackupWindow            string            `json:"preferredBackupWindow"`
	ClusterCreateTime                string            `json:"clusterCreateTime"`
	HostedZoneID                     string            `json:"hostedZoneId"`
	KmsKeyID                         string            `json:"kmsKeyId"`
	ReplicationSourceIdentifier      string            `json:"replicationSourceIdentifier"`
	AvailabilityZones                []string          `json:"availabilityZones"`
	VpcSecurityGroupIDs              []string          `json:"vpcSecurityGroupIds"`
	EnabledCloudwatchLogsExports     []string          `json:"enabledCloudwatchLogsExports"`
	ReadReplicaIdentifiers           []string          `json:"readReplicaIdentifiers"`
	Port                             int               `json:"port"`
	BackupRetentionPeriod            int               `json:"backupRetentionPeriod"`
	StorageEncrypted                 bool              `json:"storageEncrypted"`
	MultiAZ                          bool              `json:"multiAZ"`
	DeletionProtection               bool              `json:"deletionProtection"`
	IAMDatabaseAuthenticationEnabled bool              `json:"iamDatabaseAuthenticationEnabled"`
	// contains filtered or unexported fields
}

type DBClusterMemberEntry

type DBClusterMemberEntry struct {
	DBInstanceIdentifier string
	PromotionTier        int
	IsClusterWriter      bool
}

DBClusterMemberEntry represents an instance that is a member of a DB cluster.

type DBClusterParameter

type DBClusterParameter struct {
	ParameterName  string
	ParameterValue string
	Description    string
	Source         string
	ApplyType      string
	ApplyMethod    string
	DataType       string
	IsModifiable   bool
}

type DBClusterParameterGroup

type DBClusterParameterGroup struct {
	Tags                        map[string]string `json:"tags"`
	Parameters                  map[string]string `json:"parameters"`
	DBClusterParameterGroupName string            `json:"dbClusterParameterGroupName"`
	DBParameterGroupFamily      string            `json:"dbParameterGroupFamily"`
	Description                 string            `json:"description"`
	DBClusterParameterGroupArn  string            `json:"dbClusterParameterGroupArn"`
	// contains filtered or unexported fields
}

type DBClusterSnapshot

type DBClusterSnapshot struct {
	Tags                        map[string]string `json:"tags"`
	DBClusterSnapshotIdentifier string            `json:"dbClusterSnapshotIdentifier"`
	DBClusterIdentifier         string            `json:"dbClusterIdentifier"`
	DBClusterArn                string            `json:"dbClusterArn"`
	Engine                      string            `json:"engine"`
	Status                      string            `json:"status"`
	EngineVersion               string            `json:"engineVersion"`
	SnapshotType                string            `json:"snapshotType"`
	SnapshotCreateTime          string            `json:"snapshotCreateTime"`
	PercentProgress             int               `json:"percentProgress"`
	StorageEncrypted            bool              `json:"storageEncrypted"`
	// contains filtered or unexported fields
}

type DBClusterSnapshotAttribute

type DBClusterSnapshotAttribute struct {
	AttributeName   string   `json:"attributeName"`
	AttributeValues []string `json:"attributeValues"`
}

DBClusterSnapshotAttribute represents a single attribute of a cluster snapshot.

type DBClusterSnapshotAttributesResult

type DBClusterSnapshotAttributesResult struct {
	DBClusterSnapshotIdentifier string                       `json:"dbClusterSnapshotIdentifier"`
	Attributes                  []DBClusterSnapshotAttribute `json:"attributes"`
	// contains filtered or unexported fields
}

DBClusterSnapshotAttributesResult holds the attributes for a cluster snapshot.

type DBEngineVersion

type DBEngineVersion struct {
	Engine              string
	EngineVersion       string
	DBEngineDescription string
}

DBEngineVersion represents a supported DocDB engine version.

type DBInstance

type DBInstance struct {
	Tags                         map[string]string `json:"tags"`
	DBInstanceIdentifier         string            `json:"dbInstanceIdentifier"`
	DBClusterIdentifier          string            `json:"dbClusterIdentifier"`
	DBInstanceClass              string            `json:"dbInstanceClass"`
	Engine                       string            `json:"engine"`
	DBInstanceStatus             string            `json:"dbInstanceStatus"`
	Endpoint                     string            `json:"endpoint"`
	DBInstanceArn                string            `json:"dbInstanceArn"`
	EngineVersion                string            `json:"engineVersion"`
	AvailabilityZone             string            `json:"availabilityZone"`
	DBSubnetGroupName            string            `json:"dbSubnetGroupName"`
	PreferredMaintenanceWindow   string            `json:"preferredMaintenanceWindow"`
	CACertificateIdentifier      string            `json:"caCertificateIdentifier"`
	EnabledCloudwatchLogsExports []string          `json:"enabledCloudwatchLogsExports"`
	Port                         int               `json:"port"`
	PromotionTier                int               `json:"promotionTier"`
	StorageEncrypted             bool              `json:"storageEncrypted"`
	AutoMinorVersionUpgrade      bool              `json:"autoMinorVersionUpgrade"`
	PubliclyAccessible           bool              `json:"publiclyAccessible"`
	CopyTagsToSnapshot           bool              `json:"copyTagsToSnapshot"`
	// contains filtered or unexported fields
}

type DBSubnetGroup

type DBSubnetGroup struct {
	Tags                     map[string]string `json:"tags"`
	DBSubnetGroupName        string            `json:"dbSubnetGroupName"`
	DBSubnetGroupDescription string            `json:"dbSubnetGroupDescription"`
	VpcID                    string            `json:"vpcID"`
	Status                   string            `json:"status"`
	DBSubnetGroupArn         string            `json:"dbSubnetGroupArn"`
	SubnetIDs                []string          `json:"subnetIDs"`
	// contains filtered or unexported fields
}

type DeleteDBClusterOptions

type DeleteDBClusterOptions struct {
	FinalDBClusterSnapshotIdentifier string
	SkipFinalSnapshot                bool
}

DeleteDBClusterOptions holds optional parameters for DeleteDBCluster.

type Event added in v1.2.0

type Event struct {
	SourceIdentifier string   `json:"sourceIdentifier"`
	SourceType       string   `json:"sourceType"`
	Message          string   `json:"message"`
	SourceArn        string   `json:"sourceArn"`
	Date             string   `json:"date"`
	EventCategories  []string `json:"eventCategories"`
}

Event represents a single DocDB account-activity event (types.Event: Date/EventCategories/Message/SourceArn/SourceIdentifier/SourceType). It backs the real event log fed by recordEvent (events.go) from the key cluster/instance/snapshot lifecycle mutators.

type EventCategoryMap

type EventCategoryMap struct {
	SourceType      string
	EventCategories []string
}

EventCategoryMap maps a source type to a list of event categories.

type EventSubscription

type EventSubscription struct {
	SubscriptionName         string   `json:"subscriptionName"`
	SnsTopicARN              string   `json:"snsTopicARN"`
	Status                   string   `json:"status"`
	SourceType               string   `json:"sourceType"`
	EventSubscriptionArn     string   `json:"eventSubscriptionArn"`
	CustomerAwsID            string   `json:"customerAwsID"`
	SubscriptionCreationTime string   `json:"subscriptionCreationTime"`
	SourceIDs                []string `json:"sourceIDs"`
	EventCategories          []string `json:"eventCategories"`
	Enabled                  bool     `json:"enabled"`
	// contains filtered or unexported fields
}

type EventsFilter added in v1.2.0

type EventsFilter struct {
	SourceIdentifier string
	SourceType       string
	StartTime        string
	EndTime          string
	EventCategories  []string
	Duration         int
}

EventsFilter holds the filter values DescribeEvents accepts (DescribeEventsInput: SourceIdentifier/SourceType/StartTime/EndTime/ Duration/EventCategories -- Filters is documented "not currently supported" by AWS itself, so it is intentionally not modeled here).

type GlobalCluster

type GlobalCluster struct {
	GlobalClusterIdentifier string                `json:"globalClusterIdentifier"`
	SourceDBClusterID       string                `json:"sourceDBClusterID"`
	Status                  string                `json:"status"`
	Engine                  string                `json:"engine"`
	EngineVersion           string                `json:"engineVersion"`
	GlobalClusterArn        string                `json:"globalClusterArn"`
	GlobalClusterMembers    []GlobalClusterMember `json:"globalClusterMembers"`
	StorageEncrypted        bool                  `json:"storageEncrypted"`
	DeletionProtection      bool                  `json:"deletionProtection"`
}

type GlobalClusterMember added in v1.2.0

type GlobalClusterMember struct {
	DBClusterArn          string   `json:"dbClusterArn"`
	SynchronizationStatus string   `json:"synchronizationStatus"`
	Readers               []string `json:"readers"`
	IsWriter              bool     `json:"isWriter"`
}

GlobalClusterMember represents a single DB cluster's membership in a global cluster (types.GlobalClusterMember: DBClusterArn/IsWriter/Readers/ SynchronizationStatus).

type Handler

type Handler struct {
	Backend *InMemoryBackend
}

Handler is the Echo HTTP handler for DocDB operations.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a new DocDB handler.

func (*Handler) ChaosOperations

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

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

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

ChaosRegions returns all regions this DocDB instance handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

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

ExtractOperation extracts the DocDB action from the request.

func (*Handler) ExtractResource

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

ExtractResource returns the DB cluster identifier from the request.

func (*Handler) GetSupportedOperations

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

GetSupportedOperations returns supported DocDB operations.

func (*Handler) Handler

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

Handler returns the Echo handler function.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority for DocDB (higher than RDS to intercept DocDB requests first).

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all backend state.

func (*Handler) Restore

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

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

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

RouteMatcher returns a function that matches DocDB requests.

func (*Handler) Snapshot

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

Snapshot implements persistence.Persistable by delegating to the backend.

type InMemoryBackend

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

InMemoryBackend is the in-memory store for DocDB resources.

Seven resource collections that were previously nested by region (outer key = region, e.g. map[string]map[string]*DBCluster) are now each a single flat *store.Table keyed by the composite "region|id" string (see regionKey below), with a companion *store.Index grouping entries by region for per-region scans -- see store_setup.go for the full rationale. Six of the seven also have a byRegion index; snapshotAttributes does not (it is only ever looked up/written by its exact composite key, never listed by region). GlobalClusters are partition-scoped and remain a plain (non-composite-key) *store.Table. tags remains a raw nested map: its value (a bare []Tag) carries no identity of its own to key a store.Table by (see store_setup.go's doc comment for the full rationale).

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

func (*InMemoryBackend) AddDBClusterInternal

func (b *InMemoryBackend) AddDBClusterInternal(cluster *DBCluster)

AddDBClusterInternal seeds a cluster directly for testing.

func (*InMemoryBackend) AddDBClusterParameterGroupInternal

func (b *InMemoryBackend) AddDBClusterParameterGroupInternal(pg *DBClusterParameterGroup)

AddDBClusterParameterGroupInternal seeds a parameter group directly for testing.

func (*InMemoryBackend) AddDBClusterSnapshotInternal

func (b *InMemoryBackend) AddDBClusterSnapshotInternal(snap *DBClusterSnapshot)

AddDBClusterSnapshotInternal seeds a snapshot directly for testing.

func (*InMemoryBackend) AddDBInstanceInternal

func (b *InMemoryBackend) AddDBInstanceInternal(inst *DBInstance)

AddDBInstanceInternal seeds an instance directly for testing.

func (*InMemoryBackend) AddDBSubnetGroupInternal

func (b *InMemoryBackend) AddDBSubnetGroupInternal(sg *DBSubnetGroup)

AddDBSubnetGroupInternal seeds a subnet group directly for testing.

func (*InMemoryBackend) AddEventSubscriptionInternal

func (b *InMemoryBackend) AddEventSubscriptionInternal(sub *EventSubscription)

AddEventSubscriptionInternal seeds an event subscription directly for testing.

func (*InMemoryBackend) AddGlobalClusterInternal

func (b *InMemoryBackend) AddGlobalClusterInternal(gc *GlobalCluster)

AddGlobalClusterInternal seeds a global cluster directly for testing.

func (*InMemoryBackend) AddPendingMaintenanceActionInternal added in v1.2.0

func (b *InMemoryBackend) AddPendingMaintenanceActionInternal(
	resourceARN, action, description string,
) *PendingMaintenanceAction

AddPendingMaintenanceActionInternal queues a maintenance action for a resource, bypassing normal validation. Used for seeding tests.

func (*InMemoryBackend) AddSourceIdentifierToSubscription

func (b *InMemoryBackend) AddSourceIdentifierToSubscription(
	ctx context.Context,
	subscriptionName, sourceID string,
) (*EventSubscription, error)

AddSourceIdentifierToSubscription adds a source identifier to an event subscription.

func (*InMemoryBackend) AddTagsToResource

func (b *InMemoryBackend) AddTagsToResource(ctx context.Context, arnStr string, tags []Tag) error

func (*InMemoryBackend) ApplyPendingMaintenanceAction

func (b *InMemoryBackend) ApplyPendingMaintenanceAction(
	_ context.Context, resourceARN, action, optInType string,
) (*ResourcePendingMaintenanceActions, error)

ApplyPendingMaintenanceAction applies (or opts in/out of) a queued maintenance action for a resource, returning that resource's current full set of pending actions -- matching AWS's ApplyPendingMaintenanceActionOutput, which always echoes ResourcePendingMaintenanceActions rather than just the one action touched. Calling Apply for a resource/action combination that was never queued (nothing was ever seeded/became eligible) is not an error -- it mirrors AWS's own opt-in semantics, where opting into a maintenance action that doesn't currently apply to the resource is a harmless no-op -- so it simply returns whatever (possibly empty) pending-action set the resource already has.

func (*InMemoryBackend) CopyDBClusterParameterGroup

func (b *InMemoryBackend) CopyDBClusterParameterGroup(
	ctx context.Context,
	sourceGroupName, targetName, targetDescription string,
) (*DBClusterParameterGroup, error)

CopyDBClusterParameterGroup copies a DB cluster parameter group.

func (*InMemoryBackend) CopyDBClusterSnapshot

func (b *InMemoryBackend) CopyDBClusterSnapshot(
	ctx context.Context,
	sourceSnapshotID, targetSnapshotID string,
) (*DBClusterSnapshot, error)

CopyDBClusterSnapshot copies a DB cluster snapshot.

func (*InMemoryBackend) CreateDBCluster

func (b *InMemoryBackend) CreateDBCluster(
	ctx context.Context,
	id, engine, engineVersion, masterUser, masterUserPassword, dbName, paramGroupName, subnetGroupName string,
	port int,
	storageEncrypted, deletionProtection bool,
	backupRetentionPeriod int,
	preferredBackupWindow, preferredMaintenanceWindow string,
	availabilityZones []string,
	tags map[string]string,
	opts *CreateDBClusterOptions,
) (*DBCluster, error)

func (*InMemoryBackend) CreateDBClusterParameterGroup

func (b *InMemoryBackend) CreateDBClusterParameterGroup(
	ctx context.Context,
	name, family, description string,
	tags map[string]string,
) (*DBClusterParameterGroup, error)

func (*InMemoryBackend) CreateDBClusterSnapshot

func (b *InMemoryBackend) CreateDBClusterSnapshot(
	ctx context.Context,
	snapshotID, clusterID string,
	tags map[string]string,
) (*DBClusterSnapshot, error)

func (*InMemoryBackend) CreateDBInstance

func (b *InMemoryBackend) CreateDBInstance(
	ctx context.Context,
	id, clusterID, instanceClass, engine string,
	promotionTier int,
	tags map[string]string,
	opts *CreateDBInstanceOptions,
) (*DBInstance, error)

func (*InMemoryBackend) CreateDBSubnetGroup

func (b *InMemoryBackend) CreateDBSubnetGroup(
	ctx context.Context,
	name, description, vpcID string,
	subnetIDs []string,
	tags map[string]string,
) (*DBSubnetGroup, error)

func (*InMemoryBackend) CreateEventSubscription

func (b *InMemoryBackend) CreateEventSubscription(
	ctx context.Context,
	name, snsTopicARN, sourceType string,
	eventCategories, sourceIDs []string,
	enabled *bool,
) (*EventSubscription, error)

CreateEventSubscription creates an event subscription. enabled mirrors CreateEventSubscriptionInput.Enabled (a real request field this backend previously dropped on the floor -- never parsed by the handler, never stored, never echoed back); when the caller doesn't specify it, AWS activates new subscriptions by default, so a nil enabled defaults to true.

func (*InMemoryBackend) CreateGlobalCluster

func (b *InMemoryBackend) CreateGlobalCluster(
	ctx context.Context,
	id, sourceDBClusterID, engine, engineVersion string,
) (*GlobalCluster, error)

CreateGlobalCluster creates a global cluster. When sourceDBClusterID resolves to a real cluster in the caller's region, it is added as the initial (and, per AWS's current one-item limit, sole) writer member.

func (*InMemoryBackend) DeleteDBCluster

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

func (*InMemoryBackend) DeleteDBClusterParameterGroup

func (b *InMemoryBackend) DeleteDBClusterParameterGroup(ctx context.Context, name string) error

func (*InMemoryBackend) DeleteDBClusterSnapshot

func (b *InMemoryBackend) DeleteDBClusterSnapshot(ctx context.Context, snapshotID string) (*DBClusterSnapshot, error)

func (*InMemoryBackend) DeleteDBInstance

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

func (*InMemoryBackend) DeleteDBSubnetGroup

func (b *InMemoryBackend) DeleteDBSubnetGroup(ctx context.Context, name string) error

func (*InMemoryBackend) DeleteEventSubscription

func (b *InMemoryBackend) DeleteEventSubscription(ctx context.Context, name string) (*EventSubscription, error)

DeleteEventSubscription deletes an event subscription.

func (*InMemoryBackend) DeleteGlobalCluster

func (b *InMemoryBackend) DeleteGlobalCluster(_ context.Context, id string) (*GlobalCluster, error)

DeleteGlobalCluster deletes a global cluster.

func (*InMemoryBackend) DescribeCertificates

func (b *InMemoryBackend) DescribeCertificates(_ context.Context, certificateID string) []Certificate

DescribeCertificates returns certificate information.

func (*InMemoryBackend) DescribeDBClusterParameterGroups

func (b *InMemoryBackend) DescribeDBClusterParameterGroups(
	ctx context.Context,
	name string,
) ([]DBClusterParameterGroup, error)

func (*InMemoryBackend) DescribeDBClusterParameters

func (b *InMemoryBackend) DescribeDBClusterParameters(
	ctx context.Context,
	groupName string,
) ([]DBClusterParameter, error)

DescribeDBClusterParameters returns the parameters for a DB cluster parameter group.

func (*InMemoryBackend) DescribeDBClusterSnapshotAttributes

func (b *InMemoryBackend) DescribeDBClusterSnapshotAttributes(
	ctx context.Context,
	snapshotID string,
) (*DBClusterSnapshotAttributesResult, error)

DescribeDBClusterSnapshotAttributes returns attributes for a cluster snapshot.

func (*InMemoryBackend) DescribeDBClusterSnapshots

func (b *InMemoryBackend) DescribeDBClusterSnapshots(
	ctx context.Context,
	snapshotID, clusterID, snapshotType string,
) ([]DBClusterSnapshot, error)

func (*InMemoryBackend) DescribeDBClusters

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

func (*InMemoryBackend) DescribeDBEngineVersions

func (b *InMemoryBackend) DescribeDBEngineVersions(_ context.Context, engine, engineVersion string) []DBEngineVersion

DescribeDBEngineVersions returns available engine versions, optionally filtered.

func (*InMemoryBackend) DescribeDBInstances

func (b *InMemoryBackend) DescribeDBInstances(ctx context.Context, id, clusterID string) ([]DBInstance, error)

func (*InMemoryBackend) DescribeDBSubnetGroups

func (b *InMemoryBackend) DescribeDBSubnetGroups(ctx context.Context, name string) ([]DBSubnetGroup, error)

func (*InMemoryBackend) DescribeEngineDefaultClusterParameters

func (b *InMemoryBackend) DescribeEngineDefaultClusterParameters(
	_ context.Context,
	_ string,
) []DBClusterParameter

DescribeEngineDefaultClusterParameters returns the default parameters for an engine family.

func (*InMemoryBackend) DescribeEventCategories

func (b *InMemoryBackend) DescribeEventCategories(_ context.Context, sourceType string) []EventCategoryMap

DescribeEventCategories returns the event categories for DocDB.

func (*InMemoryBackend) DescribeEventSubscriptions

func (b *InMemoryBackend) DescribeEventSubscriptions(ctx context.Context, name string) []EventSubscription

DescribeEventSubscriptions returns event subscriptions, optionally filtered by name.

func (*InMemoryBackend) DescribeEvents added in v1.2.0

func (b *InMemoryBackend) DescribeEvents(ctx context.Context, filter EventsFilter) []Event

DescribeEvents returns the account activity events recorded for the request's region, filtered per filter. Matches AWS's default lookback window (Duration minutes, default 60) when no explicit StartTime is given.

func (*InMemoryBackend) DescribeGlobalClusters

func (b *InMemoryBackend) DescribeGlobalClusters(_ context.Context, id string) []GlobalCluster

DescribeGlobalClusters returns global clusters, optionally filtered by ID, sorted by identifier.

func (*InMemoryBackend) DescribePendingMaintenanceActions

func (b *InMemoryBackend) DescribePendingMaintenanceActions(
	_ context.Context, resourceARN string,
) []ResourcePendingMaintenanceActions

DescribePendingMaintenanceActions returns the pending maintenance actions for every resource that has at least one queued (resourceARN, when non-empty, restricts results to a single resource ARN, matching DescribePendingMaintenanceActionsInput.ResourceIdentifier) -- AWS never includes a ResourcePendingMaintenanceActions entry with an empty PendingMaintenanceActionDetails list.

func (*InMemoryBackend) FailoverDBCluster

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

func (*InMemoryBackend) FailoverGlobalCluster

func (b *InMemoryBackend) FailoverGlobalCluster(
	ctx context.Context, id, targetDBClusterID string,
) (*GlobalCluster, error)

FailoverGlobalCluster initiates a failover for a global cluster, promoting targetDBClusterID to the new writer -- see promoteGlobalClusterWriter.

func (*InMemoryBackend) GetClusterMembers

func (b *InMemoryBackend) GetClusterMembers(ctx context.Context, clusterID string) []DBClusterMemberEntry

GetClusterMembers returns the instances that belong to a given cluster, ordered by identifier.

func (*InMemoryBackend) HasTaggableResource added in v1.2.0

func (b *InMemoryBackend) HasTaggableResource(ctx context.Context, arnStr string) bool

HasTaggableResource reports whether arnStr refers to a resource DocDB actually stores, resolving the region from the ARN (falling back to ctx) exactly as AddTagsToResource does. AddTagsToResource/RemoveTagsFromResource above do not themselves validate that an ARN corresponds to a real resource -- they accept and store tags for any ARN, matching this backend's existing permissive semantics -- so this exists solely for cross-service tagging (resourcegroupstaggingapi, wired in cli.go's wireTaggingDocDB): every DocumentDB resource kind builds its ARN under the "rds" ARN service (clusterARN, instanceARN, subnetGroupARN, clusterParameterGroupARN, clusterSnapshotARN, globalClusterARN, and eventSubscriptionARN in store.go:232-266), the same service segment the separate RDS backend claims, so ownership must be checked explicitly before a cross-service TagResources call is allowed to claim an ARN that might really belong to RDS.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(ctx context.Context, arnStr string) []Tag

func (*InMemoryBackend) ModifyDBCluster

func (b *InMemoryBackend) ModifyDBCluster(
	ctx context.Context,
	id, paramGroupName string,
	deletionProtection *bool,
	backupRetentionPeriod int,
	preferredBackupWindow, preferredMaintenanceWindow string,
	opts *ModifyDBClusterOptions,
) (*DBCluster, error)

func (*InMemoryBackend) ModifyDBClusterParameterGroup

func (b *InMemoryBackend) ModifyDBClusterParameterGroup(
	ctx context.Context,
	name string,
	parameters map[string]string,
) (*DBClusterParameterGroup, error)

func (*InMemoryBackend) ModifyDBClusterSnapshotAttribute

func (b *InMemoryBackend) ModifyDBClusterSnapshotAttribute(
	ctx context.Context,
	snapshotID, attributeName string,
	valuesToAdd, valuesToRemove []string,
) (*DBClusterSnapshotAttributesResult, error)

func (*InMemoryBackend) ModifyDBInstance

func (b *InMemoryBackend) ModifyDBInstance(
	ctx context.Context,
	id, instanceClass string,
	autoMinorVersionUpgrade *bool,
	preferredMaintenanceWindow string,
	opts *ModifyDBInstanceOptions,
) (*DBInstance, error)

func (*InMemoryBackend) ModifyDBSubnetGroup

func (b *InMemoryBackend) ModifyDBSubnetGroup(
	ctx context.Context,
	name, description string,
	subnetIDs []string,
) (*DBSubnetGroup, error)

ModifyDBSubnetGroup modifies a DB subnet group.

func (*InMemoryBackend) ModifyEventSubscription

func (b *InMemoryBackend) ModifyEventSubscription(
	ctx context.Context,
	name, snsTopicARN, sourceType string,
	eventCategories []string,
	enabled *bool,
) (*EventSubscription, error)

ModifyEventSubscription modifies an event subscription. enabled mirrors ModifyEventSubscriptionInput.Enabled -- nil means the caller didn't specify it (leave the existing value alone), matching this backend's existing convention for other optional-bool fields (see e.g. ModifyDBCluster's deletionProtection *bool).

func (*InMemoryBackend) ModifyGlobalCluster

func (b *InMemoryBackend) ModifyGlobalCluster(
	_ context.Context,
	id, newID string,
	deletionProtection *bool,
) (*GlobalCluster, error)

ModifyGlobalCluster modifies a global cluster.

func (*InMemoryBackend) RebootDBInstance

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

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the backend's configured default AWS region.

func (*InMemoryBackend) RemoveFromGlobalCluster

func (b *InMemoryBackend) RemoveFromGlobalCluster(
	ctx context.Context,
	globalClusterID, dbClusterID string,
) (*GlobalCluster, error)

RemoveFromGlobalCluster removes a DB cluster from a global cluster, deleting the member entry whose ARN matches dbClusterID (accepted as either an ARN or a bare identifier, resolved the same way as Failover/ Switchover's target).

func (*InMemoryBackend) RemoveSourceIdentifierFromSubscription

func (b *InMemoryBackend) RemoveSourceIdentifierFromSubscription(
	ctx context.Context,
	subscriptionName, sourceID string,
) (*EventSubscription, error)

RemoveSourceIdentifierFromSubscription removes a source identifier from an event subscription.

func (*InMemoryBackend) RemoveTagsFromResource

func (b *InMemoryBackend) RemoveTagsFromResource(ctx context.Context, arnStr string, keys []string)

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all stored state, returning the backend to an empty state.

It calls b.registry.ResetAll() rather than re-registering tables: registerAllTables must run exactly once, at construction (store.Register panics on a duplicate name) -- see the doc comment on registerAllTables in store_setup.go.

func (*InMemoryBackend) ResetDBClusterParameterGroup

func (b *InMemoryBackend) ResetDBClusterParameterGroup(
	ctx context.Context,
	name string,
	resetAll bool,
	paramNames []string,
) (*DBClusterParameterGroup, error)

ResetDBClusterParameterGroup resets a parameter group to its default values: when resetAll is true, every user override is discarded (the whole group reverts to engine defaults); otherwise only the overrides named in paramNames are discarded, leaving the rest untouched. This previously validated the group and returned an unchanged clone without ever touching pg.Parameters -- a disguised no-op that made ResetDBClusterParameterGroup silently do nothing regardless of what a real caller asked to reset (real AWS's own doc comment: "To reset the entire cluster parameter group, specify ... ResetAllParameters. To reset specific parameters, submit a list of ... ParameterName").

func (*InMemoryBackend) Restore

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

Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) RestoreDBClusterFromSnapshot

func (b *InMemoryBackend) RestoreDBClusterFromSnapshot(
	ctx context.Context,
	snapshotID, clusterID, engine string,
) (*DBCluster, error)

RestoreDBClusterFromSnapshot restores a new cluster from a snapshot.

func (*InMemoryBackend) RestoreDBClusterToPointInTime

func (b *InMemoryBackend) RestoreDBClusterToPointInTime(
	ctx context.Context,
	sourceClusterID, targetClusterID string,
) (*DBCluster, error)

RestoreDBClusterToPointInTime restores a new cluster to a point in time from a source cluster.

func (*InMemoryBackend) Snapshot

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

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

func (*InMemoryBackend) StartDBCluster

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

func (*InMemoryBackend) StopDBCluster

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

func (*InMemoryBackend) SwitchoverGlobalCluster

func (b *InMemoryBackend) SwitchoverGlobalCluster(
	ctx context.Context, id, targetDBClusterID string,
) (*GlobalCluster, error)

SwitchoverGlobalCluster initiates a switchover for a global cluster, promoting targetDBClusterID the same way FailoverGlobalCluster does -- the two AWS operations differ in data-loss guarantees (switchover is graceful, failover is not), a distinction this synchronous in-memory backend has no failure window to model, so both perform the same real member promotion.

func (*InMemoryBackend) TaggedResources added in v1.2.0

func (b *InMemoryBackend) TaggedResources() []TaggedEntry

TaggedResources returns every DocDB resource ARN, across all regions, that currently has at least one tag.

type ModifyDBClusterOptions

type ModifyDBClusterOptions struct {
	EngineVersion          string
	MasterUserPassword     string
	NewDBClusterIdentifier string
	VpcSecurityGroupIDs    []string
	EnableLogsTypes        []string
	DisableLogsTypes       []string
	Port                   int
}

ModifyDBClusterOptions holds optional extra parameters for ModifyDBCluster.

type ModifyDBInstanceOptions

type ModifyDBInstanceOptions struct {
	CopyTagsToSnapshot      *bool
	PromotionTier           *int
	CACertificateIdentifier string
}

ModifyDBInstanceOptions holds optional extra parameters for ModifyDBInstance.

type PendingMaintenanceAction

type PendingMaintenanceAction struct {
	Action               string
	Description          string
	OptInStatus          string
	AutoAppliedAfterDate string
	CurrentApplyDate     string
	ForcedApplyDate      string
}

PendingMaintenanceAction describes a pending maintenance action (types.PendingMaintenanceAction: Action/AutoAppliedAfterDate/ CurrentApplyDate/Description/ForcedApplyDate/OptInStatus).

type Provider

type Provider struct{}

Provider implements service.Provider for DocDB.

func (*Provider) Init

Init initializes the DocDB service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type ResourcePendingMaintenanceActions

type ResourcePendingMaintenanceActions struct {
	ResourceIdentifier string
	Actions            []PendingMaintenanceAction
}

ResourcePendingMaintenanceActions holds pending maintenance actions for a resource.

type Tag

type Tag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type TaggedEntry added in v1.2.0

type TaggedEntry struct {
	Tags map[string]string
	ARN  string
}

TaggedEntry pairs a resource ARN with its tag map, for cross-service tag enumeration by the Resource Groups Tagging API (see cli.go's wireTaggingDocDB). DocDB keeps tags in a region-nested, flat ARN-keyed map (b.tags[region]arn) covering every resource kind it supports, so this is a walk of that map across every observed region rather than one per-kind loop.

Jump to

Keyboard shortcuts

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