Skip to content

Commit

Permalink
add back previous fallback behavior to custom v1 resolvers
Browse files Browse the repository at this point in the history
  • Loading branch information
isaiahvita committed Jul 24, 2023
1 parent e06caa6 commit e0b81a4
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ public class AddAwsConfigFields implements GoIntegration {
.documentation("API stack mutators")
.generatedOnClient(false)
.build(),
AwsConfigField.builder()
.name(ENDPOINT_RESOLVER_CONFIG_NAME)
.type(getAwsCoreSymbol("EndpointResolver"))
.generatedOnClient(false)
.awsResolveFunction(SymbolUtils.createValueSymbolBuilder(RESOLVE_AWS_CONFIG_ENDPOINT_RESOLVER)
.build())
.build(),
AwsConfigField.builder()
.name(LOGGER_CONFIG_NAME)
.type(getAwsCoreSymbol("Logger"))
Expand Down Expand Up @@ -255,6 +262,7 @@ private void writeAwsDefaultResolvers(GoWriter writer) {
writeHttpClientResolver(writer);
writeRetryerResolvers(writer);
writeRetryMaxAttemptsFinalizeResolver(writer);
writeAwsConfigEndpointResolver(writer);
}

private void writerAwsDefaultResolversTests(GoWriter writer) {
Expand Down Expand Up @@ -573,6 +581,25 @@ private void writeHttpClientResolver(GoWriter writer) {
writer.popState();
}

private void writeAwsConfigEndpointResolver(GoWriter writer) {
writer.pushState();
writer.putContext("resolverName", RESOLVE_AWS_CONFIG_ENDPOINT_RESOLVER);
writer.putContext("clientOption", ENDPOINT_RESOLVER_CONFIG_NAME);
writer.putContext("wrapperHelper", EndpointGenerator.AWS_ENDPOINT_RESOLVER_HELPER);
writer.putContext("awsResolver", ENDPOINT_RESOLVER_CONFIG_NAME);
writer.putContext("awsResolverWithOptions", AWS_ENDPOINT_RESOLVER_WITH_OPTIONS);
writer.putContext("newResolver", EndpointGenerator.RESOLVER_CONSTRUCTOR_NAME);
writer.write("""
func $resolverName:L(cfg aws.Config, o *Options) {
if cfg.$awsResolver:L == nil && cfg.$awsResolverWithOptions:L == nil {
return
}
o.$clientOption:L = $wrapperHelper:L(cfg.$awsResolver:L, cfg.$awsResolverWithOptions:L, $newResolver:L())
}
""");
writer.popState();
}

@Override
public List<RuntimeClientPlugin> getClientPlugins() {
List<RuntimeClientPlugin> plugins = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,6 @@ private void generatePublicResolverTypes(GoWriter writer) {
writer.write("return fn(region, options)");
});


// Generate EndpointResolverFromURL helper
writer.writeDocs(String.format("%s returns an EndpointResolver configured using the provided endpoint url. "
+ "By default, the resolved endpoint resolver uses the client region as signing region, and "
Expand Down
8 changes: 8 additions & 0 deletions service/s3/api_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions service/s3control/api_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions service/s3outposts/api_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e0b81a4

Please sign in to comment.