Skip to content

Commit

Permalink
pull retry loop forward to cover everything from resolving auth schem…
Browse files Browse the repository at this point in the history
…e onward (#2966)
  • Loading branch information
lucix-aws authored Jan 17, 2025
1 parent 7ea97e5 commit 74b33ba
Show file tree
Hide file tree
Showing 17,321 changed files with 51,628 additions and 51,166 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
419 changes: 419 additions & 0 deletions .changelog/70097b97ec1146ffb87105b3aa6ad390.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public void writeAdditionalFiles(
if (supportsComputeInputChecksumsWorkflow) {
goDelegator.useShapeWriter(service, writer -> {
generateInputComputedChecksumMetadataHelpers(writer, model, symbolProvider, service);
writePackageLevelAddInputChecksumMiddleware(writer);
});
}

Expand Down Expand Up @@ -257,16 +258,14 @@ private void writeInputMiddlewareHelper(
writer.openBlock("func $L(stack *middleware.Stack, options Options) error {", "}",
getAddInputMiddlewareFuncName(operationName), () -> {
writer.write("""
return $T(stack, $T{
return addInputChecksumMiddleware(stack, $T{
GetAlgorithm: $L,
RequireChecksum: $L,
RequestChecksumCalculation: options.RequestChecksumCalculation,
EnableTrailingChecksum: $L,
EnableComputeSHA256PayloadHash: true,
EnableDecodedContentLengthHeader: $L,
})""",
SymbolUtils.createValueSymbolBuilder("AddInputMiddleware",
AwsGoDependency.SERVICE_INTERNAL_CHECKSUM).build(),
SymbolUtils.createValueSymbolBuilder("InputMiddlewareOptions",
AwsGoDependency.SERVICE_INTERNAL_CHECKSUM).build(),
hasRequestAlgorithmMember ?
Expand All @@ -279,6 +278,48 @@ private void writeInputMiddlewareHelper(
writer.insertTrailingNewline();
}

// adapted (service/internal/checksum).AddInputMiddleware to give the service client control over its middleware stack,
// per #2507
private void writePackageLevelAddInputChecksumMiddleware(GoWriter writer) {
writer.addUseImports(SmithyGoDependency.SMITHY_MIDDLEWARE);
writer.addUseImports(AwsGoDependency.SERVICE_INTERNAL_CHECKSUM);
writer.write("""
func addInputChecksumMiddleware(stack *middleware.Stack, options internalChecksum.InputMiddlewareOptions) (err error) {
err = stack.Initialize.Add(&internalChecksum.SetupInputContext{
GetAlgorithm: options.GetAlgorithm,
RequireChecksum: options.RequireChecksum,
RequestChecksumCalculation: options.RequestChecksumCalculation,
}, middleware.Before)
if err != nil {
return err
}
stack.Build.Remove("ContentChecksum")
inputChecksum := &internalChecksum.ComputeInputPayloadChecksum{
EnableTrailingChecksum: options.EnableTrailingChecksum,
EnableComputePayloadHash: options.EnableComputeSHA256PayloadHash,
EnableDecodedContentLengthHeader: options.EnableDecodedContentLengthHeader,
}
if err := stack.Finalize.Insert(inputChecksum, "ResolveEndpointV2", middleware.After); err != nil {
return err
}
if options.EnableTrailingChecksum {
trailerMiddleware := &internalChecksum.AddInputChecksumTrailer{
EnableTrailingChecksum: inputChecksum.EnableTrailingChecksum,
EnableComputePayloadHash: inputChecksum.EnableComputePayloadHash,
EnableDecodedContentLengthHeader: inputChecksum.EnableDecodedContentLengthHeader,
}
if err := stack.Finalize.Insert(trailerMiddleware, inputChecksum.ID(), middleware.After); err != nil {
return err
}
}
return nil
}""");
}

private void writeOutputMiddlewareHelper(
GoWriter writer,
Model model,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func addRetry(stack *middleware.Stack, o Options) error {
m.LogAttempts = o.ClientLogMode.IsRetries()
m.OperationMeter = o.MeterProvider.Meter($S)
})
if err := stack.Finalize.Insert(attempt, "Signing", middleware.Before); err != nil {
if err := stack.Finalize.Insert(attempt, "ResolveAuthScheme", middleware.Before); err != nil {
return err
}
if err := stack.Finalize.Insert(&retry.MetricsHeader{}, attempt.ID(), middleware.After); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/protocoltest/awsrestjson/api_client.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ AllQueryStringTypes
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ ConstantAndVariableQueryString
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ ConstantQueryString
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ ContentTypeParameters
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ DatetimeOffsets
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ DocumentType
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ DocumentTypeAsMapValue
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ DocumentTypeAsPayload
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ EmptyInputAndEmptyOutput
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ EndpointOperation
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
EndpointHostPrefix
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ EndpointWithHostLabelOperation
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
EndpointHostPrefix
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ FractionalSeconds
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ GreetingWithErrors
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ HostWithPathOperation
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ HttpChecksumRequired
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ HttpEnumPayload
RecursionDetection
spanBuildRequestEnd
Finalize stack step
spanRetryLoop
Retry
RetryMetricsHeader
ResolveAuthScheme
GetIdentity
ResolveEndpointV2
disableHTTPS
ComputePayloadHash
spanRetryLoop
Retry
RetryMetricsHeader
setLegacyContextSigningOptions
Signing
Deserialize stack step
Expand Down
Loading

0 comments on commit 74b33ba

Please sign in to comment.