mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(ec2): answer DescribeTransitGatewayConnects with an empty list (#3274)
* fix(ec2): answer DescribeTransitGatewayConnects with an empty list LZA's tgw-associations-and-propagations module calls this unconditionally alongside DescribeTransitGatewayVpcAttachments. floci does not yet support creating Connect attachments, so the action was entirely unhandled and the module failed with "Operation DescribeTransitGatewayConnects is not supported", found while running LZA phase2 against parent 1176. Since floci has no Connect attachments to return, an empty list is the wire-faithful answer for every account. Requested attachment ids still validate against the shared tgw-attach- id namespace: malformed ids reuse the existing InvalidTransitGatewayAttachmentID.Malformed check, well-formed but unknown ids get InvalidTransitGatewayConnectID.NotFound. * test(ec2): cover DescribeTransitGatewayConnects over the Query protocol and make the service hook void The service method only validates the request; the handler always renders an empty transitGatewayConnectSet, so returning a List of VPC attachments suggested a resource type it never produces. It is void now. Two integration tests drive the action through the EC2 Query dispatch and pin the response wire shape (EC2 namespace, requestId, empty transitGatewayConnectSet) and the Malformed / Connect NotFound error codes.
This commit is contained in:
1 parent
c57b8ff5f6
commit
f30ba77ac0
5 files changed
+96
No files matched your search
@@ -110,6 +110,7 @@ public class Ec2QueryHandler {
|
||||
handleDescribeTransitGatewayVpcAttachments(params, region);
|
||||
case "DescribeTransitGatewayAttachments" ->
|
||||
handleDescribeTransitGatewayAttachments(params, region);
|
||||
case "DescribeTransitGatewayConnects" -> handleDescribeTransitGatewayConnects(params, region);
|
||||
case "ModifyTransitGatewayVpcAttachment" ->
|
||||
handleModifyTransitGatewayVpcAttachment(params, region);
|
||||
case "DeleteTransitGatewayVpcAttachment" ->
|
||||
@@ -2181,6 +2182,18 @@ public class Ec2QueryHandler {
|
||||
return xmlResponse(xml.build());
|
||||
}
|
||||
|
||||
/** floci does not yet support creating Connect attachments, so this is always an empty list. */
|
||||
private Response handleDescribeTransitGatewayConnects(MultivaluedMap<String, String> p, String region) {
|
||||
service.describeTransitGatewayConnects(region, getList(p, "TransitGatewayAttachmentIds"), getFilters(p));
|
||||
XmlBuilder xml = new XmlBuilder()
|
||||
.start("DescribeTransitGatewayConnectsResponse", AwsNamespaces.EC2)
|
||||
.elem("requestId", UUID.randomUUID().toString())
|
||||
.start("transitGatewayConnectSet")
|
||||
.end("transitGatewayConnectSet")
|
||||
.end("DescribeTransitGatewayConnectsResponse");
|
||||
return xmlResponse(xml.build());
|
||||
}
|
||||
|
||||
private Response handleModifyTransitGatewayVpcAttachment(MultivaluedMap<String, String> p, String region) {
|
||||
TransitGatewayVpcAttachment attachment = service.modifyTransitGatewayVpcAttachment(
|
||||
region,
|
||||
|
||||
@@ -1610,6 +1610,22 @@ public class Ec2Service implements ContainerTeardown, ResourceProvider {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* floci does not yet support creating Connect attachments, so the Query handler always
|
||||
* answers with an empty set, the same thing a real account with none would get back; this
|
||||
* only validates the request (a dedicated Connect model can replace it later). Requested ids still
|
||||
* validate the same way {@link #describeTransitGatewayVpcAttachments} validates VPC attachment
|
||||
* ids, since Connect attachments share the same {@code tgw-attach-} id namespace.
|
||||
*/
|
||||
public void describeTransitGatewayConnects(
|
||||
String region, List<String> attachmentIds, Map<String, List<String>> filters) {
|
||||
attachmentIds.forEach(Ec2Service::requireWellFormedAttachmentId);
|
||||
if (!attachmentIds.isEmpty()) {
|
||||
throw new AwsException("InvalidTransitGatewayConnectID.NotFound",
|
||||
"Transit Gateway Connect " + attachmentIds.get(0) + " was deleted or does not exist.", 400);
|
||||
}
|
||||
}
|
||||
|
||||
public TransitGatewayVpcAttachment modifyTransitGatewayVpcAttachment(
|
||||
String region, String attachmentId, List<String> addSubnetIds, List<String> removeSubnetIds,
|
||||
TransitGatewayVpcAttachmentOptions changes) {
|
||||
|
||||
Reference in new issue
Block a user