Skip to content

Commit

Permalink
Merge pull request #851 from aws/r53cust-fix
Browse files Browse the repository at this point in the history
route53: codegen fix to correctly look for operations that need sanitize url
  • Loading branch information
skotambkar authored Oct 23, 2020
2 parents 4e3fc08 + cc57f65 commit cb36c8d
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -143,12 +145,17 @@ private static boolean supportsHostedZoneIDValue(Model model, ServiceShape servi
}

StructureShape input = model.expectShape(operation.getInput().get(), StructureShape.class);
Optional<MemberShape> targetMember = input.getAllMembers().values().stream().findFirst().filter(
List<MemberShape> 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
Expand Down
1 change: 1 addition & 0 deletions service/route53/api_op_ChangeResourceRecordSets.go

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

1 change: 1 addition & 0 deletions service/route53/api_op_CreateHostedZone.go

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

1 change: 1 addition & 0 deletions service/route53/api_op_CreateQueryLoggingConfig.go

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

1 change: 1 addition & 0 deletions service/route53/api_op_CreateTrafficPolicyInstance.go

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

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

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

1 change: 1 addition & 0 deletions service/route53/api_op_DisassociateVPCFromHostedZone.go

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

1 change: 1 addition & 0 deletions service/route53/api_op_ListHostedZonesByName.go

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

1 change: 1 addition & 0 deletions service/route53/api_op_ListTrafficPolicyInstances.go

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

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

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

1 change: 1 addition & 0 deletions service/route53/api_op_ListVPCAssociationAuthorizations.go

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

1 change: 1 addition & 0 deletions service/route53/api_op_TestDNSAnswer.go

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

2 changes: 1 addition & 1 deletion service/route53/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down

0 comments on commit cb36c8d

Please sign in to comment.