Skip to content
Merged
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
2 changes: 1 addition & 1 deletion SMITHY_GO_CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c53a167c47ab83db2c802885eec2902afeebd4b4
b64db94c52a12377b42bb0a2295f964f7ea0b1b4
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import software.amazon.smithy.go.codegen.GoUniverseTypes;
import software.amazon.smithy.go.codegen.GoWriter;
import software.amazon.smithy.go.codegen.SmithyGoDependency;
import software.amazon.smithy.go.codegen.SmithyGoTypes;
import software.amazon.smithy.go.codegen.SymbolUtils;
import software.amazon.smithy.go.codegen.integration.ConfigField;
import software.amazon.smithy.go.codegen.integration.ConfigFieldResolver;
Expand Down Expand Up @@ -196,7 +195,7 @@ public class AddAwsConfigFields implements GoIntegration {
// TOKEN_PROVIDER_OPTION_NAME added API Client's Options by HttpBearerAuth. Only
// need to add NewFromConfig resolver from aws#Config type.
.name(AwsHttpBearerAuthScheme.TOKEN_PROVIDER_OPTION_NAME)
.type(SmithyGoTypes.Auth.Bearer.TokenProvider)
.type(SmithyGoDependency.SMITHY_AUTH_BEARER.interfaceSymbol("TokenProvider"))
.documentation("The bearer authentication token provider for authentication requests.")
.servicePredicate(AddAwsConfigFields::isHttpBearerService)
.generatedOnClient(false)
Expand Down Expand Up @@ -247,19 +246,19 @@ public class AddAwsConfigFields implements GoIntegration {
.build(),
AwsConfigField.builder()
.name(SDK_ACCOUNTID_ENDPOINT_MODE)
.type(SdkGoTypes.Aws.AccountIDEndpointMode)
.type(AwsGoDependency.AWS_CORE.func("AccountIDEndpointMode"))
.documentation("Indicates how aws account ID is applied in endpoint2.0 routing")
.servicePredicate(AccountIDEndpointRouting::hasAccountIdEndpoints)
.build(),
AwsConfigField.builder()
.name(REQUEST_CHECKSUM_CALCULATION)
.type(SdkGoTypes.Aws.RequestChecksumCalculation)
.type(AwsGoDependency.AWS_CORE.func("RequestChecksumCalculation"))
.documentation("Indicates how user opt-in/out request checksum calculation")
.servicePredicate(AwsHttpChecksumGenerator::hasInputChecksumTrait)
.build(),
AwsConfigField.builder()
.name(RESPONSE_CHECKSUM_VALIDATION)
.type(SdkGoTypes.Aws.ResponseChecksumValidation)
.type(AwsGoDependency.AWS_CORE.func("ResponseChecksumValidation"))
.documentation("Indicates how user opt-in/out response checksum validation")
.servicePredicate(AwsHttpChecksumGenerator::hasOutputChecksumTrait)
.build(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import software.amazon.smithy.go.codegen.ChainWritable;
import software.amazon.smithy.go.codegen.Writable;
import software.amazon.smithy.go.codegen.SmithyGoDependency;
import software.amazon.smithy.go.codegen.SmithyGoTypes;
import software.amazon.smithy.go.codegen.SymbolUtils;
import software.amazon.smithy.go.codegen.integration.ConfigField;
import software.amazon.smithy.go.codegen.integration.GoIntegration;
Expand Down Expand Up @@ -112,7 +111,7 @@ func getOrAddRequestUserAgent(stack *middleware.Stack) (*awsmiddleware.RequestUs
""",
MapUtils.of(
"service", serviceId,
"middlewareStack", SmithyGoTypes.Middleware.Stack
"middlewareStack", SmithyGoDependency.SMITHY_MIDDLEWARE.struct("Stack")
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import software.amazon.smithy.go.codegen.Writable;
import software.amazon.smithy.go.codegen.MiddlewareIdentifier;
import software.amazon.smithy.go.codegen.SmithyGoDependency;
import software.amazon.smithy.go.codegen.SmithyGoTypes;
import software.amazon.smithy.go.codegen.SymbolUtils;
import software.amazon.smithy.go.codegen.integration.ProtocolGenerator.GenerationContext;
import software.amazon.smithy.go.codegen.knowledge.GoPointableIndex;
Expand Down Expand Up @@ -353,9 +352,9 @@ defer func() {
MapUtils.of(
"getSignature", getSignedRequestSignature,
"errorf", GoStdlibTypes.Fmt.Errorf,
"credentialsAdapter", SdkGoTypes.Internal.Auth.Smithy.CredentialsAdapter,
"getSigningName", SmithyGoTypes.Transport.Http.GetSigV4SigningName,
"getSigningRegion", SmithyGoTypes.Transport.Http.GetSigV4SigningRegion
"credentialsAdapter", AwsGoDependency.INTERNAL_AUTH_SMITHY.struct("CredentialsAdapter"),
"getSigningName", SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetSigV4SigningName"),
"getSigningRegion", SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetSigV4SigningRegion")
));

var events = inputInfo.get().getEventStreamTarget().asUnionShape()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import software.amazon.smithy.go.codegen.MiddlewareIdentifier;
import software.amazon.smithy.go.codegen.OperationGenerator;
import software.amazon.smithy.go.codegen.SmithyGoDependency;
import software.amazon.smithy.go.codegen.SmithyGoTypes;
import software.amazon.smithy.go.codegen.SymbolUtils;
import software.amazon.smithy.go.codegen.auth.SignRequestMiddlewareGenerator;
import software.amazon.smithy.go.codegen.integration.GoIntegration;
Expand Down Expand Up @@ -389,15 +388,15 @@ private void writeConvertToPresignMiddleware(
writer.write("""
if _, ok := stack.Finalize.Get(($1P)(nil).ID()); ok {
stack.Finalize.Remove(($1P)(nil).ID())
}""", SdkGoTypes.ServiceInternal.AcceptEncoding.DisableGzip);
}""", AwsCustomGoDependency.ACCEPT_ENCODING_CUSTOMIZATION.struct("DisableGzip"));
writer.write("""
if _, ok := stack.Finalize.Get(($1P)(nil).ID()); ok {
stack.Finalize.Remove(($1P)(nil).ID())
}""", SdkGoTypes.Aws.Retry.Attempt);
}""", AwsGoDependency.AWS_RETRY.struct("Attempt"));
writer.write("""
if _, ok := stack.Finalize.Get(($1P)(nil).ID()); ok {
stack.Finalize.Remove(($1P)(nil).ID())
}""", SdkGoTypes.Aws.Retry.MetricsHeader);
}""", AwsGoDependency.AWS_RETRY.struct("MetricsHeader"));
writer.write("stack.Deserialize.Clear()");
writer.write("stack.Build.Remove(($P)(nil).ID())", requestInvocationID);
writer.write("stack.Build.Remove($S)", "UserAgent");
Expand All @@ -412,7 +411,7 @@ private void writeConvertToPresignMiddleware(
""",
PresignContextPolyfillMiddleware.NAME,
SignRequestMiddlewareGenerator.MIDDLEWARE_ID,
SmithyGoTypes.Middleware.Before);
SmithyGoDependency.SMITHY_MIDDLEWARE.func("Before"));

writer.openBlock("pmw := $T($T{", "})", presignMiddleware, middlewareOptionsSymbol, () -> {
writer.write("CredentialsProvider: options.$L,", AddAwsConfigFields.CREDENTIALS_CONFIG_NAME);
Expand Down Expand Up @@ -818,21 +817,21 @@ private Writable generateBody() {
MapUtils.of(
"errorf", GoStdlibTypes.Fmt.Errorf,
"setSignerVersion", generateSetSignerVersion(),
"propsGetV4Name", SmithyGoTypes.Transport.Http.GetSigV4SigningName,
"propsGetV4AName", SmithyGoTypes.Transport.Http.GetSigV4ASigningName,
"propsGetV4Region", SmithyGoTypes.Transport.Http.GetSigV4SigningRegion,
"propsGetV4ARegions", SmithyGoTypes.Transport.Http.GetSigV4ASigningRegions,
"ctxSetName", SdkGoTypes.Aws.Middleware.SetSigningName,
"ctxSetRegion", SdkGoTypes.Aws.Middleware.SetSigningRegion
"propsGetV4Name", SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetSigV4SigningName"),
"propsGetV4AName", SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetSigV4ASigningName"),
"propsGetV4Region", SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetSigV4SigningRegion"),
"propsGetV4ARegions", SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetSigV4ASigningRegions"),
"ctxSetName", AwsGoDependency.AWS_MIDDLEWARE.func("SetSigningName"),
"ctxSetRegion", AwsGoDependency.AWS_MIDDLEWARE.func("SetSigningRegion")
));
}

private Writable generateSetSignerVersion() {
return switch (service.expectTrait(ServiceTrait.class).getSdkId().toLowerCase()) {
case "s3" ->
goTemplate("ctx = $T(ctx, schemeID)", SdkGoTypes.ServiceCustomizations.S3.SetSignerVersion);
goTemplate("ctx = $T(ctx, schemeID)", AwsCustomGoDependency.S3_CUSTOMIZATION.func("SetSignerVersion"));
case "eventbridge" ->
goTemplate("ctx = $T(ctx, schemeID)", SdkGoTypes.ServiceCustomizations.EventBridge.SetSignerVersion);
goTemplate("ctx = $T(ctx, schemeID)", AwsCustomGoDependency.EVENTBRIDGE_CUSTOMIZATION.func("SetSignerVersion"));
default ->
emptyGoTemplate();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
import software.amazon.smithy.go.codegen.ChainWritable;
import software.amazon.smithy.go.codegen.Writable;
import software.amazon.smithy.go.codegen.MiddlewareIdentifier;
import software.amazon.smithy.go.codegen.SmithyGoTypes;
import software.amazon.smithy.go.codegen.endpoints.EndpointMiddlewareGenerator;
import software.amazon.smithy.go.codegen.integration.GoIntegration;
import software.amazon.smithy.go.codegen.integration.MiddlewareRegistrar;
import software.amazon.smithy.go.codegen.integration.RuntimeClientPlugin;
import software.amazon.smithy.go.codegen.SmithyGoDependency;
import software.amazon.smithy.model.Model;
import software.amazon.smithy.utils.ListUtils;

Expand Down Expand Up @@ -91,10 +91,10 @@ public void writeAdditionalFiles(
}
""",
MIDDLEWARE_ADDER,
SmithyGoTypes.Middleware.Stack,
SmithyGoDependency.SMITHY_MIDDLEWARE.struct("Stack"),
MIDDLEWARE_NAME,
EndpointMiddlewareGenerator.MIDDLEWARE_ID,
SmithyGoTypes.Middleware.After);
SmithyGoDependency.SMITHY_MIDDLEWARE.func("After"));
});
}

Expand Down Expand Up @@ -122,8 +122,8 @@ private Writable generateBody() {

return next.HandleFinalize(ctx, in)
""",
SmithyGoTypes.Transport.Http.Request,
SmithyGoDependency.SMITHY_HTTP_TRANSPORT.struct("Request"),
GoStdlibTypes.Fmt.Errorf,
SmithyGoTypes.Transport.Http.GetHostnameImmutable);
SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetHostnameImmutable"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void renderPreEndpointResolutionHook(GoSettings settings, GoWriter writer
if $T(ctx) {
return next.HandleFinalize(ctx, in)
}
""", SdkGoTypes.Aws.Middleware.GetRequiresLegacyEndpoints);
""", AwsGoDependency.AWS_MIDDLEWARE.func("GetRequiresLegacyEndpoints"));
}

@Override
Expand Down

This file was deleted.

Loading
Loading