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개 답변
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>
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠