diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/endpointsV2/EndpointsV2Generator.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/endpointsV2/EndpointsV2Generator.java index f85201e1f50..9db0a0529bc 100644 --- a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/endpointsV2/EndpointsV2Generator.java +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/endpointsV2/EndpointsV2Generator.java @@ -117,7 +117,10 @@ private void generateEndpointParameters() { RuleSetParameterFinder ruleSetParameterFinder = new RuleSetParameterFinder(service); Map clientInputParams = ruleSetParameterFinder.getClientContextParams(); - clientInputParams.putAll(ruleSetParameterFinder.getBuiltInParams()); + //Omit Endpoint params that should not be a part of the ClientInputEndpointParameters interface + Map builtInParams = ruleSetParameterFinder.getBuiltInParams(); + builtInParams.keySet().removeIf(OmitEndpointParams::isOmitted); + clientInputParams.putAll(builtInParams); ObjectNode ruleSet = endpointRuleSetTrait.getRuleSet().expectObjectNode(); ruleSet.getObjectMember("parameters").ifPresent(parameters -> { diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/endpointsV2/OmitEndpointParams.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/endpointsV2/OmitEndpointParams.java new file mode 100644 index 00000000000..7c94fe61f38 --- /dev/null +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/endpointsV2/OmitEndpointParams.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.typescript.codegen.endpointsV2; + + import java.util.Collections; + import java.util.HashSet; + import java.util.Set; + + /** + * Manages a collection of endpoint parameter names to be omitted from a specific interface. + * While this could be extensible in the future, as of right now, + * this collection is maintaining endpoint params to be omitted from the `ClientInputEndpointParameters` interface. + */ + public final class OmitEndpointParams { + private static final Set OMITTED_PARAMS = new HashSet<>(); + + private OmitEndpointParams() {} + + public static void addOmittedParams(Set paramNames) { + OMITTED_PARAMS.addAll(paramNames); + } + + public static boolean isOmitted(String paramName) { + return OMITTED_PARAMS.contains(paramName); + } + + public static Set getOmittedParams() { + return Collections.unmodifiableSet(OMITTED_PARAMS); + } +}