Class RulesFunctions

java.lang.Object
software.amazon.awssdk.services.sagemakerfeaturestoreruntime.endpoints.internal.RulesFunctions

@SdkInternalApi public class RulesFunctions extends Object
  • Constructor Details

    • RulesFunctions

      public RulesFunctions()
  • Method Details

    • coalesce

      @SafeVarargs public static <T> T coalesce(T... args)
    • coalesce

      @SafeVarargs public static String coalesce(String... args)
    • split

      public static List<String> split(String value, String delimiter, int limit)
      Splits value around delimiter into at most limit parts, or into as many parts as there are when limit is 0.

      None of the three arguments is optional. The rules language types value as a plain string, which its type checker only permits once the value is known to be set, and the specification requires a delimiter that is neither null nor empty and a limit that is not negative. A violation therefore means the rule set, or the code generated from it, is wrong - not that the request was unusual - so each is raised as an SdkClientException naming the offending argument. Generated providers surface that as a failed resolution rather than letting it escape as an unchecked exception.

      The checks precede the limit == 1 shortcut deliberately. That shortcut returns before either string is dereferenced, so validating after it would let split(null, ",", 1) return a list holding null, which reads downstream as an unset value and quietly redirects the rule rather than failing.

      Throws:
      SdkClientException - if value is null, if delimiter is null or empty, or if limit is negative.
    • ite

      public static String ite(boolean condition, String ifTrue, String ifFalse)
    • substring

      public static String substring(String value, int startIndex, int stopIndex, boolean reverse)
    • substringEquals

      public static boolean substringEquals(String value, int startIndex, int stopIndex, boolean reverse, String literal)
      Equivalent to stringEquals(coalesce(substring(value, startIndex, stopIndex, reverse), ""), literal) without allocating the intermediate substring. Called by optimized codegen.

      This mirrors substring(java.lang.String, int, int, boolean) exactly, including its rejection of any input containing a character outside the 7-bit ASCII range. The positional comparison is done first because it fails for almost every input; the O(n) ASCII scan is only reached once the characters already match, which is precisely where substring(java.lang.String, int, int, boolean) would have paid the same cost.

      Only equivalent for a non-empty literal. When startIndex == stopIndex the spec's substring returns null and the coalesce makes the comparison against "" true even for a null input; codegen does not rewrite that case into this method.

    • uriEncode

      public static String uriEncode(String uri)
    • parseURL

      public static RuleUrl parseURL(String url)
    • isValidHostLabel

      public static boolean isValidHostLabel(String hostLabel, boolean allowDots)
    • isValidHostLabelSingle

      public static boolean isValidHostLabelSingle(String hostLabel)
      Validates a single DNS label (no dots allowed), the allowDots == false case of isValidHostLabel(java.lang.String, boolean). Called directly by optimized codegen when allowDots is a compile-time constant, which skips the dispatch.
    • isValidHostLabelMulti

      public static boolean isValidHostLabelMulti(String hostLabel)
      Validates a multi-label DNS name (dots allowed), the allowDots == true case of isValidHostLabel(java.lang.String, boolean). Called directly by optimized codegen when allowDots is a compile-time constant, which skips the dispatch.
    • awsPartition

      public static RulePartition awsPartition(String regionName)
      Resolves the partition a region belongs to.

      RulePartition is immutable and is a pure function of the matched Partition, of which there are only a handful, loaded once. The instances are therefore built up front in loadPartitionData() and shared, so this method allocates nothing on any path that resolves, and holds no per-call state.

      Throws:
      SdkClientException - if the region matches no partition and the loaded metadata declares no 'aws' partition to fall back to.
    • awsParseArn

      public static RuleArn awsParseArn(String value)
    • stringEquals

      public static boolean stringEquals(String left, String right)
    • listAccess

      public static <T> T listAccess(List<T> values, int index)
    • awsIsVirtualHostableS3Bucket

      public static boolean awsIsVirtualHostableS3Bucket(String hostLabel, boolean allowDots)