How to make requests to "@connections" in java sdk2

0

Hi, How can I make requests to "@connections" endpoints in API GW: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html

I don't see any related methods in "ApiGatewayClient".

If it's not possible then what is the easiest solution to send HTTP requests to these endpoints? Looks like manually signing each request isn't an easy thing. Maybe there's AWS HTTP client which can do it for the given URL and using provided credentials?

Thanks.

1 Antwort
1

I should use another client:

       try (val apiGateway = ApiGatewayManagementApiClient.builder()
                .region(Region.US_EAST_1)
                .endpointOverride(new URI("https://xxxx.execute-api.us-xxxx.amazonaws.com/xxxx"))
                .credentialsProvider(StaticCredentialsProvider.create(
                        AwsBasicCredentials.create("xxx", "xxxxx")
                )).build()) {
            return apiGateway.getConnection(GetConnectionRequest.builder().connectionId(connId).build()).toString();
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }

it's located in:

<dependency>
    <groupId>software.amazon.awssdk</groupId>
    <artifactId>apigatewaymanagementapi</artifactId>
</dependency>
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen