Skip to content

Enable endpoint discovery by default for services that support it #1840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/next-release/feature-AWSSDKforJavav2-534a8f5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "feature",
"category": "AWS SDK for Java v2",
"description": "Endpoint discovery is now enabled by default for services that support it (as of writing only Amazon DynamoDB). A new method 'endpointDiscoveryEnabled' has been added to client builders that support endpoint discovery allowing a true or false value to be set. 'enableEndpointDiscovery' has been deprecated on the client builders as it is now superseded by 'endpointDiscoveryEnabled'."
}
2 changes: 1 addition & 1 deletion archetypes/archetype-lambda/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>archetypes</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>archetype-lambda</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion archetypes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>aws-sdk-java-pom</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>archetypes</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion aws-sdk-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>aws-sdk-java</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bom-internal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>aws-sdk-java-pom</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>bom</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<artifactId>bundle</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion codegen-lite-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>codegen-lite-maven-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion codegen-lite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<artifactId>codegen-lite</artifactId>
<name>AWS Java SDK :: Code Generator Lite</name>
Expand Down
2 changes: 1 addition & 1 deletion codegen-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>codegen-maven-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion codegen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<artifactId>codegen</artifactId>
<name>AWS Java SDK :: Code Generator</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,24 @@ public TypeSpec poetSpec() {
.addJavadoc("Internal implementation of {@link $T}.", builderInterfaceName);

if (model.getEndpointOperation().isPresent()) {
builder.addMethod(enableEndpointDiscovery());
builder.addMethod(endpointDiscoveryEnabled())
.addMethod(enableEndpointDiscovery());
}

return builder.addMethod(buildClientMethod()).build();
}

private MethodSpec endpointDiscoveryEnabled() {
return MethodSpec.methodBuilder("endpointDiscoveryEnabled")
.addAnnotation(Override.class)
.addModifiers(Modifier.PUBLIC)
.returns(builderClassName)
.addParameter(boolean.class, "endpointDiscoveryEnabled")
.addStatement("this.endpointDiscoveryEnabled = endpointDiscoveryEnabled")
.addStatement("return this")
.build();
}

private MethodSpec enableEndpointDiscovery() {
return MethodSpec.methodBuilder("enableEndpointDiscovery")
.addAnnotation(Override.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
import software.amazon.awssdk.utils.StringUtils;

public class BaseClientBuilderClass implements ClassSpec {
// This only applies to services that support endpoint discovery
private static final String ENDPOINT_DISCOVERY_ENABLED_BY_DEFAULT = "true";

private final IntermediateModel model;
private final ClassName builderInterfaceName;
private final ClassName builderClassName;
Expand Down Expand Up @@ -81,7 +84,7 @@ public TypeSpec poetSpec() {
if (model.getEndpointOperation().isPresent()) {
builder.addField(FieldSpec.builder(boolean.class, "endpointDiscoveryEnabled")
.addModifiers(PROTECTED)
.initializer("false")
.initializer(ENDPOINT_DISCOVERY_ENABLED_BY_DEFAULT)
.build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public TypeSpec poetSpec() {

if (model.getEndpointOperation().isPresent()) {
builder.addMethod(enableEndpointDiscovery());
builder.addMethod(endpointDiscovery());
}

if (model.getCustomizationConfig().getServiceSpecificClientConfigClass() != null) {
Expand All @@ -72,6 +73,16 @@ private MethodSpec enableEndpointDiscovery() {
return MethodSpec.methodBuilder("enableEndpointDiscovery")
.addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
.returns(TypeVariableName.get("B"))
.addAnnotation(Deprecated.class)
.addJavadoc("@deprecated Use {@link #endpointDiscoveryEnabled($T)} instead.", boolean.class)
.build();
}

private MethodSpec endpointDiscovery() {
return MethodSpec.methodBuilder("endpointDiscoveryEnabled")
.addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
.returns(TypeVariableName.get("B"))
.addParameter(boolean.class, "endpointDiscovery")
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,24 @@ public TypeSpec poetSpec() {
.addJavadoc("Internal implementation of {@link $T}.", builderInterfaceName);

if (model.getEndpointOperation().isPresent()) {
builder.addMethod(enableEndpointDiscovery());
builder.addMethod(endpointDiscoveryEnabled())
.addMethod(enableEndpointDiscovery());
}

return builder.addMethod(buildClientMethod()).build();
}

private MethodSpec endpointDiscoveryEnabled() {
return MethodSpec.methodBuilder("endpointDiscoveryEnabled")
.addAnnotation(Override.class)
.addModifiers(Modifier.PUBLIC)
.returns(builderClassName)
.addParameter(boolean.class, "endpointDiscoveryEnabled")
.addStatement("this.endpointDiscoveryEnabled = endpointDiscoveryEnabled")
.addStatement("return this")
.build();
}

private MethodSpec enableEndpointDiscovery() {
return MethodSpec.methodBuilder("enableEndpointDiscovery")
.addAnnotation(Override.class)
Expand Down
2 changes: 1 addition & 1 deletion core/annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>core</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion core/arns/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>core</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion core/auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>core</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>

<artifactId>auth</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/aws-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>core</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>

<artifactId>aws-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>aws-sdk-java-pom</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>

<artifactId>core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/profiles/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>core</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>

<artifactId>profiles</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/protocols/aws-cbor-protocol/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>protocols</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion core/protocols/aws-ion-protocol/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>protocols</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion core/protocols/aws-json-protocol/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>protocols</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion core/protocols/aws-query-protocol/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>protocols</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion core/protocols/aws-xml-protocol/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>protocols</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion core/protocols/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>core</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion core/protocols/protocol-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>protocols</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion core/regions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>core</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>

<artifactId>regions</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/sdk-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>core</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<artifactId>sdk-core</artifactId>
<name>AWS Java SDK :: SDK Core</name>
Expand Down
2 changes: 1 addition & 1 deletion http-client-spi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>aws-sdk-java-pom</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<artifactId>http-client-spi</artifactId>
<name>AWS Java SDK :: HTTP Client Interface</name>
Expand Down
2 changes: 1 addition & 1 deletion http-clients/apache-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>http-clients</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>

<artifactId>apache-client</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion http-clients/netty-nio-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>http-clients</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion http-clients/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>aws-sdk-java-pom</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion http-clients/url-connection-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>http-clients</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>AWS Java SDK :: Parent</name>
<description>The Amazon Web Services SDK for Java provides Java APIs
Expand Down
2 changes: 1 addition & 1 deletion release-scripts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>release-scripts</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion services-custom/dynamodb-enhanced/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>services-custom</artifactId>
<version>2.13.18-SNAPSHOT</version>
<version>2.14.0-SNAPSHOT</version>
</parent>
<artifactId>dynamodb-enhanced</artifactId>
<version>${awsjavasdk.version}</version>
Expand Down
Loading