Skip to content

Commit

Permalink
chore: codegen interceptors config
Browse files Browse the repository at this point in the history
Codegen for smithy-lang/smithy-swift#704.

Also updates the types of some interceptor implementations to
remove AttributesType.
  • Loading branch information
milesziemer committed Jun 20, 2024
1 parent 8937778 commit 2b53eec
Show file tree
Hide file tree
Showing 18 changed files with 7,223 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extension AWSS3ErrorWith200StatusXMLMiddleware: HttpInterceptor {
public typealias OutputType = OperationStackOutput

public func modifyBeforeDeserialization(
context: some MutableResponse<Self.InputType, Self.RequestType, Self.ResponseType, Self.AttributesType>
context: some MutableResponse<Self.InputType, Self.RequestType, Self.ResponseType>
) async throws {
let response = context.getResponse()
if try await isErrorWith200Status(response: response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extension Route53TrimHostedZoneMiddleware: HttpInterceptor {
public typealias OutputType = Output

public func modifyBeforeSerialization(
context: some MutableInput<Self.InputType, Self.AttributesType>
context: some MutableInput<Self.InputType>
) async throws {
context.updateInput(updated: getUpdatedInput(input: context.getInput()))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ extension Sha256TreeHashMiddleware: HttpInterceptor {
public typealias OutputType = OperationStackOutput

public func modifyBeforeTransmit(
context: some MutableRequest<Self.InputType, Self.RequestType, Self.AttributesType>
context: some MutableRequest<Self.InputType, Self.RequestType>
) async throws {
let request = context.getRequest()
let builder = request.toBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension UserAgentMiddleware: HttpInterceptor {
public typealias OutputType = OperationStackOutput

public func modifyBeforeRetryLoop(
context: some MutableRequest<Self.InputType, SdkHttpRequest, Context>
context: some MutableRequest<Self.InputType, SdkHttpRequest>
) async throws {
let builder = context.getRequest().toBuilder()
addHeader(builder: builder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extension XAmzTargetMiddleware: HttpInterceptor {
public typealias OutputType = OperationStackOutput

public func modifyBeforeRetryLoop(
context: some MutableRequest<Self.InputType, Self.RequestType, Self.AttributesType>
context: some MutableRequest<Self.InputType, Self.RequestType>
) async throws {
let builder = context.getRequest().toBuilder()
addHeader(builder: builder)
Expand Down

Large diffs are not rendered by default.

4,384 changes: 4,377 additions & 7 deletions Sources/Services/AWSEC2/Sources/AWSEC2/EC2Client.swift

Large diffs are not rendered by default.

422 changes: 415 additions & 7 deletions Sources/Services/AWSECS/Sources/AWSECS/ECSClient.swift

Large diffs are not rendered by default.

Large diffs are not rendered by default.

254 changes: 247 additions & 7 deletions Sources/Services/AWSKinesis/Sources/AWSKinesis/KinesisClient.swift

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4929,7 +4929,7 @@ extension PredictInputEndpointURLHostMiddleware: ClientRuntime.HttpInterceptor {
public typealias InputType = PredictInput
public typealias OutputType = PredictOutput

public func modifyBeforeSerialization(context: some ClientRuntime.MutableInput<InputType, Smithy.Context>) async throws {
public func modifyBeforeSerialization(context: some ClientRuntime.MutableInput<InputType>) async throws {
if let endpoint = context.getInput().predictEndpoint, let url = Foundation.URL(string: endpoint), let host = url.host {
context.getAttributes().host = host
}
Expand Down

Large diffs are not rendered by default.

520 changes: 513 additions & 7 deletions Sources/Services/AWSRoute53/Sources/AWSRoute53/Route53Client.swift

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions Sources/Services/AWSS3/Sources/AWSS3/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21604,6 +21604,13 @@ extension GetObjectInput {
.withSigningRegion(value: config.signingRegion)
.build()
let builder = ClientRuntime.OrchestratorBuilder<GetObjectInput, GetObjectOutput, SmithyHTTPAPI.SdkHttpRequest, SmithyHTTPAPI.HttpResponse>()
config.interceptorProviders.forEach { provider in
builder.interceptors.add(provider.create())
}
config.httpInterceptorProviders.forEach { provider in
let i: any HttpInterceptor<GetObjectInput, GetObjectOutput> = provider.create()
builder.interceptors.add(i)
}
builder.interceptors.add(ClientRuntime.URLPathMiddleware<GetObjectInput, GetObjectOutput>(GetObjectInput.urlPathProvider(_:)))
builder.interceptors.add(ClientRuntime.URLHostMiddleware<GetObjectInput, GetObjectOutput>())
let endpointParams = EndpointParams(accelerate: config.accelerate ?? false, bucket: input.bucket, disableMultiRegionAccessPoints: config.disableMultiRegionAccessPoints ?? false, disableS3ExpressSessionAuth: config.disableS3ExpressSessionAuth, endpoint: config.endpoint, forcePathStyle: config.forcePathStyle ?? false, key: input.key, region: config.region, useArnRegion: config.useArnRegion, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false, useGlobalEndpoint: config.useGlobalEndpoint ?? false)
Expand Down Expand Up @@ -21746,6 +21753,13 @@ extension PutObjectInput {
.withSigningRegion(value: config.signingRegion)
.build()
let builder = ClientRuntime.OrchestratorBuilder<PutObjectInput, PutObjectOutput, SmithyHTTPAPI.SdkHttpRequest, SmithyHTTPAPI.HttpResponse>()
config.interceptorProviders.forEach { provider in
builder.interceptors.add(provider.create())
}
config.httpInterceptorProviders.forEach { provider in
let i: any HttpInterceptor<PutObjectInput, PutObjectOutput> = provider.create()
builder.interceptors.add(i)
}
builder.interceptors.add(ClientRuntime.URLPathMiddleware<PutObjectInput, PutObjectOutput>(PutObjectInput.urlPathProvider(_:)))
builder.interceptors.add(ClientRuntime.URLHostMiddleware<PutObjectInput, PutObjectOutput>())
let endpointParams = EndpointParams(accelerate: config.accelerate ?? false, bucket: input.bucket, disableMultiRegionAccessPoints: config.disableMultiRegionAccessPoints ?? false, disableS3ExpressSessionAuth: config.disableS3ExpressSessionAuth, endpoint: config.endpoint, forcePathStyle: config.forcePathStyle ?? false, key: input.key, region: config.region, useArnRegion: config.useArnRegion, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false, useGlobalEndpoint: config.useGlobalEndpoint ?? false)
Expand Down Expand Up @@ -21829,6 +21843,13 @@ extension GetObjectInput {
.withSigningRegion(value: config.signingRegion)
.build()
let builder = ClientRuntime.OrchestratorBuilder<GetObjectInput, GetObjectOutput, SmithyHTTPAPI.SdkHttpRequest, SmithyHTTPAPI.HttpResponse>()
config.interceptorProviders.forEach { provider in
builder.interceptors.add(provider.create())
}
config.httpInterceptorProviders.forEach { provider in
let i: any HttpInterceptor<GetObjectInput, GetObjectOutput> = provider.create()
builder.interceptors.add(i)
}
builder.interceptors.add(ClientRuntime.URLPathMiddleware<GetObjectInput, GetObjectOutput>(GetObjectInput.urlPathProvider(_:)))
builder.interceptors.add(ClientRuntime.URLHostMiddleware<GetObjectInput, GetObjectOutput>())
let endpointParams = EndpointParams(accelerate: config.accelerate ?? false, bucket: input.bucket, disableMultiRegionAccessPoints: config.disableMultiRegionAccessPoints ?? false, disableS3ExpressSessionAuth: config.disableS3ExpressSessionAuth, endpoint: config.endpoint, forcePathStyle: config.forcePathStyle ?? false, key: input.key, region: config.region, useArnRegion: config.useArnRegion, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false, useGlobalEndpoint: config.useGlobalEndpoint ?? false)
Expand Down Expand Up @@ -21878,6 +21899,13 @@ extension PutObjectInput {
.withSigningRegion(value: config.signingRegion)
.build()
let builder = ClientRuntime.OrchestratorBuilder<PutObjectInput, PutObjectOutput, SmithyHTTPAPI.SdkHttpRequest, SmithyHTTPAPI.HttpResponse>()
config.interceptorProviders.forEach { provider in
builder.interceptors.add(provider.create())
}
config.httpInterceptorProviders.forEach { provider in
let i: any HttpInterceptor<PutObjectInput, PutObjectOutput> = provider.create()
builder.interceptors.add(i)
}
builder.interceptors.add(ClientRuntime.URLPathMiddleware<PutObjectInput, PutObjectOutput>(PutObjectInput.urlPathProvider(_:)))
builder.interceptors.add(ClientRuntime.URLHostMiddleware<PutObjectInput, PutObjectOutput>())
let endpointParams = EndpointParams(accelerate: config.accelerate ?? false, bucket: input.bucket, disableMultiRegionAccessPoints: config.disableMultiRegionAccessPoints ?? false, disableS3ExpressSessionAuth: config.disableS3ExpressSessionAuth, endpoint: config.endpoint, forcePathStyle: config.forcePathStyle ?? false, key: input.key, region: config.region, useArnRegion: config.useArnRegion, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false, useGlobalEndpoint: config.useGlobalEndpoint ?? false)
Expand Down Expand Up @@ -21931,6 +21959,13 @@ extension UploadPartInput {
.withSigningRegion(value: config.signingRegion)
.build()
let builder = ClientRuntime.OrchestratorBuilder<UploadPartInput, UploadPartOutput, SmithyHTTPAPI.SdkHttpRequest, SmithyHTTPAPI.HttpResponse>()
config.interceptorProviders.forEach { provider in
builder.interceptors.add(provider.create())
}
config.httpInterceptorProviders.forEach { provider in
let i: any HttpInterceptor<UploadPartInput, UploadPartOutput> = provider.create()
builder.interceptors.add(i)
}
builder.interceptors.add(ClientRuntime.URLPathMiddleware<UploadPartInput, UploadPartOutput>(UploadPartInput.urlPathProvider(_:)))
builder.interceptors.add(ClientRuntime.URLHostMiddleware<UploadPartInput, UploadPartOutput>())
let endpointParams = EndpointParams(accelerate: config.accelerate ?? false, bucket: input.bucket, disableMultiRegionAccessPoints: config.disableMultiRegionAccessPoints ?? false, disableS3ExpressSessionAuth: config.disableS3ExpressSessionAuth, endpoint: config.endpoint, forcePathStyle: config.forcePathStyle ?? false, key: input.key, region: config.region, useArnRegion: config.useArnRegion, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false, useGlobalEndpoint: config.useGlobalEndpoint ?? false)
Expand Down
Loading

0 comments on commit 2b53eec

Please sign in to comment.