diff --git a/IntegrationTests/Services/AWSRoute53IntegrationTests/AWSRoute53Tests.swift b/IntegrationTests/Services/AWSRoute53IntegrationTests/AWSRoute53Tests.swift new file mode 100644 index 00000000000..0fad3cfd45f --- /dev/null +++ b/IntegrationTests/Services/AWSRoute53IntegrationTests/AWSRoute53Tests.swift @@ -0,0 +1,82 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import XCTest +import AWSRoute53 + +class AWSRoute53Tests: XCTestCase { + var client: Route53Client! + var hostedZoneID: String? + + override func setUp() async throws { + try await super.setUp() + client = try Route53Client(region: "us-east-1") + } + + override func tearDown() async throws { + + // Delete the hosted zone that was created in the test. + // Note that the member with the hosted zone ID is just named 'id' + // here while it is 'hostedZoneId' below; the customization has + // been adapted to handle any member name. + let input = DeleteHostedZoneInput(id: hostedZoneID) + _ = try await client.deleteHostedZone(input: input) + client = nil + hostedZoneID = nil + } + + // Tests the 'TrimHostedZone' customization by performing operations on + // AWS Route 53 that will fail if the zone ID is not correctly trimmed. + func test_route53_createsAndDeletesZoneAndRecords() async throws { + + // Create reference string that is used for idempotency, and + // also use it to create a bogus web domain that is used in the test. + let ref = UUID().uuidString + let hostedZoneName = "\(ref).com." + + // Create a hosted zone for the zone name created above. + // Store the hosted zone ID for future reference. + // The ID will be in the form '/hostedzone/'. + // The '/hostedzone/' portion of the ID at the beginning is what must be + // trimmed by the customization, and only the alphanumeric portion + // of the ID is used in the operation's request URL. + let input0 = CreateHostedZoneInput(callerReference: ref, name: hostedZoneName) + let output0 = try await client.createHostedZone(input: input0) + hostedZoneID = output0.hostedZone?.id + + // Create an A record on the zone that was just made. + // ChangeResourceRecordSetsInput includes the hosted zone ID in a URL + // component. + let createBatch = Route53ClientTypes.ChangeBatch(changes: + [ + Route53ClientTypes.Change( + action: .create, + resourceRecordSet: Route53ClientTypes.ResourceRecordSet( + name: "abc.\(hostedZoneName)", resourceRecords: [Route53ClientTypes.ResourceRecord(value: "1.1.1.1")], ttl: 3600, type: .a + ) + ), + ] + ) + let input1 = ChangeResourceRecordSetsInput(changeBatch: createBatch, hostedZoneId: hostedZoneID) + let output1 = try await client.changeResourceRecordSets(input: input1) + + // Now delete the A record that was just created; this is necessary for the + // hosted zone to be deleted in test teardown. + let deleteBatch = Route53ClientTypes.ChangeBatch(changes: + [ + Route53ClientTypes.Change( + action: .delete, + resourceRecordSet: Route53ClientTypes.ResourceRecordSet( + name: "abc.\(hostedZoneName)", resourceRecords: [Route53ClientTypes.ResourceRecord(value: "1.1.1.1")], ttl: 3600, type: .a + ) + ), + ] + ) + let input2 = ChangeResourceRecordSetsInput(changeBatch: deleteBatch, hostedZoneId: hostedZoneID) + let output2 = try await client.changeResourceRecordSets(input: input2) + } +} diff --git a/IntegrationTests/Services/AWSRoute53IntegrationTests/Resources/.gitignore b/IntegrationTests/Services/AWSRoute53IntegrationTests/Resources/.gitignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Package.swift b/Package.swift index ec5979e99db..321338a9b37 100644 --- a/Package.swift +++ b/Package.swift @@ -646,6 +646,7 @@ let servicesWithIntegrationTests: [String] = [ "AWSEventBridge", "AWSKinesis", "AWSMediaConvert", + "AWSRoute53", "AWSS3", "AWSSQS", "AWSSTS", diff --git a/Sources/Core/AWSClientRuntime/Middlewares/Route53TrimHostedZoneMiddleware.swift b/Sources/Core/AWSClientRuntime/Middlewares/Route53TrimHostedZoneMiddleware.swift new file mode 100644 index 00000000000..53eec126781 --- /dev/null +++ b/Sources/Core/AWSClientRuntime/Middlewares/Route53TrimHostedZoneMiddleware.swift @@ -0,0 +1,39 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import ClientRuntime + +public struct Route53TrimHostedZoneMiddleware: ClientRuntime.Middleware { + public let id: Swift.String = "Route53TrimHostedZoneMiddleware" + private let prefixes = ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"] + + private let hostedZoneIDKeyPath: WritableKeyPath + + public init(_ hostedZoneIDKeyPath: WritableKeyPath) { + self.hostedZoneIDKeyPath = hostedZoneIDKeyPath + } + + public func handle(context: Context, + input: Input, + next: H) async throws -> ClientRuntime.OperationOutput + where H: Handler, + Self.MInput == H.Input, + Self.MOutput == H.Output, + Self.Context == H.Context { + guard let hostedZoneId = input[keyPath: hostedZoneIDKeyPath] else { + return try await next.handle(context: context, input: input) + } + var copiedInput = input + let stripped = hostedZoneId.stripFirstMatching(prefixes: prefixes) + copiedInput[keyPath: hostedZoneIDKeyPath] = stripped + return try await next.handle(context: context, input: copiedInput) + } + + public typealias MInput = Input + public typealias MOutput = ClientRuntime.OperationOutput + public typealias Context = ClientRuntime.HttpContext +} diff --git a/Sources/Services/AWSRoute53/Route53Client.swift b/Sources/Services/AWSRoute53/Route53Client.swift index 4930aba44a1..9a837a9ebee 100644 --- a/Sources/Services/AWSRoute53/Route53Client.swift +++ b/Sources/Services/AWSRoute53/Route53Client.swift @@ -167,7 +167,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "activateKeySigningKey") - operation.initializeStep.intercept(position: .after, middleware: ActivateKeySigningKeyInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(ActivateKeySigningKeyInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -235,7 +235,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "associateVPCWithHostedZone") - operation.initializeStep.intercept(position: .after, middleware: AssociateVPCWithHostedZoneInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(AssociateVPCWithHostedZoneInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -354,7 +354,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "changeResourceRecordSets") - operation.initializeStep.intercept(position: .after, middleware: ChangeResourceRecordSetsInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(ChangeResourceRecordSetsInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -1041,7 +1041,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "createVPCAssociationAuthorization") - operation.initializeStep.intercept(position: .after, middleware: CreateVPCAssociationAuthorizationInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(CreateVPCAssociationAuthorizationInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -1096,7 +1096,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "deactivateKeySigningKey") - operation.initializeStep.intercept(position: .after, middleware: DeactivateKeySigningKeyInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(DeactivateKeySigningKeyInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -1245,6 +1245,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "deleteHostedZone") + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.id)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(DeleteHostedZoneInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -1295,7 +1296,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "deleteKeySigningKey") - operation.initializeStep.intercept(position: .after, middleware: DeleteKeySigningKeyInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(DeleteKeySigningKeyInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -1391,6 +1392,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "deleteReusableDelegationSet") + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.id)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(DeleteReusableDelegationSetInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -1541,7 +1543,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "deleteVPCAssociationAuthorization") - operation.initializeStep.intercept(position: .after, middleware: DeleteVPCAssociationAuthorizationInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(DeleteVPCAssociationAuthorizationInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -1597,7 +1599,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "disableHostedZoneDNSSEC") - operation.initializeStep.intercept(position: .after, middleware: DisableHostedZoneDNSSECInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(DisableHostedZoneDNSSECInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -1667,7 +1669,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "disassociateVPCFromHostedZone") - operation.initializeStep.intercept(position: .after, middleware: DisassociateVPCFromHostedZoneInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(DisassociateVPCFromHostedZoneInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -1724,7 +1726,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "enableHostedZoneDNSSEC") - operation.initializeStep.intercept(position: .after, middleware: EnableHostedZoneDNSSECInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(EnableHostedZoneDNSSECInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -1907,7 +1909,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "getDNSSEC") - operation.initializeStep.intercept(position: .after, middleware: GetDNSSECInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(GetDNSSECInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -2180,6 +2182,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "getHostedZone") + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.id)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(GetHostedZoneInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -2272,7 +2275,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "getHostedZoneLimit") - operation.initializeStep.intercept(position: .after, middleware: GetHostedZoneLimitInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(GetHostedZoneLimitInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -2366,6 +2369,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "getReusableDelegationSet") + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.id)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(GetReusableDelegationSetInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -2412,6 +2416,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "getReusableDelegationSetLimit") + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.delegationSetId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(GetReusableDelegationSetLimitInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -3038,7 +3043,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "listResourceRecordSets") - operation.initializeStep.intercept(position: .after, middleware: ListResourceRecordSetsInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(ListResourceRecordSetsInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -3470,7 +3475,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "listVPCAssociationAuthorizations") - operation.initializeStep.intercept(position: .after, middleware: ListVPCAssociationAuthorizationsInputStripHostedZoneMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.hostedZoneId)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(ListVPCAssociationAuthorizationsInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) @@ -3616,6 +3621,7 @@ extension Route53Client { .withSigningRegion(value: config.signingRegion) .build() var operation = ClientRuntime.OperationStack(id: "updateHostedZoneComment") + operation.initializeStep.intercept(position: .after, middleware: Route53TrimHostedZoneMiddleware(\.id)) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware(UpdateHostedZoneCommentInput.urlPathProvider(_:))) operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false) diff --git a/Sources/Services/AWSRoute53/models/Models.swift b/Sources/Services/AWSRoute53/models/Models.swift index 68b080f2349..ab7186c593d 100644 --- a/Sources/Services/AWSRoute53/models/Models.swift +++ b/Sources/Services/AWSRoute53/models/Models.swift @@ -96,31 +96,6 @@ extension Route53ClientTypes { } } -public struct ActivateKeySigningKeyInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "ActivateKeySigningKeyInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: ActivateKeySigningKeyInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = ActivateKeySigningKeyInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension ActivateKeySigningKeyInput { static func urlPathProvider(_ value: ActivateKeySigningKeyInput) -> Swift.String? { @@ -393,31 +368,6 @@ extension AssociateVPCWithHostedZoneInput { } } -public struct AssociateVPCWithHostedZoneInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "AssociateVPCWithHostedZoneInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: AssociateVPCWithHostedZoneInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = AssociateVPCWithHostedZoneInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension AssociateVPCWithHostedZoneInput { static func urlPathProvider(_ value: AssociateVPCWithHostedZoneInput) -> Swift.String? { @@ -773,31 +723,6 @@ extension ChangeResourceRecordSetsInput { } } -public struct ChangeResourceRecordSetsInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "ChangeResourceRecordSetsInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: ChangeResourceRecordSetsInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = ChangeResourceRecordSetsInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension ChangeResourceRecordSetsInput { static func urlPathProvider(_ value: ChangeResourceRecordSetsInput) -> Swift.String? { @@ -2858,31 +2783,6 @@ extension CreateVPCAssociationAuthorizationInput { } } -public struct CreateVPCAssociationAuthorizationInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "CreateVPCAssociationAuthorizationInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: CreateVPCAssociationAuthorizationInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = CreateVPCAssociationAuthorizationInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension CreateVPCAssociationAuthorizationInput { static func urlPathProvider(_ value: CreateVPCAssociationAuthorizationInput) -> Swift.String? { @@ -3051,31 +2951,6 @@ extension Route53ClientTypes { } -public struct DeactivateKeySigningKeyInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "DeactivateKeySigningKeyInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: DeactivateKeySigningKeyInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = DeactivateKeySigningKeyInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension DeactivateKeySigningKeyInput { static func urlPathProvider(_ value: DeactivateKeySigningKeyInput) -> Swift.String? { @@ -3626,31 +3501,6 @@ enum DeleteHostedZoneOutputError { } } -public struct DeleteKeySigningKeyInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "DeleteKeySigningKeyInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: DeleteKeySigningKeyInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = DeleteKeySigningKeyInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension DeleteKeySigningKeyInput { static func urlPathProvider(_ value: DeleteKeySigningKeyInput) -> Swift.String? { @@ -3967,31 +3817,6 @@ extension DeleteVPCAssociationAuthorizationInput { } } -public struct DeleteVPCAssociationAuthorizationInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "DeleteVPCAssociationAuthorizationInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: DeleteVPCAssociationAuthorizationInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = DeleteVPCAssociationAuthorizationInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension DeleteVPCAssociationAuthorizationInput { static func urlPathProvider(_ value: DeleteVPCAssociationAuthorizationInput) -> Swift.String? { @@ -4096,31 +3921,6 @@ extension Route53ClientTypes { } -public struct DisableHostedZoneDNSSECInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "DisableHostedZoneDNSSECInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: DisableHostedZoneDNSSECInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = DisableHostedZoneDNSSECInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension DisableHostedZoneDNSSECInput { static func urlPathProvider(_ value: DisableHostedZoneDNSSECInput) -> Swift.String? { @@ -4200,31 +4000,6 @@ extension DisassociateVPCFromHostedZoneInput { } } -public struct DisassociateVPCFromHostedZoneInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "DisassociateVPCFromHostedZoneInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: DisassociateVPCFromHostedZoneInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = DisassociateVPCFromHostedZoneInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension DisassociateVPCFromHostedZoneInput { static func urlPathProvider(_ value: DisassociateVPCFromHostedZoneInput) -> Swift.String? { @@ -4304,31 +4079,6 @@ enum DisassociateVPCFromHostedZoneOutputError { } } -public struct EnableHostedZoneDNSSECInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "EnableHostedZoneDNSSECInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: EnableHostedZoneDNSSECInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = EnableHostedZoneDNSSECInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension EnableHostedZoneDNSSECInput { static func urlPathProvider(_ value: EnableHostedZoneDNSSECInput) -> Swift.String? { @@ -4783,31 +4533,6 @@ enum GetCheckerIpRangesOutputError { } } -public struct GetDNSSECInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "GetDNSSECInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: GetDNSSECInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = GetDNSSECInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension GetDNSSECInput { static func urlPathProvider(_ value: GetDNSSECInput) -> Swift.String? { @@ -5319,31 +5044,6 @@ public struct GetHostedZoneInput: Swift.Equatable { } } -public struct GetHostedZoneLimitInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "GetHostedZoneLimitInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: GetHostedZoneLimitInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = GetHostedZoneLimitInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension GetHostedZoneLimitInput { static func urlPathProvider(_ value: GetHostedZoneLimitInput) -> Swift.String? { @@ -9131,31 +8831,6 @@ extension ListResourceRecordSetsInput { } } -public struct ListResourceRecordSetsInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "ListResourceRecordSetsInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: ListResourceRecordSetsInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = ListResourceRecordSetsInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension ListResourceRecordSetsInput { static func urlPathProvider(_ value: ListResourceRecordSetsInput) -> Swift.String? { @@ -10181,31 +9856,6 @@ extension ListVPCAssociationAuthorizationsInput { } } -public struct ListVPCAssociationAuthorizationsInputStripHostedZoneMiddleware: ClientRuntime.Middleware { - public let id: Swift.String = "ListVPCAssociationAuthorizationsInputStripHostedZoneMiddleware" - - public func handle(context: Context, - input: ListVPCAssociationAuthorizationsInput, - next: H) async throws -> ClientRuntime.OperationOutput - where H: Handler, - Self.MInput == H.Input, - Self.MOutput == H.Output, - Self.Context == H.Context - { - guard let hostedZoneId = input.hostedZoneId else { - return try await next.handle(context: context, input: input) - } - var copiedInput = input - let stripped = hostedZoneId.stripFirstMatching(prefixes: ["/hostedzone/", "hostedzone/", "/hostedzone", "hostedzone"]) - copiedInput.hostedZoneId = stripped - return try await next.handle(context: context, input: copiedInput) - } - - public typealias MInput = ListVPCAssociationAuthorizationsInput - public typealias MOutput = ClientRuntime.OperationOutput - public typealias Context = ClientRuntime.HttpContext -} - extension ListVPCAssociationAuthorizationsInput { static func urlPathProvider(_ value: ListVPCAssociationAuthorizationsInput) -> Swift.String? { diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/Route53TrimHostedZone.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/Route53TrimHostedZone.kt index a7297795d68..f3e90fbd33b 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/Route53TrimHostedZone.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/Route53TrimHostedZone.kt @@ -20,6 +20,7 @@ class Route53TrimHostedZone : SwiftIntegration { override fun enabledForService(model: Model, settings: SwiftSettings): Boolean { return model.expectShape(settings.service).isRoute53 } + override fun preprocessModel(model: Model, settings: SwiftSettings): Model { return ModelTransformer.create().mapShapes(model) { if (isHostId(it)) { @@ -38,12 +39,11 @@ class Route53TrimHostedZone : SwiftIntegration { val inputShape = MiddlewareShapeUtils.inputShape(ctx.model, operationShape) val hostedZoneMember = inputShape.members().find { it.hasTrait() } if (hostedZoneMember != null) { - StripHostedZoneURLPathMiddleware.renderMiddleware(ctx, operationShape) - operationMiddleware.prependMiddleware(operationShape, StripHostedZoneUrlPathMiddlewareRenderable(ctx.model, ctx.symbolProvider)) + operationMiddleware.prependMiddleware(operationShape, TrimHostedZoneURLPathMiddlewareRenderable(ctx.model, ctx.symbolProvider)) } } private fun isHostId(shape: Shape): Boolean { - return (shape is MemberShape && shape.target == ShapeId.from("com.amazonaws.route53#ResourceId")) && shape.hasTrait() && shape.memberName == "HostedZoneId" + return (shape is MemberShape && shape.target == ShapeId.from("com.amazonaws.route53#ResourceId")) && shape.hasTrait() } } diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/StripHostedZoneURLPathMiddleware.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/StripHostedZoneURLPathMiddleware.kt deleted file mode 100644 index 26b54275872..00000000000 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/StripHostedZoneURLPathMiddleware.kt +++ /dev/null @@ -1,55 +0,0 @@ -package software.amazon.smithy.aws.swift.codegen.customization.route53 - -import software.amazon.smithy.codegen.core.Symbol -import software.amazon.smithy.model.shapes.OperationShape -import software.amazon.smithy.swift.codegen.Middleware -import software.amazon.smithy.swift.codegen.MiddlewareGenerator -import software.amazon.smithy.swift.codegen.SwiftDependency -import software.amazon.smithy.swift.codegen.SwiftWriter -import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator -import software.amazon.smithy.swift.codegen.integration.middlewares.handlers.MiddlewareShapeUtils -import software.amazon.smithy.swift.codegen.integration.steps.OperationInitializeStep - -class StripHostedZoneURLPathMiddleware( - inputSymbol: Symbol, - outputSymbol: Symbol, - outputErrorSymbol: Symbol, - private val writer: SwiftWriter -) : Middleware(writer, inputSymbol, OperationInitializeStep(inputSymbol, outputSymbol, outputErrorSymbol)) { - - override val typeName = "${inputSymbol.name}StripHostedZoneMiddleware" - - companion object { - fun renderMiddleware(ctx: ProtocolGenerator.GenerationContext, op: OperationShape) { - val inputSymbol = MiddlewareShapeUtils.inputSymbol(ctx.symbolProvider, ctx.model, op) - val outputSymbol = MiddlewareShapeUtils.outputSymbol(ctx.symbolProvider, ctx.model, op) - val outputErrorSymbol = MiddlewareShapeUtils.outputErrorSymbol(op) - val rootNamespace = MiddlewareShapeUtils.rootNamespace(ctx.settings) - val urlPathMiddlewareSymbol = Symbol.builder() - .definitionFile("./$rootNamespace/models/${inputSymbol.name}+StripHostedZone.swift") - .name(inputSymbol.name) - .build() - ctx.delegator.useShapeWriter(urlPathMiddlewareSymbol) { writer -> - writer.addImport(SwiftDependency.CLIENT_RUNTIME.target) - val urlPathMiddleware = StripHostedZoneURLPathMiddleware(inputSymbol, outputSymbol, outputErrorSymbol, writer) - MiddlewareGenerator(writer, urlPathMiddleware).generate() - } - } - } - override fun generateInit() { - // No-op - } - - override fun generateMiddlewareClosure() { - writer.openBlock("guard let hostedZoneId = input.hostedZoneId else {", "}") { - writer.write("return try await next.handle(context: context, input: input)") - } - writer.write("var copiedInput = input") - writer.write("let stripped = hostedZoneId.stripFirstMatching(prefixes: [\"/hostedzone/\", \"hostedzone/\", \"/hostedzone\", \"hostedzone\"])") - writer.write("copiedInput.hostedZoneId = stripped") - } - - override fun renderReturn() { - writer.write("return try await next.handle(context: context, input: copiedInput)") - } -} diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/StripHostedZoneUrlPathMiddlewareRenderable.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/TrimHostedZoneURLPathMiddlewareRenderable.kt similarity index 53% rename from codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/StripHostedZoneUrlPathMiddlewareRenderable.kt rename to codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/TrimHostedZoneURLPathMiddlewareRenderable.kt index 74f8dbadb76..deac7933cf9 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/StripHostedZoneUrlPathMiddlewareRenderable.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/TrimHostedZoneURLPathMiddlewareRenderable.kt @@ -3,25 +3,35 @@ package software.amazon.smithy.aws.swift.codegen.customization.route53 import software.amazon.smithy.codegen.core.SymbolProvider import software.amazon.smithy.model.Model import software.amazon.smithy.model.shapes.OperationShape +import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.swift.codegen.SwiftWriter import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator -import software.amazon.smithy.swift.codegen.integration.middlewares.handlers.MiddlewareShapeUtils import software.amazon.smithy.swift.codegen.middleware.MiddlewarePosition import software.amazon.smithy.swift.codegen.middleware.MiddlewareRenderable import software.amazon.smithy.swift.codegen.middleware.MiddlewareStep +import software.amazon.smithy.swift.codegen.model.expectShape +import software.amazon.smithy.swift.codegen.model.hasTrait -class StripHostedZoneUrlPathMiddlewareRenderable( +class TrimHostedZoneURLPathMiddlewareRenderable( val model: Model, val symbolProvider: SymbolProvider ) : MiddlewareRenderable { - override val name = "StripHostedZoneUrlPathMiddleware" + override val name = "Route53TrimHostedZoneMiddleware" override val middlewareStep = MiddlewareStep.INITIALIZESTEP override val position = MiddlewarePosition.AFTER override fun render(ctx: ProtocolGenerator.GenerationContext, writer: SwiftWriter, op: OperationShape, operationStackName: String) { - val inputShapeName = MiddlewareShapeUtils.inputSymbol(symbolProvider, model, op).name - writer.write("$operationStackName.${middlewareStep.stringValue()}.intercept(position: ${position.stringValue()}, middleware: ${inputShapeName}StripHostedZoneMiddleware())") + val inputShape = model.expectShape(op.inputShape) + val hostedZoneIDMember = inputShape.members().first { it.hasTrait() } + val hostedZoneIDKeyPath = ctx.symbolProvider.toMemberName(hostedZoneIDMember) + writer.write( + "\$L.\$L.intercept(position: \$L, middleware: Route53TrimHostedZoneMiddleware(\\.\$L))", + operationStackName, + middlewareStep.stringValue(), + position.stringValue(), + hostedZoneIDKeyPath, + ) } }