Skip to content

Commit 8100061

Browse files
authored
replace usages of SdkGoTypes and track aws/smithy-go#637 (#3342)
* replace usages of SmithyGoTypes * replace usages of SdkGoTypes * set codegen
1 parent b01d4b9 commit 8100061

20 files changed

+110
-230
lines changed

SMITHY_GO_CODEGEN_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c53a167c47ab83db2c802885eec2902afeebd4b4
1+
b64db94c52a12377b42bb0a2295f964f7ea0b1b4

codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AddAwsConfigFields.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import software.amazon.smithy.go.codegen.GoUniverseTypes;
3434
import software.amazon.smithy.go.codegen.GoWriter;
3535
import software.amazon.smithy.go.codegen.SmithyGoDependency;
36-
import software.amazon.smithy.go.codegen.SmithyGoTypes;
3736
import software.amazon.smithy.go.codegen.SymbolUtils;
3837
import software.amazon.smithy.go.codegen.integration.ConfigField;
3938
import software.amazon.smithy.go.codegen.integration.ConfigFieldResolver;
@@ -196,7 +195,7 @@ public class AddAwsConfigFields implements GoIntegration {
196195
// TOKEN_PROVIDER_OPTION_NAME added API Client's Options by HttpBearerAuth. Only
197196
// need to add NewFromConfig resolver from aws#Config type.
198197
.name(AwsHttpBearerAuthScheme.TOKEN_PROVIDER_OPTION_NAME)
199-
.type(SmithyGoTypes.Auth.Bearer.TokenProvider)
198+
.type(SmithyGoDependency.SMITHY_AUTH_BEARER.interfaceSymbol("TokenProvider"))
200199
.documentation("The bearer authentication token provider for authentication requests.")
201200
.servicePredicate(AddAwsConfigFields::isHttpBearerService)
202201
.generatedOnClient(false)
@@ -247,19 +246,19 @@ public class AddAwsConfigFields implements GoIntegration {
247246
.build(),
248247
AwsConfigField.builder()
249248
.name(SDK_ACCOUNTID_ENDPOINT_MODE)
250-
.type(SdkGoTypes.Aws.AccountIDEndpointMode)
249+
.type(AwsGoDependency.AWS_CORE.func("AccountIDEndpointMode"))
251250
.documentation("Indicates how aws account ID is applied in endpoint2.0 routing")
252251
.servicePredicate(AccountIDEndpointRouting::hasAccountIdEndpoints)
253252
.build(),
254253
AwsConfigField.builder()
255254
.name(REQUEST_CHECKSUM_CALCULATION)
256-
.type(SdkGoTypes.Aws.RequestChecksumCalculation)
255+
.type(AwsGoDependency.AWS_CORE.func("RequestChecksumCalculation"))
257256
.documentation("Indicates how user opt-in/out request checksum calculation")
258257
.servicePredicate(AwsHttpChecksumGenerator::hasInputChecksumTrait)
259258
.build(),
260259
AwsConfigField.builder()
261260
.name(RESPONSE_CHECKSUM_VALIDATION)
262-
.type(SdkGoTypes.Aws.ResponseChecksumValidation)
261+
.type(AwsGoDependency.AWS_CORE.func("ResponseChecksumValidation"))
263262
.documentation("Indicates how user opt-in/out response checksum validation")
264263
.servicePredicate(AwsHttpChecksumGenerator::hasOutputChecksumTrait)
265264
.build(),

codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsClientUserAgent.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import software.amazon.smithy.go.codegen.ChainWritable;
2828
import software.amazon.smithy.go.codegen.Writable;
2929
import software.amazon.smithy.go.codegen.SmithyGoDependency;
30-
import software.amazon.smithy.go.codegen.SmithyGoTypes;
3130
import software.amazon.smithy.go.codegen.SymbolUtils;
3231
import software.amazon.smithy.go.codegen.integration.ConfigField;
3332
import software.amazon.smithy.go.codegen.integration.GoIntegration;
@@ -112,7 +111,7 @@ func getOrAddRequestUserAgent(stack *middleware.Stack) (*awsmiddleware.RequestUs
112111
""",
113112
MapUtils.of(
114113
"service", serviceId,
115-
"middlewareStack", SmithyGoTypes.Middleware.Stack
114+
"middlewareStack", SmithyGoDependency.SMITHY_MIDDLEWARE.struct("Stack")
116115
));
117116
}
118117
}

codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsEventStreamUtils.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import software.amazon.smithy.go.codegen.Writable;
2424
import software.amazon.smithy.go.codegen.MiddlewareIdentifier;
2525
import software.amazon.smithy.go.codegen.SmithyGoDependency;
26-
import software.amazon.smithy.go.codegen.SmithyGoTypes;
2726
import software.amazon.smithy.go.codegen.SymbolUtils;
2827
import software.amazon.smithy.go.codegen.integration.ProtocolGenerator.GenerationContext;
2928
import software.amazon.smithy.go.codegen.knowledge.GoPointableIndex;
@@ -353,9 +352,9 @@ defer func() {
353352
MapUtils.of(
354353
"getSignature", getSignedRequestSignature,
355354
"errorf", GoStdlibTypes.Fmt.Errorf,
356-
"credentialsAdapter", SdkGoTypes.Internal.Auth.Smithy.CredentialsAdapter,
357-
"getSigningName", SmithyGoTypes.Transport.Http.GetSigV4SigningName,
358-
"getSigningRegion", SmithyGoTypes.Transport.Http.GetSigV4SigningRegion
355+
"credentialsAdapter", AwsGoDependency.INTERNAL_AUTH_SMITHY.struct("CredentialsAdapter"),
356+
"getSigningName", SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetSigV4SigningName"),
357+
"getSigningRegion", SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetSigV4SigningRegion")
359358
));
360359

361360
var events = inputInfo.get().getEventStreamTarget().asUnionShape()

codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsHttpPresignURLClientGenerator.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import software.amazon.smithy.go.codegen.MiddlewareIdentifier;
3939
import software.amazon.smithy.go.codegen.OperationGenerator;
4040
import software.amazon.smithy.go.codegen.SmithyGoDependency;
41-
import software.amazon.smithy.go.codegen.SmithyGoTypes;
4241
import software.amazon.smithy.go.codegen.SymbolUtils;
4342
import software.amazon.smithy.go.codegen.auth.SignRequestMiddlewareGenerator;
4443
import software.amazon.smithy.go.codegen.integration.GoIntegration;
@@ -389,15 +388,15 @@ private void writeConvertToPresignMiddleware(
389388
writer.write("""
390389
if _, ok := stack.Finalize.Get(($1P)(nil).ID()); ok {
391390
stack.Finalize.Remove(($1P)(nil).ID())
392-
}""", SdkGoTypes.ServiceInternal.AcceptEncoding.DisableGzip);
391+
}""", AwsCustomGoDependency.ACCEPT_ENCODING_CUSTOMIZATION.struct("DisableGzip"));
393392
writer.write("""
394393
if _, ok := stack.Finalize.Get(($1P)(nil).ID()); ok {
395394
stack.Finalize.Remove(($1P)(nil).ID())
396-
}""", SdkGoTypes.Aws.Retry.Attempt);
395+
}""", AwsGoDependency.AWS_RETRY.struct("Attempt"));
397396
writer.write("""
398397
if _, ok := stack.Finalize.Get(($1P)(nil).ID()); ok {
399398
stack.Finalize.Remove(($1P)(nil).ID())
400-
}""", SdkGoTypes.Aws.Retry.MetricsHeader);
399+
}""", AwsGoDependency.AWS_RETRY.struct("MetricsHeader"));
401400
writer.write("stack.Deserialize.Clear()");
402401
writer.write("stack.Build.Remove(($P)(nil).ID())", requestInvocationID);
403402
writer.write("stack.Build.Remove($S)", "UserAgent");
@@ -412,7 +411,7 @@ private void writeConvertToPresignMiddleware(
412411
""",
413412
PresignContextPolyfillMiddleware.NAME,
414413
SignRequestMiddlewareGenerator.MIDDLEWARE_ID,
415-
SmithyGoTypes.Middleware.Before);
414+
SmithyGoDependency.SMITHY_MIDDLEWARE.func("Before"));
416415

417416
writer.openBlock("pmw := $T($T{", "})", presignMiddleware, middlewareOptionsSymbol, () -> {
418417
writer.write("CredentialsProvider: options.$L,", AddAwsConfigFields.CREDENTIALS_CONFIG_NAME);
@@ -818,21 +817,21 @@ private Writable generateBody() {
818817
MapUtils.of(
819818
"errorf", GoStdlibTypes.Fmt.Errorf,
820819
"setSignerVersion", generateSetSignerVersion(),
821-
"propsGetV4Name", SmithyGoTypes.Transport.Http.GetSigV4SigningName,
822-
"propsGetV4AName", SmithyGoTypes.Transport.Http.GetSigV4ASigningName,
823-
"propsGetV4Region", SmithyGoTypes.Transport.Http.GetSigV4SigningRegion,
824-
"propsGetV4ARegions", SmithyGoTypes.Transport.Http.GetSigV4ASigningRegions,
825-
"ctxSetName", SdkGoTypes.Aws.Middleware.SetSigningName,
826-
"ctxSetRegion", SdkGoTypes.Aws.Middleware.SetSigningRegion
820+
"propsGetV4Name", SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetSigV4SigningName"),
821+
"propsGetV4AName", SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetSigV4ASigningName"),
822+
"propsGetV4Region", SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetSigV4SigningRegion"),
823+
"propsGetV4ARegions", SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetSigV4ASigningRegions"),
824+
"ctxSetName", AwsGoDependency.AWS_MIDDLEWARE.func("SetSigningName"),
825+
"ctxSetRegion", AwsGoDependency.AWS_MIDDLEWARE.func("SetSigningRegion")
827826
));
828827
}
829828

830829
private Writable generateSetSignerVersion() {
831830
return switch (service.expectTrait(ServiceTrait.class).getSdkId().toLowerCase()) {
832831
case "s3" ->
833-
goTemplate("ctx = $T(ctx, schemeID)", SdkGoTypes.ServiceCustomizations.S3.SetSignerVersion);
832+
goTemplate("ctx = $T(ctx, schemeID)", AwsCustomGoDependency.S3_CUSTOMIZATION.func("SetSignerVersion"));
834833
case "eventbridge" ->
835-
goTemplate("ctx = $T(ctx, schemeID)", SdkGoTypes.ServiceCustomizations.EventBridge.SetSignerVersion);
834+
goTemplate("ctx = $T(ctx, schemeID)", AwsCustomGoDependency.EVENTBRIDGE_CUSTOMIZATION.func("SetSignerVersion"));
836835
default ->
837836
emptyGoTemplate();
838837
};

codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointDisableHttps.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
import software.amazon.smithy.go.codegen.ChainWritable;
2626
import software.amazon.smithy.go.codegen.Writable;
2727
import software.amazon.smithy.go.codegen.MiddlewareIdentifier;
28-
import software.amazon.smithy.go.codegen.SmithyGoTypes;
2928
import software.amazon.smithy.go.codegen.endpoints.EndpointMiddlewareGenerator;
3029
import software.amazon.smithy.go.codegen.integration.GoIntegration;
3130
import software.amazon.smithy.go.codegen.integration.MiddlewareRegistrar;
3231
import software.amazon.smithy.go.codegen.integration.RuntimeClientPlugin;
32+
import software.amazon.smithy.go.codegen.SmithyGoDependency;
3333
import software.amazon.smithy.model.Model;
3434
import software.amazon.smithy.utils.ListUtils;
3535

@@ -91,10 +91,10 @@ public void writeAdditionalFiles(
9191
}
9292
""",
9393
MIDDLEWARE_ADDER,
94-
SmithyGoTypes.Middleware.Stack,
94+
SmithyGoDependency.SMITHY_MIDDLEWARE.struct("Stack"),
9595
MIDDLEWARE_NAME,
9696
EndpointMiddlewareGenerator.MIDDLEWARE_ID,
97-
SmithyGoTypes.Middleware.After);
97+
SmithyGoDependency.SMITHY_MIDDLEWARE.func("After"));
9898
});
9999
}
100100

@@ -122,8 +122,8 @@ private Writable generateBody() {
122122
123123
return next.HandleFinalize(ctx, in)
124124
""",
125-
SmithyGoTypes.Transport.Http.Request,
125+
SmithyGoDependency.SMITHY_HTTP_TRANSPORT.struct("Request"),
126126
GoStdlibTypes.Fmt.Errorf,
127-
SmithyGoTypes.Transport.Http.GetHostnameImmutable);
127+
SmithyGoDependency.SMITHY_HTTP_TRANSPORT.func("GetHostnameImmutable"));
128128
}
129129
}

codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/LegacyEndpointContextSetter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void renderPreEndpointResolutionHook(GoSettings settings, GoWriter writer
6363
if $T(ctx) {
6464
return next.HandleFinalize(ctx, in)
6565
}
66-
""", SdkGoTypes.Aws.Middleware.GetRequiresLegacyEndpoints);
66+
""", AwsGoDependency.AWS_MIDDLEWARE.func("GetRequiresLegacyEndpoints"));
6767
}
6868

6969
@Override

codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/SdkGoTypes.java

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)