Skip to content

Commit

Permalink
Remove redundant getStaticContextParams function (#1359)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Aug 1, 2024
1 parent efcbbf4 commit ca9e649
Showing 1 changed file with 2 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
import software.amazon.smithy.rulesengine.traits.ContextParamTrait;
import software.amazon.smithy.rulesengine.traits.EndpointRuleSetTrait;
import software.amazon.smithy.rulesengine.traits.StaticContextParamsTrait;
import software.amazon.smithy.utils.SmithyInternalApi;

@SmithyInternalApi
public class RuleSetParameterFinder {
private final ServiceShape service;
private final EndpointRuleSetTrait ruleset;
Expand Down Expand Up @@ -73,31 +75,6 @@ public Map<String, String> getClientContextParams() {
return map;
}

/**
* "The staticContextParams trait defines one or more context parameters that MUST
* be bound to the specified values. This trait MUST target an operation shape."
*/
public Map<String, String> getStaticContextParams(Shape operationInput) {
Map<String, String> map = new HashMap<>();

if (operationInput.isStructureShape()) {
operationInput.getAllMembers().forEach((String memberName, MemberShape member) -> {
Optional<StaticContextParamsTrait> trait = member.getTrait(StaticContextParamsTrait.class);
if (trait.isPresent()) {
StaticContextParamsTrait staticContextParamsTrait = trait.get();
staticContextParamsTrait.getParameters().forEach((name, definition) -> {
map.put(
name,
definition.getValue().getType().toString()
);
});
}
});
}

return map;
}

/**
* Get map of params to actual values instead of the value type.
*/
Expand Down

0 comments on commit ca9e649

Please sign in to comment.