Skip to content
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

Support HostPrefix in E2.0, enable E2.0 for all services #3564

Merged
merged 3 commits into from Dec 2, 2022

Conversation

dagnir
Copy link
Contributor

@dagnir dagnir commented Nov 23, 2022

Motivation and Context

This changes fixes the previously incorrect handling of hostPrefix in services, causing requests for some services to have the wrong URL. This change also undoes the suppression of rules-based endpoint generation for all services apart from EventBridge, S3, and S3 Control, which was implemented in #3520 because of the previously mentioned hostPrefix issue.

Modifications

  • Remove useRuleBasedEndpoints customization, enabling rules based endpoints for all services again.
  • Update endpoint interceptors to correctly resolve and add the hostPrefix if necessary
  • Update generated client tests to support hostPrefix

Testing

  • New unit tests
  • Client endpoint tests updated to correctly handle cases where the client adds a hostPrefix to the requests. i.e. if the operation being called has a hostPrefix, the expected URL is updated to also include that hostPrefix.
  • Manual verification of some services that use hostPrefix such as location and evidently.
  • Running Integ tests

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

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

@dagnir dagnir force-pushed the dongie/e2-hostprefix branch 3 times, most recently from b0a4a97 to be3658b Compare November 29, 2022 23:30
@dagnir dagnir marked this pull request as ready for review November 29, 2022 23:35
@dagnir dagnir requested a review from a team as a code owner November 29, 2022 23:35
@dagnir
Copy link
Contributor Author

dagnir commented Nov 29, 2022

Here's an example generated client test from the location service, where the expected URL is updated so that in includes the geofencing. HostPrefix required for CreateGeofenceCollection.

new SyncTestCase("For region eu-central-1 with FIPS enabled and DualStack enabled", () -> {
                    LocationClientBuilder builder = LocationClient.builder();
                    builder.credentialsProvider(BaseRuleSetClientTest.CREDENTIALS_PROVIDER);
                    builder.httpClient(getSyncHttpClient());
                    builder.fipsEnabled(true);
                    builder.region(Region.of("eu-central-1"));
                    builder.dualstackEnabled(true);
                    CreateGeofenceCollectionRequest request = CreateGeofenceCollectionRequest.builder().build();
                    builder.build().createGeofenceCollection(request);
                }, 
                Expect.builder()
                        .endpoint(Endpoint.builder().url(URI.create("https://geofencing.geo-fips.eu-central-1.api.aws")).build())
                        .build()),
  • Operation definition:
    "CreateGeofenceCollection":{
    "name":"CreateGeofenceCollection",
    "http":{
    "method":"POST",
    "requestUri":"/geofencing/v0/collections",
    "responseCode":200
    },
    "input":{"shape":"CreateGeofenceCollectionRequest"},
    "output":{"shape":"CreateGeofenceCollectionResponse"},
    "errors":[
    {"shape":"InternalServerException"},
    {"shape":"ConflictException"},
    {"shape":"AccessDeniedException"},
    {"shape":"ValidationException"},
    {"shape":"ThrottlingException"}
    ],
    "documentation":"<p>Creates a geofence collection, which manages and stores geofences.</p>",
    "endpoint":{"hostPrefix":"geofencing."},
    "idempotent":true
    },
  • Compare to the definition of the test in endpoint-tests.json that does not include the prefix in the expected URL (because it does not know about CreateGeofenceCollectionRequest and its hostPrefix):
    {
    "documentation": "For region eu-central-1 with FIPS enabled and DualStack enabled",
    "expect": {
    "endpoint": {
    "url": "https://geo-fips.eu-central-1.api.aws"
    }
    },
    "params": {
    "UseFIPS": true,
    "Region": "eu-central-1",
    "UseDualStack": true
    }
    },

This changes fixes the previously incorrect handling of `hostPrefix` in
services, causing requests for some services to have the wrong URL. This change
also undoes the suppression of rules-based endpoint generation for all services
apart from EventBridge, S3, and S3 Control, which was implemented in #3520
because of the previously mentioned `hostPrefix` issue.
@dagnir dagnir enabled auto-merge (squash) December 1, 2022 23:02
@dagnir dagnir merged commit 99b9d3f into master Dec 2, 2022
@sonarcloud
Copy link

sonarcloud bot commented Dec 2, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 15 Code Smells

56.7% 56.7% Coverage
0.0% 0.0% Duplication

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.

None yet

3 participants