mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
feat(apigateway): derive SQS QueueUrl from path-style integration URI when absent from template (#1903)
* feat(apigateway): derive SQS QueueUrl from path-style integration URI when absent from template * fix(apigateway): derive SQS QueueUrl from the queue name
This commit is contained in:
1 parent
907a2dfbf3
commit
cfbae88fca
3 files changed
+160
-75
No files matched your search
+13
@@ -42,6 +42,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -1008,6 +1009,18 @@ public class ApiGatewayExecuteController {
|
||||
try {
|
||||
if (target.action() == null) {
|
||||
MultivaluedMap<String, String> formParams = parseFormUrlEncoded(transformedBody);
|
||||
|
||||
if ("sqs".equals(target.service()) && target.path() != null) {
|
||||
formParams.computeIfAbsent("QueueUrl", (_) -> {
|
||||
String resourcePath = target.path();
|
||||
int indexOfLastSlash = resourcePath.lastIndexOf('/');
|
||||
String queueName = indexOfLastSlash >= 0 && indexOfLastSlash < resourcePath.length() - 1
|
||||
? resourcePath.substring(indexOfLastSlash + 1) : resourcePath;
|
||||
|
||||
return Collections.singletonList(queueName);
|
||||
});
|
||||
}
|
||||
|
||||
serviceResponse = serviceRouter.invokeQuery(target.service(), formParams, region);
|
||||
} else {
|
||||
JsonNode requestJson = objectMapper.readTree(transformedBody);
|
||||
|
||||
@@ -134,7 +134,7 @@ public class AwsServiceRouter {
|
||||
}
|
||||
if (resourceSpec.startsWith("path/")) {
|
||||
// Action is supplied by the rendered request body (query protocol).
|
||||
return new IntegrationTarget(region, service, null);
|
||||
return new IntegrationTarget(region, service, null, resourceSpec.substring("path/".length()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user