mirror of
https://github.com/floci-io/floci.git
synced 2026-11-29 08:31:53 -05:00
feat(redshift-serverless): validate requests against the AWS model constraints (#5641)
* feat(redshift-serverless): validate requests against the AWS model constraints Generate the input constraints (required members, length, pattern, enum, number range, list size) from botocore's Redshift Serverless model with tools/aws/regen_redshift_serverless_shapes.py and vendor them under src/main/resources/aws, like the DynamoDB request shapes. A new RedshiftServerlessRequestShapes check runs before dispatch and answers a ValidationException. Pagination members are left to the services, which keep reporting InvalidPaginationException. Move the request parsing and error helpers that the JSON handler, the usage limit service and the service each carried a copy of into ServerlessSupport, so the resource families that follow share one implementation. * fix(redshift-serverless): address review findings on request validation - Match a model pattern against the whole value, so an unanchored pattern such as the account id no longer accepts a value that merely contains a match. - Count string lengths in Unicode code points, so a tag of 200 supplementary characters is not rejected for exceeding 256 UTF-16 units. - Validate only the actions the handler implements, so a modeled but unsupported action keeps answering UnknownOperationException. - Read every string member through ServerlessSupport.text and reject a tag key or value that is not a string, so a numeric nextToken or tag member is a ValidationException instead of being treated as absent or coerced. - Regenerate the vendored shapes from botocore 1.43.113, the version tools/aws/requirements.txt pins. - Cover the rejected-request case with a state check, and add the pattern, code point, page token and tag regressions. * refactor(redshift-serverless): use VendoredResources, ServerlessSupport.notFound and update docs
This commit is contained in:
1 parent
340e727ede
commit
77384dc3de
12 files changed
+2040
-277
No files matched your search
@@ -69,7 +69,7 @@ Namespace and workgroup state is account and Region scoped and persisted through
|
||||
|
||||
## AWS-compatible failures
|
||||
|
||||
Namespace and workgroup names, database names, log export values, ports and workgroup enum members are validated. Floci returns `ValidationException` for a malformed request, `ConflictException` when a namespace or workgroup name is already taken, when a namespace already has a workgroup, or when a namespace being deleted still has one, and `ResourceNotFoundException` for an unknown namespace or workgroup.
|
||||
Every request is checked against the AWS model constraints before dispatch: required members, string lengths and patterns (including resource names and tag keys and values), list sizes (including subnets, security groups, and tag lists), number ranges, and enum values. Floci returns `ValidationException` for a malformed request or one breaking these model constraints, `ConflictException` when a namespace or workgroup name is already taken, when a namespace already has a workgroup, or when a namespace being deleted still has one, and `ResourceNotFoundException` for an unknown namespace or workgroup.
|
||||
|
||||
AWS also models `AccessDeniedException`, `InternalServerException`, and `ThrottlingException`. Floci does not inject provider-side failures that cannot be derived from the request or emulator state.
|
||||
|
||||
|
||||
Reference in new issue
Block a user