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 Answer
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>
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions