diff --git a/pom.xml b/pom.xml index 24c478c34..f2fbec64c 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ software.amazon.awssdk bom - 2.17.81 + 2.20.138 pom import @@ -73,13 +73,13 @@ com.aws.greengrass nucleus - 2.6.0-SNAPSHOT + 2.13.0-SNAPSHOT provided com.aws.greengrass nucleus - 2.6.0-SNAPSHOT + 2.13.0-SNAPSHOT test-jar test diff --git a/src/main/java/com/aws/greengrass/clientdevices/auth/iot/GreengrassV2DataClientFactory.java b/src/main/java/com/aws/greengrass/clientdevices/auth/iot/GreengrassV2DataClientFactory.java index 42d57bf64..ceb3b4c33 100644 --- a/src/main/java/com/aws/greengrass/clientdevices/auth/iot/GreengrassV2DataClientFactory.java +++ b/src/main/java/com/aws/greengrass/clientdevices/auth/iot/GreengrassV2DataClientFactory.java @@ -13,12 +13,16 @@ import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider; import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration; import software.amazon.awssdk.core.retry.RetryPolicy; +import software.amazon.awssdk.endpoints.Endpoint; import software.amazon.awssdk.http.apache.ApacheHttpClient; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.greengrassv2data.GreengrassV2DataClient; import software.amazon.awssdk.services.greengrassv2data.GreengrassV2DataClientBuilder; +import software.amazon.awssdk.services.greengrassv2data.endpoints.GreengrassV2DataEndpointParams; +import software.amazon.awssdk.services.greengrassv2data.endpoints.GreengrassV2DataEndpointProvider; import java.net.URI; +import java.util.concurrent.CompletableFuture; import javax.inject.Inject; /** @@ -51,14 +55,23 @@ public GreengrassV2DataClient getClient() throws DeviceConfigurationException { String ggServiceEndpoint = ClientConfigurationUtils.getGreengrassServiceEndpoint(deviceConfiguration); ApacheHttpClient.Builder httpClient = ClientConfigurationUtils.getConfiguredClientBuilder(deviceConfiguration); + GreengrassV2DataEndpointProvider endpointProvider = new GreengrassV2DataEndpointProvider() { + @Override + public CompletableFuture resolveEndpoint(GreengrassV2DataEndpointParams endpointParams) { + return CompletableFuture.supplyAsync(() -> Endpoint.builder() + .url(URI.create(ggServiceEndpoint)) + .build()); + } + }; + GreengrassV2DataClientBuilder clientBuilder = GreengrassV2DataClient.builder().credentialsProvider(AnonymousCredentialsProvider.create()) + .endpointProvider(endpointProvider) .httpClientBuilder(httpClient.useIdleConnectionReaper(false)) .overrideConfiguration(ClientOverrideConfiguration.builder() .retryPolicy(RetryPolicy.none()).build()); clientBuilder.region(Region.of(awsRegion)); - clientBuilder.endpointOverride(URI.create(ggServiceEndpoint)); return clientBuilder.build(); }