mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
* feat(dms): add replication subnet group lifecycle AWS DMS was entirely absent, so every terraform-aws-data-storage example using aws_dms_replication_subnet_group failed at plan with UnknownOperationException. Adds a minimal dms service on AWS JSON 1.1 (X-Amz-Target prefix AmazonDMSv20160101.) implementing CreateReplicationSubnetGroup, DescribeReplicationSubnetGroups and DeleteReplicationSubnetGroup. Subnets are resolved against the emulated EC2 service, so the VpcId and Availability Zones a group reports are the ones its subnets actually have, and AWS's own rules are enforced: the identifier is stored lowercase, "default" is reserved, subnets must share a VPC, and a group must cover at least two Availability Zones. Tagging actions and replication instances, endpoints and tasks are out of scope and still report UnknownOperationException. * feat(dms): add resource tagging for replication subnet groups Terraform's aws_dms_replication_subnet_group reads tags back through ListTagsForResource, so without the tagging trio the resource could be created but never read cleanly. Adds ListTagsForResource, AddTagsToResource and RemoveTagsFromResource, and stores the Tags member of CreateReplicationSubnetGroup with the group. DMS does not return a subnet group ARN from describe, so the provider builds arn:aws:dms:<region>:<account>:subgrp:<id> client side; Floci parses that form back to the stored group and rejects anything else, including another account's ARN, with ResourceNotFoundFault. * fix(dms): address review findings Emit IsReadOnly on ReplicationSubnetGroup, the one member of the model's seven the response was missing. It is always false: a read-only group is one DMS manages for a zero-ETL integration, which Floci does not emulate. Fault a cross-Region ARN the way a cross-account one already faulted. Storage is keyed by the caller's Region, so honouring an eu-west-1 ARN from a us-east-1 caller silently reached the caller's own group of that name rather than the one named. Reject a subnet with no Availability Zone as InvalidSubnet. Set.copyOf rejects nulls, so such a subnet raised a NullPointerException and surfaced as a 500 instead of a client error. Adds the user-realistic minimum-AZ case: two subnets sharing one AZ, which the previous tests did not cover because they passed one subnet. * fix(dms): reject wrongly-typed tag, filter and arn-list members A present member of the wrong JSON type was coerced rather than rejected. asText() on an object yields the empty string, so a tag whose Value was an object stored an empty value and reported success; a Filters or ResourceArnList member that was not a list was ignored outright, which turned a filtered describe into an unfiltered one. Every string member now answers SerializationException when it is present with another JSON type, matching what AWS returns when a json-1.1 member will not deserialize, and matching how Kinesis, Cognito and KMS already report the same class of error here. An absent member stays a parameter error: missing and mistyped are different faults. * fix(dms): paginate DescribeReplicationSubnetGroups and validate the description DescribeReplicationSubnetGroups returned every matching group in one response and ignored both MaxRecords and Marker, so an SDK or Terraform paginator diverged from a live account as soon as more than one page of groups existed. Page through the shared opaque-cursor helper, keyed on the group identifier, so a Marker stays resumable across groups created or deleted between requests. MaxRecords defaults to 100 and is rejected outside the documented 20 to 100 range rather than clamped, with the InvalidParameterValueException a live account answers. Marker is emitted only while a further page remains: an SDK paginator treats any Marker as "ask again", so one on the final page loops forever. ReplicationSubnetGroupDescription now also enforces the model's printable-character constraint, so a value carrying a control character such as 0x01 is rejected instead of persisted. * docs(dms): describe the Marker as the opaque cursor it is * fix(test): DmsTest must compile at the sdk-test-java module's Java 17 target List.getFirst() is a Java 21 SequencedCollection method. The main project compiles at 21, but compatibility-tests/sdk-test-java pins source/target 17, and DmsTest was the only file in that module using getFirst() -- so the native arm64 sdk-test-java image failed to build and every test in it was skipped. This was not caught earlier because the previous head of this PR had no CI rollup at all; the merge that made the branch mergeable is what first ran the job. Replaced with get(0), which is what the rest of the module uses. * style(test): import Objects and Collectors instead of naming them inline AGENTS.md asks for imports rather than inline fully-qualified names. DmsServiceTest had two: java.util.Objects::nonNull and java.util.stream.Collectors.toMap. Neither was imported; both now are.
4.9 KiB
4.9 KiB
AWS Database Migration Service (DMS)
Protocol: AWS JSON 1.1
Signing name: dms
Floci emulates the replication subnet group lifecycle, which is what
aws_dms_replication_subnet_group needs to plan and apply. Subnets are resolved against
the emulated EC2 service, so the VPC and Availability Zones a group reports are the ones
those subnets actually have.
Supported Actions
| Action | Description |
|---|---|
CreateReplicationSubnetGroup |
Creates a replication subnet group from existing EC2 subnets. |
DescribeReplicationSubnetGroups |
Lists replication subnet groups, optionally filtered by identifier. |
DeleteReplicationSubnetGroup |
Deletes the specified replication subnet group. |
ListTagsForResource |
Lists the tags on one or more DMS resource ARNs. |
AddTagsToResource |
Merges tags into the resource, overwriting by key. |
RemoveTagsFromResource |
Removes the named tag keys from the resource. |
Behaviour
- The identifier is stored as a lowercase string, as AWS does, so a group created as
MyGroupis described and deleted asmygroup. ReplicationSubnetGroupIdentifiermust not bedefaultand is limited to 255 alphanumeric characters, periods, underscores, or hyphens.- A group must cover at least two Availability Zones. Fewer returns
ReplicationSubnetGroupDoesNotCoverEnoughAZs, as AWS does. - Subnets must exist and must all belong to one VPC. Otherwise
InvalidSubnet. SubnetGroupStatusis immediatelyComplete, every subnet reportsActive,SupportedNetworkTypesis["IPV4"], andIsReadOnlyis alwaysfalse: a read-only group is one DMS manages for a zero-ETL integration, which Floci does not emulate.DescribeReplicationSubnetGroupssupports thereplication-subnet-group-idfilter. A filter naming a group that does not exist returnsResourceNotFoundFault, which is how Terraform detects a group deleted outside its state.DescribeReplicationSubnetGroupspaginates onMaxRecordsandMarker.MaxRecordsdefaults to 100 and must be between 20 and 100; a value outside that range is rejected withInvalidParameterValueExceptionrather than clamped, as AWS does. Results are ordered by identifier andMarkeris an opaque cursor that resumes after the last item of the page, so a page stays resumable across groups created or deleted between requests.Markeris returned only when a further page exists, never on the last one.ReplicationSubnetGroupDescriptionis required, must not be blank, and must contain only printable characters. A control character such as0x01returnsInvalidParameterValueException.- A member of the wrong JSON type returns
SerializationException, as AWS does, rather than being coerced. That covers aTagsentry whoseValueis an object, a filter whoseValuesis not a list, a non-string element inResourceArnList,SubnetIdsorTagKeys, and a non-string identifier. An absent member is still a parameter error, not a serialization one. - Groups are scoped per account and Region and persist through
StorageFactory.
Tagging
Tags on CreateReplicationSubnetGroup are stored with the group, and the tagging trio
works against the group's ARN, which is
arn:aws:dms:<region>:<account>:subgrp:<identifier>. DMS does not return that ARN from
DescribeReplicationSubnetGroups, so Terraform builds it client side and Floci parses it
back the same way.
AddTagsToResourcemerges by key, so re-tagging an existing key overwrites its value.RemoveTagsFromResourceremoves the named keys and ignores keys that are not present.ListTagsForResourceaccepts eitherResourceArnorResourceArnList. Each returned tag carries itsResourceArnonly for theResourceArnListform, which is the form AWS documents it on.- Tag keys are 1 to 128 characters, values at most 256, and neither may start with
aws:ordms:. - An ARN that is unparseable, names a different DMS resource type, names another account
or Region, or names a group that does not exist returns
ResourceNotFoundFault. Tagging is not a cross-account or cross-Region operation on AWS and is not one here either. - Deleting a group deletes its tags with it.
Limitations
- Only the subnet group lifecycle is implemented. Replication instances, endpoints,
and replication tasks return
UnknownOperationException. - Tagging covers replication subnet groups only. The tagging trio is implemented, but
a
ResourceArnnaming a replication instance, endpoint, or task returnsResourceNotFoundFaultbecause Floci holds no such resource. - No
ModifyReplicationSubnetGroup. A subnet change has to be a delete and recreate.
See the AWS DMS API Reference.
Configuration
| Variable | Default | Description |
|---|---|---|
FLOCI_SERVICES_DMS_ENABLED |
true |
Enable or disable DMS |