java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.stepfunctions.JsonPath
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-02T15:58:34.037Z") @Stability(Stable) public class JsonPath extends software.amazon.jsii.JsiiObject
Extract a field from the State Machine data or context that gets passed around between states.

Example:

 Activity submitJobActivity = new Activity(this, "SubmitJob");
 StepFunctionsInvokeActivity.Builder.create(this, "Submit Job")
         .activity(submitJobActivity)
         .parameters(Map.of(
                 "comment", "Selecting what I care about.",
                 "MyDetails", Map.of(
                         "size", JsonPath.stringAt("$.product.details.size"),
                         "exists", JsonPath.stringAt("$.product.availability"),
                         "StaticValue", "foo")))
         .build();
 

See Also:
  • Field Details

    • DISCARD

      @Stability(Stable) public static final String DISCARD
      Special string value to discard state input, output or result.
  • Constructor Details

    • JsonPath

      protected JsonPath(software.amazon.jsii.JsiiObjectRef objRef)
    • JsonPath

      protected JsonPath(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
  • Method Details

    • array

      @Stability(Stable) @NotNull public static String array(@NotNull @NotNull String... values)
      Make an intrinsic States.Array expression.

      Combine any number of string literals or JsonPath expressions into an array.

      Use this function if the value of an array element directly has to come from a JSON Path expression (either the State object or the Context object).

      If the array contains object literals whose values come from a JSON path expression, you do not need to use this function.

      Parameters:
      values - This parameter is required.
      See Also:
    • arrayContains

      @Stability(Stable) @NotNull public static String arrayContains(@NotNull Object array, @NotNull Object value)
      Make an intrinsic States.ArrayContains expression.

      Use this function to determine if a specific value is present in an array. For example, you can use this function to detect if there was an error in a Map state iteration.

      Parameters:
      array - This parameter is required.
      value - This parameter is required.
      See Also:
    • arrayGetItem

      @Stability(Stable) @NotNull public static String arrayGetItem(@NotNull Object array, @NotNull Number index)
      Make an intrinsic States.ArrayGetItem expression.

      Use this function to get a specified index's value in an array.

      Parameters:
      array - This parameter is required.
      index - This parameter is required.
      See Also:
    • arrayLength

      @Stability(Stable) @NotNull public static String arrayLength(@NotNull Object array)
      Make an intrinsic States.ArrayLength expression.

      Use this function to get the length of an array.

      Parameters:
      array - This parameter is required.
      See Also:
    • arrayPartition

      @Stability(Stable) @NotNull public static String arrayPartition(@NotNull Object array, @NotNull Number chunkSize)
      Make an intrinsic States.ArrayPartition expression.

      Use this function to partition a large array. You can also use this intrinsic to slice the data and then send the payload in smaller chunks.

      Parameters:
      array - This parameter is required.
      chunkSize - This parameter is required.
      See Also:
    • arrayRange

      @Stability(Stable) @NotNull public static String arrayRange(@NotNull Number start, @NotNull Number end, @NotNull Number step)
      Make an intrinsic States.ArrayRange expression.

      Use this function to create a new array containing a specific range of elements. The new array can contain up to 1000 elements.

      Parameters:
      start - This parameter is required.
      end - This parameter is required.
      step - This parameter is required.
      See Also:
    • arrayUnique

      @Stability(Stable) @NotNull public static String arrayUnique(@NotNull Object array)
      Make an intrinsic States.ArrayUnique expression.

      Use this function to get the length of an array. Use this function to remove duplicate values from an array and returns an array containing only unique elements. This function takes an array, which can be unsorted, as its sole argument.

      Parameters:
      array - This parameter is required.
      See Also:
    • base64Decode

      @Stability(Stable) @NotNull public static String base64Decode(@NotNull String base64)
      Make an intrinsic States.Base64Decode expression.

      Use this function to decode data based on MIME Base64 decoding scheme. You can use this function to pass data to other AWS services without using a Lambda function.

      Parameters:
      base64 - This parameter is required.
      See Also:
    • base64Encode

      @Stability(Stable) @NotNull public static String base64Encode(@NotNull String input)
      Make an intrinsic States.Base64Encode expression.

      Use this function to encode data based on MIME Base64 encoding scheme. You can use this function to pass data to other AWS services without using an AWS Lambda function.

      Parameters:
      input - This parameter is required.
      See Also:
    • format

      @Stability(Stable) @NotNull public static String format(@NotNull String formatString, @NotNull @NotNull String... values)
      Make an intrinsic States.Format expression.

      This can be used to embed JSON Path variables inside a format string.

      For example:

       JsonPath.format("Hello, my name is {}.", JsonPath.stringAt("$.name"));
       

      Parameters:
      formatString - This parameter is required.
      values - This parameter is required.
      See Also:
    • hash

      @Stability(Stable) @NotNull public static String hash(@NotNull Object data, @NotNull String algorithm)
      Make an intrinsic States.Hash expression.

      Use this function to calculate the hash value of a given input. You can use this function to pass data to other AWS services without using a Lambda function.

      Parameters:
      data - This parameter is required.
      algorithm - This parameter is required.
      See Also:
    • isEncodedJsonPath

      @Stability(Stable) @NotNull public static Boolean isEncodedJsonPath(@NotNull String value)
      Determines if the indicated string is an encoded JSON path.

      Parameters:
      value - string to be evaluated. This parameter is required.
    • jsonMerge

      @Stability(Stable) @NotNull public static String jsonMerge(@NotNull Object value1, @NotNull Object value2)
      Make an intrinsic States.JsonMerge expression.

      Use this function to merge two JSON objects into a single object.

      Parameters:
      value1 - This parameter is required.
      value2 - This parameter is required.
      See Also:
    • jsonToString

      @Stability(Stable) @NotNull public static String jsonToString(@NotNull Object value)
      Make an intrinsic States.JsonToString expression.

      During the execution of the Step Functions state machine, encode the given object into a JSON string.

      For example:

       JsonPath.jsonToString(JsonPath.objectAt("$.someObject"));
       

      Parameters:
      value - This parameter is required.
      See Also:
    • listAt

      @Stability(Stable) @NotNull public static List<String> listAt(@NotNull String path)
      Instead of using a literal string list, get the value from a JSON path.

      Parameters:
      path - This parameter is required.
    • mathAdd

      @Stability(Stable) @NotNull public static String mathAdd(@NotNull Number num1, @NotNull Number num2)
      Make an intrinsic States.MathAdd expression.

      Use this function to return the sum of two numbers. For example, you can use this function to increment values inside a loop without invoking a Lambda function.

      Parameters:
      num1 - This parameter is required.
      num2 - This parameter is required.
      See Also:
    • mathRandom

      @Stability(Stable) @NotNull public static String mathRandom(@NotNull Number start, @NotNull Number end)
      Make an intrinsic States.MathRandom expression.

      Use this function to return a random number between the specified start and end number. For example, you can use this function to distribute a specific task between two or more resources.

      Parameters:
      start - This parameter is required.
      end - This parameter is required.
      See Also:
    • numberAt

      @Stability(Stable) @NotNull public static Number numberAt(@NotNull String path)
      Instead of using a literal number, get the value from a JSON path.

      Parameters:
      path - This parameter is required.
    • objectAt

      @Stability(Stable) @NotNull public static IResolvable objectAt(@NotNull String path)
      Reference a complete (complex) object in a JSON path location.

      Parameters:
      path - This parameter is required.
    • stringAt

      @Stability(Stable) @NotNull public static String stringAt(@NotNull String path)
      Instead of using a literal string, get the value from a JSON path.

      Parameters:
      path - This parameter is required.
    • stringSplit

      @Stability(Stable) @NotNull public static String stringSplit(@NotNull String inputString, @NotNull String splitter)
      Make an intrinsic States.StringSplit expression.

      Use this function to split a string into an array of values. This function takes two arguments.The first argument is a string and the second argument is the delimiting character that the function will use to divide the string.

      Parameters:
      inputString - This parameter is required.
      splitter - This parameter is required.
      See Also:
    • stringToJson

      @Stability(Stable) @NotNull public static IResolvable stringToJson(@NotNull String jsonString)
      Make an intrinsic States.StringToJson expression.

      During the execution of the Step Functions state machine, parse the given argument as JSON into its object form.

      For example:

       JsonPath.stringToJson(JsonPath.stringAt("$.someJsonBody"));
       

      Parameters:
      jsonString - This parameter is required.
      See Also:
    • uuid

      @Stability(Stable) @NotNull public static String uuid()
      Make an intrinsic States.UUID expression.

      Use this function to return a version 4 universally unique identifier (v4 UUID) generated using random numbers. For example, you can use this function to call other AWS services or resources that need a UUID parameter or insert items in a DynamoDB table.

      See Also:
    • getEntireContext

      @Stability(Stable) @NotNull public static String getEntireContext()
      Use the entire context data structure.

      Will be an object at invocation time, but is represented in the CDK application as a string.

    • getEntirePayload

      @Stability(Stable) @NotNull public static String getEntirePayload()
      Use the entire data structure.

      Will be an object at invocation time, but is represented in the CDK application as a string.

    • getExecutionId

      @Stability(Stable) @NotNull public static String getExecutionId()
      Return the Execution Id field from the context object.
    • getExecutionInput

      @Stability(Stable) @NotNull public static String getExecutionInput()
      Return the Execution Input field from the context object.

      • Will be an object at invocation time, but is represented in the CDK application as a string.
    • getExecutionName

      @Stability(Stable) @NotNull public static String getExecutionName()
      Return the Execution Name field from the context object.
    • getExecutionRoleArn

      @Stability(Stable) @NotNull public static String getExecutionRoleArn()
      Return the Execution RoleArn field from the context object.
    • getExecutionStartTime

      @Stability(Stable) @NotNull public static String getExecutionStartTime()
      Return the Execution StartTime field from the context object.
    • getStateEnteredTime

      @Stability(Stable) @NotNull public static String getStateEnteredTime()
      Return the State EnteredTime field from the context object.
    • getStateMachineId

      @Stability(Stable) @NotNull public static String getStateMachineId()
      Return the StateMachine Id field from the context object.
    • getStateMachineName

      @Stability(Stable) @NotNull public static String getStateMachineName()
      Return the StateMachine Name field from the context object.
    • getStateName

      @Stability(Stable) @NotNull public static String getStateName()
      Return the State Name field from the context object.
    • getStateRetryCount

      @Stability(Stable) @NotNull public static String getStateRetryCount()
      Return the State RetryCount field from the context object.
    • getTaskToken

      @Stability(Stable) @NotNull public static String getTaskToken()
      Return the Task Token field from the context object.

      External actions will need this token to report step completion back to StepFunctions using the SendTaskSuccess or SendTaskFailure calls.