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 Respuesta
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>
respondido hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas