diff --git a/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/DualStackOnlyEndpointsTrait.java b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/DualStackOnlyEndpointsTrait.java new file mode 100644 index 00000000000..36b3bf28f27 --- /dev/null +++ b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/DualStackOnlyEndpointsTrait.java @@ -0,0 +1,33 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +package software.amazon.smithy.rulesengine.aws.language.functions.endpoints; + +import software.amazon.smithy.model.node.Node; +import software.amazon.smithy.model.node.ObjectNode; +import software.amazon.smithy.model.shapes.ShapeId; +import software.amazon.smithy.model.traits.AnnotationTrait; + +/** + * An endpoints modifier trait that indicates that a service has only dual stack endpoints, + * does not support IPV4 only endpoints, and should not have the useDualStackEndpoint endpoint parameter. + */ +public class DualStackOnlyEndpointsTrait extends AnnotationTrait { + public static final ShapeId ID = ShapeId.from("aws.endpoints#dualStackOnlyEndpoints"); + + public DualStackOnlyEndpointsTrait(ObjectNode node) { + super(ID, node); + } + + public DualStackOnlyEndpointsTrait() { + this(Node.objectNode()); + } + + public static final class Provider extends AnnotationTrait.Provider { + public Provider() { + super(ID, DualStackOnlyEndpointsTrait::new); + } + } +} diff --git a/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/EndpointModifierTrait.java b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/EndpointModifierTrait.java new file mode 100644 index 00000000000..fffbc04db1e --- /dev/null +++ b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/EndpointModifierTrait.java @@ -0,0 +1,35 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +package software.amazon.smithy.rulesengine.aws.language.functions.endpoints; + +import software.amazon.smithy.model.node.Node; +import software.amazon.smithy.model.node.ObjectNode; +import software.amazon.smithy.model.shapes.ShapeId; +import software.amazon.smithy.model.traits.AnnotationTrait; + +/** + * meta-trait that marks a trait as an endpoint modifier. + * + * Traits that are marked with this trait are applied to service shapes or operation shapes to + * indicate how a client can resolve endpoints for that service or operation. + */ +public class EndpointModifierTrait extends AnnotationTrait { + public static final ShapeId ID = ShapeId.from("aws.endpoints#endpointsModifier"); + + public EndpointModifierTrait(ObjectNode node) { + super(ID, node); + } + + public EndpointModifierTrait() { + this(Node.objectNode()); + } + + public static final class Provider extends AnnotationTrait.Provider { + public Provider() { + super(ID, EndpointModifierTrait::new); + } + } +} diff --git a/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/EndpointPatternType.java b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/EndpointPatternType.java new file mode 100644 index 00000000000..cc5d9b446e9 --- /dev/null +++ b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/EndpointPatternType.java @@ -0,0 +1,39 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +package software.amazon.smithy.rulesengine.aws.language.functions.endpoints; + +import software.amazon.smithy.model.node.Node; +import software.amazon.smithy.model.node.StringNode; + +/** + * The pattern type to use for the partition endpoint. + */ +public enum EndpointPatternType { + + SERVICE_DNSSUFFIX("service_dnsSuffix"), + SERVICE_REGION_DNSSUFFI("service_region_dnsSuffix"); + + private final String name; + + EndpointPatternType(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public static EndpointPatternType fromNode(Node node) { + StringNode value = node.expectStringNode(); + for (EndpointPatternType type: EndpointPatternType.values()) { + if (type.name.equals(value.getValue())) { + return type; + } + } + throw new RuntimeException(String.format( + "Unable to find EndpointPatternType enum with value [%s]", value.getValue())); + } +} diff --git a/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/PartitionEndpointSpecialCase.java b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/PartitionEndpointSpecialCase.java new file mode 100644 index 00000000000..10bd86f0537 --- /dev/null +++ b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/PartitionEndpointSpecialCase.java @@ -0,0 +1,136 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +package software.amazon.smithy.rulesengine.aws.language.functions.endpoints; + +import java.util.Objects; +import software.amazon.smithy.model.FromSourceLocation; +import software.amazon.smithy.model.SourceLocation; +import software.amazon.smithy.model.node.Node; +import software.amazon.smithy.model.node.ObjectNode; +import software.amazon.smithy.model.node.ToNode; +import software.amazon.smithy.utils.SmithyBuilder; +import software.amazon.smithy.utils.ToSmithyBuilder; + +/** + * A special case that do not follow the services standard patterns + * or are located in a region other than the partition's defaultGlobalRegion. + */ +public final class PartitionEndpointSpecialCase + implements FromSourceLocation, ToNode, ToSmithyBuilder { + + private static final String ENDPOINT = "endpoint"; + private static final String REGION = "region"; + private static final String DUAL_STACK = "dualStack"; + private static final String FIPS = "fips"; + private final String endpoint; + private final String region; + private final Boolean dualStack; + private final Boolean fips; + private final SourceLocation sourceLocation; + + private PartitionEndpointSpecialCase(Builder builder) { + this.endpoint = builder.endpoint; + this.region = builder.region; + this.dualStack = builder.dualStack; + this.fips = builder.fips; + this.sourceLocation = Objects.requireNonNull(builder.sourceLocation); + } + + @Override + public Node toNode() { + return Node.objectNodeBuilder() + .withMember(ENDPOINT, endpoint) + .withMember(REGION, region) + .withMember(DUAL_STACK, dualStack.toString()) + .withMember(FIPS, fips.toString()) + .build(); + } + + @Override + public SmithyBuilder toBuilder() { + return new Builder() + .endpoint(endpoint) + .region(region) + .dualStack(dualStack) + .fips(fips) + .sourceLocation(sourceLocation); + } + + @Override + public SourceLocation getSourceLocation() { + return FromSourceLocation.super.getSourceLocation(); + } + + public static PartitionEndpointSpecialCase fromNode(Node node) { + ObjectNode objectNode = node.expectObjectNode(); + return builder() + .sourceLocation(objectNode.getSourceLocation()) + .endpoint(objectNode.expectStringMember(ENDPOINT).getValue()) + .region(objectNode.expectStringMember(REGION).getValue()) + .dualStack(objectNode.getBooleanMemberOrDefault(DUAL_STACK, null)) + .fips(objectNode.getBooleanMemberOrDefault(FIPS, null)) + .build(); + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder implements SmithyBuilder { + private String endpoint; + private String region; + private Boolean dualStack; + private Boolean fips; + private SourceLocation sourceLocation = SourceLocation.none(); + + @Override + public PartitionEndpointSpecialCase build() { + return new PartitionEndpointSpecialCase(this); + } + + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + public Builder region(String region) { + this.region = region; + return this; + } + + public Builder dualStack(Boolean dualStack) { + this.dualStack = dualStack; + return this; + } + + public Builder fips(Boolean fips) { + this.fips = fips; + return this; + } + + Builder sourceLocation(SourceLocation sourceLocation) { + this.sourceLocation = sourceLocation; + return this; + } + + } + + public String getEndpoint() { + return endpoint; + } + + public Boolean getDualStack() { + return dualStack; + } + + public Boolean getFips() { + return fips; + } + + public String getRegion() { + return region; + } +} diff --git a/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/PartitionSpecialCase.java b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/PartitionSpecialCase.java new file mode 100644 index 00000000000..a6a8a900997 --- /dev/null +++ b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/PartitionSpecialCase.java @@ -0,0 +1,118 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +package software.amazon.smithy.rulesengine.aws.language.functions.endpoints; + +import java.util.Objects; +import software.amazon.smithy.model.FromSourceLocation; +import software.amazon.smithy.model.SourceLocation; +import software.amazon.smithy.model.node.Node; +import software.amazon.smithy.model.node.ObjectNode; +import software.amazon.smithy.model.node.ToNode; +import software.amazon.smithy.utils.SmithyBuilder; +import software.amazon.smithy.utils.ToSmithyBuilder; + +/** + * A special case where endpoints for a partition that do not follow the standard patterns. + */ +public final class PartitionSpecialCase implements FromSourceLocation, ToNode, ToSmithyBuilder { + + private static final String ENDPOINT = "endpoint"; + private static final String DUAL_STACK = "dualStack"; + private static final String FIPS = "fips"; + private final String endpoint; + private final Boolean dualStack; + private final Boolean fips; + private final SourceLocation sourceLocation; + + private PartitionSpecialCase(Builder builder) { + this.endpoint = builder.endpoint; + this.dualStack = builder.dualStack; + this.fips = builder.fips; + this.sourceLocation = Objects.requireNonNull(builder.sourceLocation); + } + + public String getEndpoint() { + return endpoint; + } + + public Boolean getDualStack() { + return dualStack; + } + + public Boolean getFips() { + return fips; + } + + @Override + public Node toNode() { + return Node.objectNodeBuilder() + .withMember(ENDPOINT, endpoint) + .withMember(DUAL_STACK, dualStack.toString()) + .withMember(FIPS, fips.toString()) + .build(); + } + + @Override + public SmithyBuilder toBuilder() { + return new Builder() + .dualStack(dualStack) + .endpoint(endpoint) + .fips(fips) + .sourceLocation(sourceLocation); + } + + @Override + public SourceLocation getSourceLocation() { + return FromSourceLocation.super.getSourceLocation(); + } + + public static PartitionSpecialCase fromNode(Node node) { + ObjectNode objectNode = node.expectObjectNode(); + return builder() + .sourceLocation(objectNode.getSourceLocation()) + .endpoint(objectNode.expectStringMember(ENDPOINT).getValue()) + .dualStack(objectNode.getBooleanMemberOrDefault(DUAL_STACK, null)) + .fips(objectNode.getBooleanMemberOrDefault(FIPS, null)) + .build(); + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder implements SmithyBuilder { + private String endpoint; + private Boolean dualStack; + private Boolean fips; + private SourceLocation sourceLocation = SourceLocation.none(); + + @Override + public PartitionSpecialCase build() { + return new PartitionSpecialCase(this); + } + + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + public Builder dualStack(Boolean dualStack) { + this.dualStack = dualStack; + return this; + } + + public Builder fips(Boolean fips) { + this.fips = fips; + return this; + } + + Builder sourceLocation(SourceLocation sourceLocation) { + this.sourceLocation = sourceLocation; + return this; + } + + } +} diff --git a/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/RegionSpecialCase.java b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/RegionSpecialCase.java new file mode 100644 index 00000000000..19b1cbd5dce --- /dev/null +++ b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/RegionSpecialCase.java @@ -0,0 +1,133 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +package software.amazon.smithy.rulesengine.aws.language.functions.endpoints; + +import java.util.Objects; +import software.amazon.smithy.model.FromSourceLocation; +import software.amazon.smithy.model.SourceLocation; +import software.amazon.smithy.model.node.Node; +import software.amazon.smithy.model.node.ObjectNode; +import software.amazon.smithy.model.node.ToNode; +import software.amazon.smithy.utils.SmithyBuilder; +import software.amazon.smithy.utils.ToSmithyBuilder; + +/** + * A special case where endpoints for a region that do not follow the standard patterns. + */ +public final class RegionSpecialCase implements FromSourceLocation, ToNode, ToSmithyBuilder { + private static final String ENDPOINT = "endpoint"; + private static final String DUAL_STACK = "dualStack"; + private static final String FIPS = "fips"; + private static final String SIGNING_REGION = "signingRegion"; + private final String endpoint; + private final Boolean dualStack; + private final Boolean fips; + private final String signingRegion; + private final SourceLocation sourceLocation; + + private RegionSpecialCase(Builder builder) { + this.endpoint = builder.endpoint; + this.dualStack = builder.dualStack; + this.fips = builder.fips; + this.signingRegion = builder.signingRegion; + this.sourceLocation = Objects.requireNonNull(builder.sourceLocation); + } + + public String getEndpoint() { + return endpoint; + } + + public Boolean getDualStack() { + return dualStack; + } + + public Boolean getFips() { + return fips; + } + + public String getSigningRegion() { + return signingRegion; + } + + @Override + public Node toNode() { + return Node.objectNodeBuilder() + .withMember(ENDPOINT, endpoint) + .withMember(DUAL_STACK, dualStack.toString()) + .withMember(FIPS, fips.toString()) + .withMember(SIGNING_REGION, signingRegion) + .build(); + } + + @Override + public SmithyBuilder toBuilder() { + return new Builder() + .dualStack(dualStack) + .endpoint(endpoint) + .fips(fips) + .signingRegion(signingRegion) + .sourceLocation(sourceLocation); + } + + @Override + public SourceLocation getSourceLocation() { + return FromSourceLocation.super.getSourceLocation(); + } + + public static RegionSpecialCase fromNode(Node node) { + ObjectNode objectNode = node.expectObjectNode(); + return builder() + .sourceLocation(objectNode.getSourceLocation()) + .endpoint(objectNode.expectStringMember(ENDPOINT).getValue()) + .dualStack(objectNode.getBooleanMemberOrDefault(DUAL_STACK, null)) + .fips(objectNode.getBooleanMemberOrDefault(FIPS, null)) + .signingRegion(objectNode.getStringMemberOrDefault(SIGNING_REGION, null)) + .build(); + } + + public static Builder builder() { + return new RegionSpecialCase.Builder(); + } + + public static final class Builder implements SmithyBuilder { + private String endpoint; + private Boolean dualStack; + private Boolean fips; + private String signingRegion; + private SourceLocation sourceLocation = SourceLocation.none(); + + @Override + public RegionSpecialCase build() { + return new RegionSpecialCase(this); + } + + public Builder endpoint(String endpoint) { + this.endpoint = Objects.requireNonNull(endpoint); + return this; + } + + public Builder dualStack(Boolean dualStack) { + this.dualStack = dualStack; + return this; + } + + public Builder fips(Boolean fips) { + this.fips = fips; + return this; + } + + public Builder signingRegion(String signingRegion) { + this.signingRegion = signingRegion; + return this; + } + + public Builder sourceLocation(SourceLocation sourceLocation) { + this.sourceLocation = sourceLocation; + return this; + } + + } +} diff --git a/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/RuleBasedEndpointsTrait.java b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/RuleBasedEndpointsTrait.java new file mode 100644 index 00000000000..75c2a18d3cb --- /dev/null +++ b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/RuleBasedEndpointsTrait.java @@ -0,0 +1,32 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +package software.amazon.smithy.rulesengine.aws.language.functions.endpoints; + +import software.amazon.smithy.model.node.Node; +import software.amazon.smithy.model.node.ObjectNode; +import software.amazon.smithy.model.shapes.ShapeId; +import software.amazon.smithy.model.traits.AnnotationTrait; + +/** + * Marks that a services has only dualStack endpoints. + */ +public class RuleBasedEndpointsTrait extends AnnotationTrait { + public static final ShapeId ID = ShapeId.from("aws.endpoints#rulesBasedEndpoints"); + + public RuleBasedEndpointsTrait(ObjectNode node) { + super(ID, node); + } + + public RuleBasedEndpointsTrait() { + this(Node.objectNode()); + } + + public static final class Provider extends AnnotationTrait.Provider { + public Provider() { + super(ID, RuleBasedEndpointsTrait::new); + } + } +} diff --git a/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/StandardPartitionalEndpointsTrait.java b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/StandardPartitionalEndpointsTrait.java new file mode 100644 index 00000000000..1f3b1987ddc --- /dev/null +++ b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/StandardPartitionalEndpointsTrait.java @@ -0,0 +1,148 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +package software.amazon.smithy.rulesengine.aws.language.functions.endpoints; + +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import software.amazon.smithy.model.node.Node; +import software.amazon.smithy.model.node.ObjectNode; +import software.amazon.smithy.model.shapes.ShapeId; +import software.amazon.smithy.model.traits.AbstractTrait; +import software.amazon.smithy.model.traits.AbstractTraitBuilder; +import software.amazon.smithy.model.traits.Trait; +import software.amazon.smithy.utils.BuilderRef; +import software.amazon.smithy.utils.ListUtils; +import software.amazon.smithy.utils.SmithyBuilder; +import software.amazon.smithy.utils.ToSmithyBuilder; + +/** + * An endpoints modifier trait that indicates that a service is partitional + * and a single endpoint should resolve per partition. + */ +public class StandardPartitionalEndpointsTrait extends AbstractTrait + implements ToSmithyBuilder { + public static final ShapeId ID = ShapeId.from("aws.endpoints#standardPartitionalEndpoints"); + public static final String PARTITION_ENDPOINT_SPECIAL_CASES = "partitionEndpointSpecialCases"; + public static final String ENDPOINT_PATTERN_TYPE = "endpointPatternType"; + + private final Map> partitionEndpointSpecialCases; + + private final EndpointPatternType endpointPatternType; + + public StandardPartitionalEndpointsTrait(StandardPartitionalEndpointsTrait.Builder builder) { + super(ID, builder.getSourceLocation()); + partitionEndpointSpecialCases = builder.partitionEndpointSpecialCases.copy(); + endpointPatternType = Objects.requireNonNull(builder.endpointPatternType); + } + + @Override + protected Node createNode() { + final Node partitionEndpointSpecialCasesNode = partitionEndpointSpecialCases.entrySet().stream() + .map(entry -> { + List nodes = new ArrayList<>(); + for (PartitionEndpointSpecialCase partitionEndpointSpecialCase : entry.getValue()) { + nodes.add(partitionEndpointSpecialCase.toNode()); + } + return new AbstractMap.SimpleImmutableEntry<>( + Node.from(entry.getKey()), Node.fromNodes(nodes)); + }) + .collect(ObjectNode.collect(Map.Entry::getKey, Map.Entry::getValue)); + + return ObjectNode.objectNodeBuilder() + .sourceLocation(getSourceLocation()) + .withMember(PARTITION_ENDPOINT_SPECIAL_CASES, partitionEndpointSpecialCasesNode) + .withMember(ENDPOINT_PATTERN_TYPE, endpointPatternType.getName()) + .build(); + } + + @Override + public SmithyBuilder toBuilder() { + return new Builder() + .partitionEndpointSpecialCases(partitionEndpointSpecialCases) + .endpointPatternType(endpointPatternType); + } + + public Map> getPartitionEndpointSpecialCases() { + return partitionEndpointSpecialCases; + } + + public EndpointPatternType getEndpointPatternType() { + return endpointPatternType; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Provider extends AbstractTrait.Provider { + public Provider() { + super(ID); + } + + @Override + public Trait createTrait(ShapeId target, Node value) { + ObjectNode objectNode = value.expectObjectNode(); + + EndpointPatternType endpointPatternType = EndpointPatternType + .fromNode(objectNode.expectStringMember(ENDPOINT_PATTERN_TYPE)); + + StandardPartitionalEndpointsTrait.Builder builder = builder() + .sourceLocation(value) + .endpointPatternType(endpointPatternType); + + objectNode + .getObjectMember(PARTITION_ENDPOINT_SPECIAL_CASES) + .ifPresent(memberNode -> memberNode + .getMembers() + .forEach((key, node) -> { + List partitionEndpointSpecialCases = node.expectArrayNode() + .getElements().stream() + .map(PartitionEndpointSpecialCase::fromNode) + .collect(ListUtils.toUnmodifiableList()); + builder.putPartitionEndpointSpecialCase(key.getValue(), partitionEndpointSpecialCases); + })); + + StandardPartitionalEndpointsTrait result = builder.build(); + result.setNodeCache(value); + return result; + } + } + + public static final class Builder extends AbstractTraitBuilder { + private final BuilderRef>> partitionEndpointSpecialCases = + BuilderRef.forOrderedMap(); + private EndpointPatternType endpointPatternType; + + public Builder partitionEndpointSpecialCases( + Map> partitionEndpointSpecialCases + ) { + this.partitionEndpointSpecialCases.clear(); + this.partitionEndpointSpecialCases.get().putAll(partitionEndpointSpecialCases); + return this; + } + + public Builder putPartitionEndpointSpecialCase( + String name, + List partitionEndpointSpecialCases + ) { + this.partitionEndpointSpecialCases.get().put(name, partitionEndpointSpecialCases); + return this; + } + + public Builder endpointPatternType(EndpointPatternType endpointPatternType) { + this.endpointPatternType = endpointPatternType; + return this; + } + + @Override + public StandardPartitionalEndpointsTrait build() { + return new StandardPartitionalEndpointsTrait(this); + } + } +} diff --git a/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/StandardRegionalEndpointsTrait.java b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/StandardRegionalEndpointsTrait.java new file mode 100644 index 00000000000..44ad681b6db --- /dev/null +++ b/smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/StandardRegionalEndpointsTrait.java @@ -0,0 +1,167 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +package software.amazon.smithy.rulesengine.aws.language.functions.endpoints; + +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import software.amazon.smithy.model.node.Node; +import software.amazon.smithy.model.node.ObjectNode; +import software.amazon.smithy.model.shapes.ShapeId; +import software.amazon.smithy.model.traits.AbstractTrait; +import software.amazon.smithy.model.traits.AbstractTraitBuilder; +import software.amazon.smithy.model.traits.Trait; +import software.amazon.smithy.utils.BuilderRef; +import software.amazon.smithy.utils.ListUtils; +import software.amazon.smithy.utils.SmithyBuilder; +import software.amazon.smithy.utils.ToSmithyBuilder; + +/** + * An endpoints modifier trait that indicates that a service's endpoints should be resolved + * using the standard AWS regional patterns. + */ +public class StandardRegionalEndpointsTrait extends AbstractTrait + implements ToSmithyBuilder { + public static final ShapeId ID = ShapeId.from("aws.endpoints#standardRegionalEndpoints"); + public static final String PARTITION_SPECIAL_CASES = "partitionSpecialCases"; + public static final String REGION_SPECIAL_CASES = "regionSpecialCases"; + + private final Map> partitionSpecialCases; + private final Map> regionSpecialCases; + + public StandardRegionalEndpointsTrait(StandardRegionalEndpointsTrait.Builder builder) { + super(ID, builder.getSourceLocation()); + partitionSpecialCases = builder.partitionSpecialCases.copy(); + regionSpecialCases = builder.regionSpecialCases.copy(); + } + + @Override + protected Node createNode() { + final Node partitionSpecialCasesNode = partitionSpecialCases.entrySet().stream() + .map(entry -> { + List nodes = new ArrayList<>(); + for (PartitionSpecialCase partitionSpecialCase : entry.getValue()) { + nodes.add(partitionSpecialCase.toNode()); + } + return new AbstractMap.SimpleImmutableEntry<>( + Node.from(entry.getKey()), Node.fromNodes(nodes)); + }) + .collect(ObjectNode.collect(Map.Entry::getKey, Map.Entry::getValue)); + + final Node regionSpecialCasesNode = regionSpecialCases.entrySet().stream() + .map(entry -> { + List nodes = new ArrayList<>(); + for (RegionSpecialCase regionSpecialCase : entry.getValue()) { + nodes.add(regionSpecialCase.toNode()); + } + return new AbstractMap.SimpleImmutableEntry<>( + Node.from(entry.getKey()), Node.fromNodes(nodes)); + }) + .collect(ObjectNode.collect(Map.Entry::getKey, Map.Entry::getValue)); + + return ObjectNode.objectNodeBuilder() + .sourceLocation(getSourceLocation()) + .withMember(PARTITION_SPECIAL_CASES, partitionSpecialCasesNode) + .withMember(REGION_SPECIAL_CASES, regionSpecialCasesNode) + .build(); + } + + @Override + public SmithyBuilder toBuilder() { + return new Builder() + .partitionSpecialCases(partitionSpecialCases) + .regionSpecialCases(regionSpecialCases); + } + + public Map> getPartitionSpecialCases() { + return partitionSpecialCases; + } + + public Map> getRegionSpecialCases() { + return regionSpecialCases; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Provider extends AbstractTrait.Provider { + public Provider() { + super(ID); + } + + @Override + public Trait createTrait(ShapeId target, Node value) { + ObjectNode objectNode = value.expectObjectNode(); + + StandardRegionalEndpointsTrait.Builder builder = builder() + .sourceLocation(value); + + objectNode + .getObjectMember(PARTITION_SPECIAL_CASES) + .ifPresent(memberNode -> memberNode + .getMembers() + .forEach((key, node) -> { + List partitionSpecialCases = node.expectArrayNode() + .getElements().stream() + .map(PartitionSpecialCase::fromNode) + .collect(ListUtils.toUnmodifiableList()); + builder.putPartitionSpecialCases(key.getValue(), partitionSpecialCases); + })); + + objectNode + .getObjectMember(REGION_SPECIAL_CASES) + .ifPresent(memberNode -> memberNode + .getMembers() + .forEach((key, node) -> { + List regionSpecialCases = node.expectArrayNode() + .getElements().stream() + .map(RegionSpecialCase::fromNode) + .collect(ListUtils.toUnmodifiableList()); + builder.putRegionSpecialCases(key.getValue(), regionSpecialCases); + })); + + StandardRegionalEndpointsTrait result = builder.build(); + result.setNodeCache(value); + return result; + } + } + + public static final class Builder extends AbstractTraitBuilder { + private final BuilderRef>> partitionSpecialCases = + BuilderRef.forOrderedMap(); + private final BuilderRef>> regionSpecialCases = + BuilderRef.forOrderedMap(); + + public Builder partitionSpecialCases(Map> partitionSpecialCases) { + this.partitionSpecialCases.clear(); + this.partitionSpecialCases.get().putAll(partitionSpecialCases); + return this; + } + + public Builder putPartitionSpecialCases(String name, List partitionSpecialCases) { + this.partitionSpecialCases.get().put(name, partitionSpecialCases); + return this; + } + + public Builder regionSpecialCases(Map> regionSpecialCases) { + this.regionSpecialCases.clear(); + this.regionSpecialCases.get().putAll(regionSpecialCases); + return this; + } + + public Builder putRegionSpecialCases(String name, List regionSpecialCases) { + this.regionSpecialCases.get().put(name, regionSpecialCases); + return this; + } + + @Override + public StandardRegionalEndpointsTrait build() { + return new StandardRegionalEndpointsTrait(this); + } + } +} diff --git a/smithy-aws-endpoints/src/main/resources/META-INF/services/software.amazon.smithy.model.traits.TraitService b/smithy-aws-endpoints/src/main/resources/META-INF/services/software.amazon.smithy.model.traits.TraitService new file mode 100644 index 00000000000..690cf9209d6 --- /dev/null +++ b/smithy-aws-endpoints/src/main/resources/META-INF/services/software.amazon.smithy.model.traits.TraitService @@ -0,0 +1,5 @@ +software.amazon.smithy.rulesengine.aws.language.functions.endpoints.EndpointModifierTrait$Provider +software.amazon.smithy.rulesengine.aws.language.functions.endpoints.DualStackOnlyEndpointsTrait$Provider +software.amazon.smithy.rulesengine.aws.language.functions.endpoints.RuleBasedEndpointsTrait$Provider +software.amazon.smithy.rulesengine.aws.language.functions.endpoints.StandardRegionalEndpointsTrait$Provider +software.amazon.smithy.rulesengine.aws.language.functions.endpoints.StandardPartitionalEndpointsTrait$Provider diff --git a/smithy-aws-endpoints/src/main/resources/META-INF/smithy/aws.endpoints.smithy b/smithy-aws-endpoints/src/main/resources/META-INF/smithy/aws.endpoints.smithy new file mode 100644 index 00000000000..5b5805c138d --- /dev/null +++ b/smithy-aws-endpoints/src/main/resources/META-INF/smithy/aws.endpoints.smithy @@ -0,0 +1,133 @@ +$version: "2.0" + +namespace aws.endpoints + +/// Marks a trait as an endpoints modifier defining trait. +/// +/// The targeted trait must only be applied to service shapes, +/// must be a structure, and must have the `trait` trait. +@unstable +@trait( + selector: "structure[trait|trait]", + breakingChanges: [{change: "presence"}] +) +structure endpointsModifier { } + +/// Marks that a services endpoints should be resolved using +/// standard regional endpoint patterns. +@unstable +@trait( + selector: "service", + conflicts: [standardPartitionalEndpoints], + breakingChanges: [{change: "remove"}] +) +@endpointsModifier +structure standardRegionalEndpoints { + /// A list of partition special cases - endpoints for a partition that do not follow the standard patterns. + partitionSpecialCases: PartitionSpecialCaseMap, + /// A list of regional special cases - endpoints for a region that do not follow the standard patterns. + regionSpecialCases: RegionSpecialCaseMap +} + +@private +map PartitionSpecialCaseMap { + key: String, + value: PartitionSpecialCaseList +} + +@private +list PartitionSpecialCaseList { + member: PartitionSpecialCase +} + +@private +structure PartitionSpecialCase { + @required + endpoint: String, + + dualStack: Boolean, + fips: Boolean +} + +@private +map RegionSpecialCaseMap { + key: String, + value: RegionSpecialCaseList +} + +@private +list RegionSpecialCaseList { + member: RegionSpecialCase +} + +@private +structure RegionSpecialCase { + @required + endpoint: String, + + dualStack: Boolean, + fips: Boolean, + signingRegion: String +} + +/// Marks that a services is non-regionalized and has +/// a single endpoint in each partition. +@unstable +@trait( + selector: "service", + conflicts: [standardRegionalEndpoints], + breakingChanges: [{change: "any"}] +) +@endpointsModifier +structure standardPartitionalEndpoints { + /// The pattern type to use for the partition endpoint. + @required + endpointPatternType: PartitionEndpointPattern, + + /// A list of partition endpoint special cases - partitions that do not follow the services standard patterns + /// or are located in a region other than the partition's defaultGlobalRegion. + partitionEndpointSpecialCases: PartitionEndpointSpecialCaseMap, +} + +@private +enum PartitionEndpointPattern { + SERVICE_DNSSUFFIX = "service_dnsSuffix" + SERVICE_REGION_DNSSUFFIX = "service_region_dnsSuffix" +} + +@private +map PartitionEndpointSpecialCaseMap { + key: String, + value: PartitionEndpointSpecialCaseList +} + +@private +list PartitionEndpointSpecialCaseList { + member: PartitionEndpointSpecialCase +} + +@private +structure PartitionEndpointSpecialCase { + endpoint: String, + region: String, + dualStack: Boolean, + fips: Boolean, +} + +/// Marks that a services has only dualStack endpoints. +@unstable +@trait( + selector: "service", + breakingChanges: [{change: "any"}] +) +@endpointsModifier +structure dualStackOnlyEndpoints { } + +/// Marks that a services has hand written endpoint rules. +@unstable +@trait( + selector: "service", + breakingChanges: [{change: "any"}] +) +@endpointsModifier +structure rulesBasedEndpoints { } diff --git a/smithy-aws-endpoints/src/main/resources/META-INF/smithy/manifest b/smithy-aws-endpoints/src/main/resources/META-INF/smithy/manifest new file mode 100644 index 00000000000..665fc53b2e9 --- /dev/null +++ b/smithy-aws-endpoints/src/main/resources/META-INF/smithy/manifest @@ -0,0 +1 @@ +aws.endpoints.smithy diff --git a/smithy-aws-endpoints/src/test/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/StandardPartitionalEndpointsTraitTest.java b/smithy-aws-endpoints/src/test/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/StandardPartitionalEndpointsTraitTest.java new file mode 100644 index 00000000000..5c1085ce428 --- /dev/null +++ b/smithy-aws-endpoints/src/test/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/StandardPartitionalEndpointsTraitTest.java @@ -0,0 +1,54 @@ +package software.amazon.smithy.rulesengine.aws.language.functions.endpoints; + +import org.junit.jupiter.api.Test; +import software.amazon.smithy.model.Model; +import software.amazon.smithy.model.shapes.ShapeId; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +class StandardPartitionalEndpointsTraitTest { + @Test + public void loadsFromModel() { + final Model model = Model.assembler() + .discoverModels(getClass().getClassLoader()) + .addImport(getClass().getResource("standardPartitionalEndpoints.smithy")) + .assemble() + .unwrap(); + + StandardPartitionalEndpointsTrait trait; + + trait = getTraitFromService(model, "ns.foo#Service1"); + + assertEquals(trait.getEndpointPatternType(), EndpointPatternType.SERVICE_DNSSUFFIX); + assertEquals(trait.getPartitionEndpointSpecialCases().size(), 0); + + trait = getTraitFromService(model, "ns.foo#Service2"); + + assertEquals(trait.getEndpointPatternType(), EndpointPatternType.SERVICE_REGION_DNSSUFFI); + assertEquals(trait.getPartitionEndpointSpecialCases().size(), 1); + + List cases = trait.getPartitionEndpointSpecialCases().get("aws-us-gov"); + + PartitionEndpointSpecialCase case1 = cases.get(0); + assertEquals(case1.getEndpoint(), "myservice.{region}.{dnsSuffix}"); + assertEquals(case1.getFips(), true); + assertEquals(case1.getRegion(), "us-east-1"); + assertNull(case1.getDualStack()); + + PartitionEndpointSpecialCase case2 = cases.get(1); + assertEquals(case2.getEndpoint(), "myservice.global.amazonaws.com"); + assertEquals(case2.getDualStack(), true); + assertEquals(case2.getRegion(), "us-west-2"); + assertNull(case2.getFips()); + } + + private StandardPartitionalEndpointsTrait getTraitFromService(Model model, String service) { + return model + .expectShape(ShapeId.from(service)) + .asServiceShape().get() + .getTrait(StandardPartitionalEndpointsTrait.class).get(); + } +} diff --git a/smithy-aws-endpoints/src/test/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/StandardRegionalEndpointsTraitTest.java b/smithy-aws-endpoints/src/test/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/StandardRegionalEndpointsTraitTest.java new file mode 100644 index 00000000000..1ceef6daf33 --- /dev/null +++ b/smithy-aws-endpoints/src/test/java/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/StandardRegionalEndpointsTraitTest.java @@ -0,0 +1,57 @@ +package software.amazon.smithy.rulesengine.aws.language.functions.endpoints; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.util.List; +import org.junit.jupiter.api.Test; +import software.amazon.smithy.model.Model; +import software.amazon.smithy.model.shapes.ShapeId; + +class StandardRegionalEndpointsTraitTest { + @Test + public void loadsFromModel() { + final Model model = Model.assembler() + .discoverModels(getClass().getClassLoader()) + .addImport(getClass().getResource("standardRegionalEndpoints.smithy")) + .assemble() + .unwrap(); + StandardRegionalEndpointsTrait trait; + + trait = getTraitFromService(model, "ns.foo#Service1"); + + assertEquals(trait.getPartitionSpecialCases().size(), 0); + assertEquals(trait.getRegionSpecialCases().size(), 0); + + trait = getTraitFromService(model, "ns.foo#Service2"); + + assertEquals(trait.getRegionSpecialCases().size(), 0); + assertEquals(trait.getRegionSpecialCases().size(), 0); + + trait = getTraitFromService(model, "ns.foo#Service3"); + + assertEquals(trait.getRegionSpecialCases().size(), 1); + assertEquals(trait.getRegionSpecialCases().size(), 1); + List partitionSpecialCases = trait.getPartitionSpecialCases().get("aws-us-gov"); + + PartitionSpecialCase partitionSpecialCase1 = partitionSpecialCases.get(0); + assertEquals(partitionSpecialCase1.getEndpoint(), "myservice.{region}.{dnsSuffix}"); + assertEquals(partitionSpecialCase1.getFips(), true); + assertNull(partitionSpecialCase1.getDualStack()); + + PartitionSpecialCase partitionSpecialCase2 = partitionSpecialCases.get(1); + assertEquals(partitionSpecialCase2.getEndpoint(), "myservice.global.amazonaws.com"); + assertEquals(partitionSpecialCase2.getDualStack(), true); + assertNull(partitionSpecialCase2.getFips()); + + List regionSpecialCases = trait.getRegionSpecialCases().get("us-east-1"); + assertEquals(regionSpecialCases.size(), 0); + } + + private StandardRegionalEndpointsTrait getTraitFromService(Model model, String service) { + return model + .expectShape(ShapeId.from(service)) + .asServiceShape().get() + .getTrait(StandardRegionalEndpointsTrait.class).get(); + } +} diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/standardPartitionalEndpoints.smithy b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/standardPartitionalEndpoints.smithy new file mode 100644 index 00000000000..2597dcec5c9 --- /dev/null +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/standardPartitionalEndpoints.smithy @@ -0,0 +1,31 @@ +$version: "2.0" + +namespace ns.foo + +use aws.endpoints#standardPartitionalEndpoints + +@standardPartitionalEndpoints(endpointPatternType: "service_dnsSuffix") +service Service1 { + version: "2021-06-29" +} + +@standardPartitionalEndpoints( + endpointPatternType: "service_region_dnsSuffix", + partitionEndpointSpecialCases: { + "aws-us-gov": [ + { + endpoint: "myservice.{region}.{dnsSuffix}", + region: "us-east-1" + fips: true + }, + { + endpoint: "myservice.global.amazonaws.com", + region: "us-west-2" + dualStack: true + } + ] + } +) +service Service2 { + version: "2021-06-29" +} diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/standardRegionalEndpoints.smithy b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/standardRegionalEndpoints.smithy new file mode 100644 index 00000000000..2bd3bf3f574 --- /dev/null +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/endpoints/standardRegionalEndpoints.smithy @@ -0,0 +1,37 @@ +$version: "2.0" + +namespace ns.foo + +use aws.endpoints#standardRegionalEndpoints + +@standardRegionalEndpoints +service Service1 { + version: "2021-06-29" +} + +@standardRegionalEndpoints(partitionSpecialCases: {}, regionSpecialCases: {}) +service Service2 { + version: "2021-06-29" +} + +@standardRegionalEndpoints( + partitionSpecialCases: { + "aws-us-gov": [ + { + endpoint: "myservice.{region}.{dnsSuffix}", + fips: true + }, + { + endpoint: "myservice.global.amazonaws.com", + dualStack: true + } + ] + }, + regionSpecialCases: { + "us-east-1": [ + ] + } +) +service Service3 { + version: "2021-06-29" +} diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/beta-auth-scheme-missing-field.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/beta-auth-scheme-missing-field.errors index 08da32f1e72..d451bd0d2de 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/beta-auth-scheme-missing-field.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/beta-auth-scheme-missing-field.errors @@ -1,3 +1,7 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#clientContextParams | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointRuleSet | UnstableTrait [ERROR] example#FizzBuzz: Expected auth property `signingName` of a string type but didn't find one | RuleSetAuthSchemes +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-rules-extra-param.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-rules-extra-param.errors index fa2b24c3d91..da2fd06e703 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-rules-extra-param.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-rules-extra-param.errors @@ -2,3 +2,7 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointTests | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#clientContextParams | UnstableTrait [DANGER] example#FizzBuzz: Parameter `useDualStackEndpoint` is never used in an `EndpointTests` test case | RuleSetParameter.TestCase.Unused +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-tests-param-not-defined.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-tests-param-not-defined.errors index c83595ebd0a..22024705092 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-tests-param-not-defined.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-tests-param-not-defined.errors @@ -2,3 +2,7 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointTests | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#clientContextParams | UnstableTrait [ERROR] example#FizzBuzz: Test parameter `notDefined` is not defined in ruleset | RuleSetParameter.TestCase.Undefined +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-tests-param-type-mismatch.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-tests-param-type-mismatch.errors index 580d0facbca..a8a1af79e9c 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-tests-param-type-mismatch.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-tests-param-type-mismatch.errors @@ -3,3 +3,7 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#clientContextParams | UnstableTrait [ERROR] example#FizzBuzz: Type mismatch for parameter `useFIPSEndpoint`, `Boolean` expected | RuleSetParameter.TestCase.TypeMismatch [ERROR] example#FizzBuzz: Expected `BooleanType` but was `StringType` with value: `true` | RuleSetTestCase +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-tests-req-params-missing.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-tests-req-params-missing.errors index 565071e015c..13b585e8b03 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-tests-req-params-missing.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/eventbridge-tests-req-params-missing.errors @@ -3,3 +3,7 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#clientContextParams | UnstableTrait [ERROR] example#FizzBuzz: Required parameter `region` is missing in at least one test case | RuleSetParameter.TestCase.RequiredMissing [ERROR] example#FizzBuzz: Expected `StringType` but was `EmptyType[]` with value: `` | RuleSetTestCase +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/signing-optional-properties-mistyped.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/signing-optional-properties-mistyped.errors index a460ce1e9b1..4bf2b1a7b1e 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/signing-optional-properties-mistyped.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/invalid/signing-optional-properties-mistyped.errors @@ -8,3 +8,7 @@ [ERROR] example#FizzBuzz: Unexpected type for auth property `disableDoubleEncoding`, found `1` but expected a boolean value | RuleSetAuthSchemes [ERROR] example#FizzBuzz: Unexpected type for auth property `disableNormalizePath`, found `1` but expected a boolean value | RuleSetAuthSchemes [ERROR] example#FizzBuzz: The `signingRegionSet` property must not be an empty list. | RuleSetAuthSchemes +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/aws-region.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/aws-region.errors index d8d3f10deb3..dafdf78ab75 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/aws-region.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/aws-region.errors @@ -1,2 +1,6 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointRuleSet | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointTests | UnstableTrait +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait \ No newline at end of file diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/beta-auth-scheme.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/beta-auth-scheme.errors index 9ee05f30b69..9aa6e225faf 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/beta-auth-scheme.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/beta-auth-scheme.errors @@ -1,2 +1,6 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#clientContextParams | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointRuleSet | UnstableTrait +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/eventbridge-tests.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/eventbridge-tests.errors index c1f093ad22d..27e4207a906 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/eventbridge-tests.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/eventbridge-tests.errors @@ -1,3 +1,7 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointRuleSet | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointTests | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#clientContextParams | UnstableTrait +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/eventbridge.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/eventbridge.errors index 0f333764d75..6d3f173d0b1 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/eventbridge.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/eventbridge.errors @@ -1,2 +1,6 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointRuleSet | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#clientContextParams | UnstableTrait +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/functions.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/functions.errors index cdb3724db45..4b5a756c297 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/functions.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/functions.errors @@ -1,3 +1,7 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointRuleSet | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#clientContextParams | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointTests | UnstableTrait +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/is-virtual-hostable-s3-bucket.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/is-virtual-hostable-s3-bucket.errors index cdb3724db45..4b5a756c297 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/is-virtual-hostable-s3-bucket.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/is-virtual-hostable-s3-bucket.errors @@ -1,3 +1,7 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointRuleSet | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#clientContextParams | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointTests | UnstableTrait +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/local-region-override.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/local-region-override.errors index d8d3f10deb3..99a45946683 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/local-region-override.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/local-region-override.errors @@ -1,2 +1,6 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointRuleSet | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointTests | UnstableTrait +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/parse-arn.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/parse-arn.errors index cdb3724db45..4b5a756c297 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/parse-arn.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/parse-arn.errors @@ -1,3 +1,7 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointRuleSet | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#clientContextParams | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointTests | UnstableTrait +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/partition-fn.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/partition-fn.errors index d8d3f10deb3..99a45946683 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/partition-fn.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/partition-fn.errors @@ -1,2 +1,6 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointRuleSet | UnstableTrait [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointTests | UnstableTrait +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait diff --git a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/signing-optional-properties.errors b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/signing-optional-properties.errors index a0b08ef4605..e9ab6b79f97 100644 --- a/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/signing-optional-properties.errors +++ b/smithy-aws-endpoints/src/test/resources/software/amazon/smithy/rulesengine/aws/language/functions/errorfiles/valid/signing-optional-properties.errors @@ -1 +1,5 @@ [WARNING] example#FizzBuzz: This shape applies a trait that is unstable: smithy.rules#endpointRuleSet | UnstableTrait +[WARNING] aws.endpoints#standardRegionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#standardPartitionalEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#dualStackOnlyEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait +[WARNING] aws.endpoints#rulesBasedEndpoints: This shape applies a trait that is unstable: aws.endpoints#endpointsModifier | UnstableTrait