From b082d113c94183018bd8b88cd04f22f5a1f67a57 Mon Sep 17 00:00:00 2001 From: skotambkar Date: Fri, 23 Oct 2020 10:54:56 -0700 Subject: [PATCH 1/2] fix codegen for route53 customization --- .../customization/Route53Customizations.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/Route53Customizations.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/Route53Customizations.java index e59ccbe0cf4..82aa2e2be34 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/Route53Customizations.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/Route53Customizations.java @@ -3,7 +3,9 @@ import java.util.List; import java.util.Optional; import java.util.stream.Collectors; +import java.util.stream.Stream; import software.amazon.smithy.aws.traits.ServiceTrait; +import software.amazon.smithy.codegen.core.CodegenException; import software.amazon.smithy.codegen.core.SymbolProvider; import software.amazon.smithy.go.codegen.GoDelegator; import software.amazon.smithy.go.codegen.GoSettings; @@ -143,12 +145,17 @@ private static boolean supportsHostedZoneIDValue(Model model, ServiceShape servi } StructureShape input = model.expectShape(operation.getInput().get(), StructureShape.class); - Optional targetMember = input.getAllMembers().values().stream().findFirst().filter( + List targetMembers = input.getAllMembers().values().stream().filter( memberShape -> memberShape.getTarget().getName().equalsIgnoreCase("ResourceId") || memberShape.getTarget().getName().equalsIgnoreCase("DelegationSetId") - ); + ).collect(Collectors.toList()); + + if (targetMembers.size() >1 ){ + throw new CodegenException(String.format("Route53 service has ResourceId, DelegationSetId members " + + "modeled on %s shape", input.getId().getName())); + } - return targetMember.isPresent(); + return targetMembers.size() != 0; } // returns true if service is route53 From cc57f65e84b15dd0eec44f07fb4f95dff656345f Mon Sep 17 00:00:00 2001 From: skotambkar Date: Fri, 23 Oct 2020 11:04:19 -0700 Subject: [PATCH 2/2] regenerated route53 client --- service/route53/api_op_ChangeResourceRecordSets.go | 1 + service/route53/api_op_CreateHostedZone.go | 1 + service/route53/api_op_CreateQueryLoggingConfig.go | 1 + service/route53/api_op_CreateTrafficPolicyInstance.go | 1 + service/route53/api_op_CreateVPCAssociationAuthorization.go | 1 + service/route53/api_op_DeleteVPCAssociationAuthorization.go | 1 + service/route53/api_op_DisassociateVPCFromHostedZone.go | 1 + service/route53/api_op_ListHostedZonesByName.go | 1 + service/route53/api_op_ListTrafficPolicyInstances.go | 1 + .../route53/api_op_ListTrafficPolicyInstancesByHostedZone.go | 1 + service/route53/api_op_ListTrafficPolicyInstancesByPolicy.go | 1 + service/route53/api_op_ListVPCAssociationAuthorizations.go | 1 + service/route53/api_op_TestDNSAnswer.go | 1 + service/route53/go.mod | 2 +- 14 files changed, 14 insertions(+), 1 deletion(-) diff --git a/service/route53/api_op_ChangeResourceRecordSets.go b/service/route53/api_op_ChangeResourceRecordSets.go index 3184b4197c1..ffafcccb07f 100644 --- a/service/route53/api_op_ChangeResourceRecordSets.go +++ b/service/route53/api_op_ChangeResourceRecordSets.go @@ -142,6 +142,7 @@ func addOperationChangeResourceRecordSetsMiddlewares(stack *middleware.Stack, op addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) route53cust.HandleCustomErrorDeserialization(stack) + addSanitizeURLMiddleware(stack) return nil } diff --git a/service/route53/api_op_CreateHostedZone.go b/service/route53/api_op_CreateHostedZone.go index 1a2cad5697c..64eb67a55a2 100644 --- a/service/route53/api_op_CreateHostedZone.go +++ b/service/route53/api_op_CreateHostedZone.go @@ -169,6 +169,7 @@ func addOperationCreateHostedZoneMiddlewares(stack *middleware.Stack, options Op stack.Initialize.Add(newServiceMetadataMiddleware_opCreateHostedZone(options.Region), middleware.Before) addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) + addSanitizeURLMiddleware(stack) return nil } diff --git a/service/route53/api_op_CreateQueryLoggingConfig.go b/service/route53/api_op_CreateQueryLoggingConfig.go index c647e21e2f0..6bbc44668a7 100644 --- a/service/route53/api_op_CreateQueryLoggingConfig.go +++ b/service/route53/api_op_CreateQueryLoggingConfig.go @@ -178,6 +178,7 @@ func addOperationCreateQueryLoggingConfigMiddlewares(stack *middleware.Stack, op stack.Initialize.Add(newServiceMetadataMiddleware_opCreateQueryLoggingConfig(options.Region), middleware.Before) addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) + addSanitizeURLMiddleware(stack) return nil } diff --git a/service/route53/api_op_CreateTrafficPolicyInstance.go b/service/route53/api_op_CreateTrafficPolicyInstance.go index acf99b1eab9..87d62ea4bcf 100644 --- a/service/route53/api_op_CreateTrafficPolicyInstance.go +++ b/service/route53/api_op_CreateTrafficPolicyInstance.go @@ -109,6 +109,7 @@ func addOperationCreateTrafficPolicyInstanceMiddlewares(stack *middleware.Stack, stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTrafficPolicyInstance(options.Region), middleware.Before) addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) + addSanitizeURLMiddleware(stack) return nil } diff --git a/service/route53/api_op_CreateVPCAssociationAuthorization.go b/service/route53/api_op_CreateVPCAssociationAuthorization.go index 8184f2760c7..192fcdb0b77 100644 --- a/service/route53/api_op_CreateVPCAssociationAuthorization.go +++ b/service/route53/api_op_CreateVPCAssociationAuthorization.go @@ -94,6 +94,7 @@ func addOperationCreateVPCAssociationAuthorizationMiddlewares(stack *middleware. stack.Initialize.Add(newServiceMetadataMiddleware_opCreateVPCAssociationAuthorization(options.Region), middleware.Before) addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) + addSanitizeURLMiddleware(stack) return nil } diff --git a/service/route53/api_op_DeleteVPCAssociationAuthorization.go b/service/route53/api_op_DeleteVPCAssociationAuthorization.go index 9a823668bc1..93ba5ce03c4 100644 --- a/service/route53/api_op_DeleteVPCAssociationAuthorization.go +++ b/service/route53/api_op_DeleteVPCAssociationAuthorization.go @@ -84,6 +84,7 @@ func addOperationDeleteVPCAssociationAuthorizationMiddlewares(stack *middleware. stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteVPCAssociationAuthorization(options.Region), middleware.Before) addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) + addSanitizeURLMiddleware(stack) return nil } diff --git a/service/route53/api_op_DisassociateVPCFromHostedZone.go b/service/route53/api_op_DisassociateVPCFromHostedZone.go index a8468fa12a8..866395642b5 100644 --- a/service/route53/api_op_DisassociateVPCFromHostedZone.go +++ b/service/route53/api_op_DisassociateVPCFromHostedZone.go @@ -105,6 +105,7 @@ func addOperationDisassociateVPCFromHostedZoneMiddlewares(stack *middleware.Stac stack.Initialize.Add(newServiceMetadataMiddleware_opDisassociateVPCFromHostedZone(options.Region), middleware.Before) addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) + addSanitizeURLMiddleware(stack) return nil } diff --git a/service/route53/api_op_ListHostedZonesByName.go b/service/route53/api_op_ListHostedZonesByName.go index 9e9bf244630..38e897596ed 100644 --- a/service/route53/api_op_ListHostedZonesByName.go +++ b/service/route53/api_op_ListHostedZonesByName.go @@ -165,6 +165,7 @@ func addOperationListHostedZonesByNameMiddlewares(stack *middleware.Stack, optio stack.Initialize.Add(newServiceMetadataMiddleware_opListHostedZonesByName(options.Region), middleware.Before) addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) + addSanitizeURLMiddleware(stack) return nil } diff --git a/service/route53/api_op_ListTrafficPolicyInstances.go b/service/route53/api_op_ListTrafficPolicyInstances.go index ff89f7ea94b..426531ffc27 100644 --- a/service/route53/api_op_ListTrafficPolicyInstances.go +++ b/service/route53/api_op_ListTrafficPolicyInstances.go @@ -140,6 +140,7 @@ func addOperationListTrafficPolicyInstancesMiddlewares(stack *middleware.Stack, stack.Initialize.Add(newServiceMetadataMiddleware_opListTrafficPolicyInstances(options.Region), middleware.Before) addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) + addSanitizeURLMiddleware(stack) return nil } diff --git a/service/route53/api_op_ListTrafficPolicyInstancesByHostedZone.go b/service/route53/api_op_ListTrafficPolicyInstancesByHostedZone.go index 9d74f98f562..32b7d26bc3f 100644 --- a/service/route53/api_op_ListTrafficPolicyInstancesByHostedZone.go +++ b/service/route53/api_op_ListTrafficPolicyInstancesByHostedZone.go @@ -132,6 +132,7 @@ func addOperationListTrafficPolicyInstancesByHostedZoneMiddlewares(stack *middle stack.Initialize.Add(newServiceMetadataMiddleware_opListTrafficPolicyInstancesByHostedZone(options.Region), middleware.Before) addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) + addSanitizeURLMiddleware(stack) return nil } diff --git a/service/route53/api_op_ListTrafficPolicyInstancesByPolicy.go b/service/route53/api_op_ListTrafficPolicyInstancesByPolicy.go index 40956676e45..457a9088d6f 100644 --- a/service/route53/api_op_ListTrafficPolicyInstancesByPolicy.go +++ b/service/route53/api_op_ListTrafficPolicyInstancesByPolicy.go @@ -154,6 +154,7 @@ func addOperationListTrafficPolicyInstancesByPolicyMiddlewares(stack *middleware stack.Initialize.Add(newServiceMetadataMiddleware_opListTrafficPolicyInstancesByPolicy(options.Region), middleware.Before) addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) + addSanitizeURLMiddleware(stack) return nil } diff --git a/service/route53/api_op_ListVPCAssociationAuthorizations.go b/service/route53/api_op_ListVPCAssociationAuthorizations.go index e46d78090d0..50d5076ac7e 100644 --- a/service/route53/api_op_ListVPCAssociationAuthorizations.go +++ b/service/route53/api_op_ListVPCAssociationAuthorizations.go @@ -101,6 +101,7 @@ func addOperationListVPCAssociationAuthorizationsMiddlewares(stack *middleware.S stack.Initialize.Add(newServiceMetadataMiddleware_opListVPCAssociationAuthorizations(options.Region), middleware.Before) addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) + addSanitizeURLMiddleware(stack) return nil } diff --git a/service/route53/api_op_TestDNSAnswer.go b/service/route53/api_op_TestDNSAnswer.go index ff673a5bbc7..5f6cb9b840a 100644 --- a/service/route53/api_op_TestDNSAnswer.go +++ b/service/route53/api_op_TestDNSAnswer.go @@ -142,6 +142,7 @@ func addOperationTestDNSAnswerMiddlewares(stack *middleware.Stack, options Optio stack.Initialize.Add(newServiceMetadataMiddleware_opTestDNSAnswer(options.Region), middleware.Before) addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) + addSanitizeURLMiddleware(stack) return nil } diff --git a/service/route53/go.mod b/service/route53/go.mod index a4e8abfae92..014b08538b0 100644 --- a/service/route53/go.mod +++ b/service/route53/go.mod @@ -3,7 +3,7 @@ module github.com/aws/aws-sdk-go-v2/service/route53 go 1.15 require ( - github.com/aws/aws-sdk-go-v2 v0.27.1-0.20201021211102-ffda7ace423e + github.com/aws/aws-sdk-go-v2 v0.27.1-0.20201022222834-4451b4af620e github.com/awslabs/smithy-go v0.2.0 )