Files
floci/docs/services/redshift-serverless.md
T
Allen Sanborn 4b3923712a feat(redshiftserverless): add namespace lifecycle and tagging (#3631)
* feat(redshiftserverless): add namespace lifecycle

Amazon Redshift Serverless was absent entirely: every call returned
UnknownOperationException, so Terraform's aws_redshiftserverless_namespace
could not be planned or applied against Floci.

Add a JSON 1.1 service under the RedshiftServerless. target prefix with
CreateNamespace, GetNamespace, ListNamespaces, UpdateNamespace, and
DeleteNamespace. Namespaces are account and Region scoped and stored through
StorageFactory. AWS defaults are applied on create (dbName dev, kmsKeyId
AWS_OWNED_KMS_KEY, empty logExports, status AVAILABLE), adminUserPassword is
accepted and never returned, DeleteNamespace returns the removed namespace
with status DELETING, and UpdateNamespace applies only the supplied fields.

Workgroups, snapshots, and the tagging operations remain unemulated.

* feat(redshiftserverless): add namespace tagging operations

Terraform's aws_redshiftserverless_namespace calls ListTagsForResource on
every read once tags are involved, so the namespace lifecycle alone left the
resource broken as soon as a config set tags.

Add ListTagsForResource, TagResource, and UntagResource. Lookup is by
resourceArn rather than namespace name, scoped to the caller's Region, since
that is how AWS keys these operations; the namespace is currently the only
taggable Redshift Serverless resource, so any other ARN is reported absent.
TagResource merges into the existing tags, UntagResource removes by key, and
tags passed to CreateNamespace are readable back and survive UpdateNamespace.

* fix(redshiftserverless): emit creationDate as ISO-8601 per the API model

The awsJson1.1 default is epoch seconds and 133 call sites use it, but this
model overrides it: TimestampFormatTrait ISO_8601 on creationDate (and on all
eleven other timestamp members in the package, audited). Strict clients broke
on the number: Terraform's Go SDK failed to decode and orphaned the created
namespace outside state; the Java SDK failed to unmarshall. Only botocore's
lenient parsing let CLI checks pass. Emitted via the repo's millisecond-ISO
idiom; format pinned by regex in the integration test and by a new
handler-level unit test class covering the wire layer that had none
(timestamp shape, nextToken emission, maxResults type guard). Checklist note
added to AGENTS.md + CONTRIBUTING.md so the next service checks the trait
before reaching for the epoch idiom.

* docs(redshiftserverless): the ISO-8601 rule is per member, not model-wide

Review follow-up: the earlier claim that every timestamp member in this model
carries TimestampFormatTrait(ISO_8601) is wrong — 15 of the model's 30 INSTANT
members carry no trait and fall back to the awsJson1.1 epoch default. The
shipped code is unaffected (creationDate, the only timestamp emitted, is
genuinely ISO_8601), but the claim was load-bearing guidance: whoever adds
snapshots or scheduled actions next would have applied ISO-8601 to trait-free
members and reintroduced the bug in the opposite direction. Narrowed in all
four places it appeared.

* fix(redshiftserverless): validate collection types, copy-on-update; drop em dashes

A present iamRoles, logExports, tags or tagKeys member that was not a JSON
array parsed to null and was then indistinguishable from an omitted member,
so a malformed UpdateNamespace silently kept the stored value and returned
200 instead of reporting the request as invalid. Only a missing or null
member now means "omitted"; a present member of the wrong type, or a
collection holding a non-string element, is a ValidationException naming the
member.

updateNamespace mutated the stored Namespace in place while GetNamespace and
ListNamespaces read without taking the same monitor, so a concurrent reader
could observe a torn object with some fields updated and some not. Build the
new state on a copy and store that instead, which also makes the write-back
explicit. The same in-place mutation was present in tagResource,
untagResource and deleteNamespace, so all four now copy. Merge semantics are
unchanged.

Replace the em dashes in the timestamp guidance with commas and periods, per
the repository ban.

* fix(redshiftserverless): reject Redshift reserved words as namespace names

CreateNamespace rejects a namespace name that is an Amazon Redshift SQL
reserved word, so names like select or user passed the length and
[a-z0-9-] checks here and were persisted. Add the documented reserved
word list to the shared namespace-name validator, which create, get,
update and delete all reach, so the rejection is consistent.
2026-09-23 10:13:24 -04:00

4.5 KiB

Redshift Serverless

Protocol: JSON 1.1 Endpoint: POST http://localhost:4566/ with X-Amz-Target: RedshiftServerless.<Operation> and Content-Type: application/x-amz-json-1.1

Floci emulates the namespace lifecycle of Amazon Redshift Serverless: the account and Region scoped container that holds a serverless database, its admin credentials, and its IAM roles. This is the surface Terraform's aws_redshiftserverless_namespace drives.

For the upstream API shape, see the Amazon Redshift Serverless API Reference.

Supported Actions

Action Description
CreateNamespace Create a namespace, applying AWS defaults for dbName, kmsKeyId, and logExports
GetNamespace Return a namespace by name
ListNamespaces Page through the namespaces in the account and Region
UpdateNamespace Apply the supplied fields to an existing namespace and return it
DeleteNamespace Remove a namespace and return it with status DELETING
ListTagsForResource Return the tags on the namespace named by resourceArn
TagResource Merge tags into the namespace named by resourceArn
UntagResource Remove tags by key from the namespace named by resourceArn

Namespace state is account and Region scoped and persisted through StorageFactory.

Compatibility Notes

  • Namespaces only. Workgroups, snapshots, recovery points, usage limits, and endpoint access are not emulated. A namespace has no compute attached and no endpoint to connect to, so the Redshift Data API still rejects WorkgroupName.
  • adminUserPassword is accepted and never returned, matching AWS. No secret is created for manageAdminPassword.
  • Defaults follow AWS. dbName defaults to dev, kmsKeyId to AWS_OWNED_KMS_KEY, logExports to an empty list, and status to AVAILABLE immediately: there is no MODIFYING or CREATING phase to poll through.
  • creationDate is an ISO-8601 string, for example 2026-09-11T18:12:55.433Z, not the epoch-seconds number that awsJson1.1 uses by default. Namespace.creationDate carries TimestampFormatTrait(ISO_8601) in the API model, and strict SDKs reject a number here even though the AWS CLI accepts one. (Not a model-wide rule: roughly half the model's timestamp members carry no format trait and use the epoch default, so check each member when extending this service.)
  • namespaceId is a generated UUID and namespaceArn is arn:aws:redshift-serverless:<region>:<account>:namespace/<namespaceId>.
  • DeleteNamespace returns the deleted namespace with status DELETING and removes it in the same call, so the next GetNamespace returns ResourceNotFoundException.
  • UpdateNamespace applies only the fields present in the request. An omitted field keeps its stored value; an explicitly empty iamRoles or logExports array clears it.
  • Tagging is keyed by resourceArn, not by namespace name, and the namespace is the only taggable Redshift Serverless resource in Floci. TagResource merges into the existing tags rather than replacing them, UntagResource removes by key, and any ARN that does not name a known namespace in the caller's Region returns ResourceNotFoundException. Tags supplied to CreateNamespace are readable through ListTagsForResource and survive an UpdateNamespace.

AWS-compatible failures

Namespace names, database names, and log export values are validated. Floci returns ValidationException for a malformed request, ConflictException when the namespace name is already taken, and ResourceNotFoundException for an unknown namespace.

AWS also models AccessDeniedException, InternalServerException, and ThrottlingException. Floci does not inject provider-side failures that cannot be derived from the request or emulator state.

Configuration

Variable Default Description
FLOCI_SERVICES_REDSHIFT_SERVERLESS_ENABLED true Enable or disable Redshift Serverless

Example

export AWS_ENDPOINT_URL=http://localhost:4566

aws redshift-serverless create-namespace \
  --namespace-name analytics \
  --admin-username admin \
  --admin-user-password Secret123! \
  --db-name dev

aws redshift-serverless get-namespace --namespace-name analytics
aws redshift-serverless list-namespaces
aws redshift-serverless update-namespace --namespace-name analytics --log-exports userlog
aws redshift-serverless delete-namespace --namespace-name analytics