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 Risposta
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>
con risposta 2 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande