Skip to content

Default endpointDiscovery to true for services that require it #1845

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

Merged
merged 1 commit into from
May 18, 2020

Conversation

bmaizels
Copy link
Contributor

  1. Services that have at least one operation that requires endpoint discovery will have their client builders default endpoint discovery to true.
  2. The method 'enableEndpointDiscovery()' has been deprecated in client builders that support endpoint discovery.
  3. The method 'endpointDiscoveryEnabled(boolean)' has been added to client builders that support endpoint discovery.

This behavior should now match the v1 SDK.

License

  • I confirm that this pull request can be released under the Apache 2 license

@bmaizels bmaizels requested a review from millems May 15, 2020 21:34
Comment on lines 113 to 119
if (o.isEndpointOperation()) {
endpointOperation = o;
break;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just use the last endpoint operation? Is that the right behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll admit this is not how I would have written it if I had done it myself, but it is actually a copy/paste from the v1 SDK. The logic is correct because it only needs to know there is at least one endpoint operation (and the last one suffices for that purpose), and the flag as to whether an endpoint is required is cumulative (once it gets set it doesn't get unset) so ends up effectively meaning 'at least one endpoint is required'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a couple of tests to assert this logic was working correctly as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we clarify it a bit and make it a boolean or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing it will require more refactoring than the change is worth in my opinion. At least it's in sync with v1 in this state. I'll add comments to explain what it's doing.

}

if (o.getEndpointDiscovery() != null && o.getEndpointDiscovery().isRequired()) {
endpointCacheRequired = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the "new" behavior is: if any operation requires endpoint discovery, enable it by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. I also stated that in the PR description.

.addStatement("return this")
.build();
}

private MethodSpec enableEndpointDiscovery() {
return MethodSpec.methodBuilder("enableEndpointDiscovery")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecate here as well? Can we also remove it for new services?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will deprecate here as well. Do you have a strategy for removing it for new services? How do we identify 'new services'? One strategy is just to say 'service != DDB' which seems yuck.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also add a customization: "enableEndpointDiscoveryMethodRequired" and just enable it for DynamoDB.

@bmaizels bmaizels force-pushed the bmaizels/enable-default-endpoint-discovery branch from 71f07e1 to 379e27c Compare May 18, 2020 18:41
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

27.3% 27.3% Coverage
24.1% 24.1% Duplication

@bmaizels bmaizels merged commit c956d3e into master May 18, 2020
@bmaizels bmaizels deleted the bmaizels/enable-default-endpoint-discovery branch May 18, 2020 19:21
aws-sdk-java-automation added a commit that referenced this pull request Nov 19, 2021
…babf0fa5a

Pull request: release <- staging/3ce68cf4-4558-4ffd-a788-6f4babf0fa5a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants