JsonPath
- class aws_cdk.aws_stepfunctions.JsonPath(*args: Any, **kwargs)
Bases:
object
Extract a field from the State Machine data or context that gets passed around between states.
- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-paths.html
- ExampleMetadata:
infused
Example:
# # JSON state input: # { # "bucketName": "my-bucket", # "prefix": "item" # } # distributed_map = sfn.DistributedMap(self, "DistributedMap", item_reader=sfn.S3ObjectsItemReader( bucket_name_path=sfn.JsonPath.string_at("$.bucketName"), prefix=sfn.JsonPath.string_at("$.prefix") ) ) distributed_map.item_processor(sfn.Pass(self, "Pass"))
Attributes
- DISCARD = '${Token[DISCARD..JSON..null...1070]}'
- entire_context = '${Token[TOKEN.1084]}'
- entire_payload = '${Token[TOKEN.1085]}'
- execution_id = '${Token[Execution.Id.1086]}'
- execution_input = '${Token[Execution.Input.1087]}'
- execution_name = '${Token[Execution.Name.1088]}'
- execution_role_arn = '${Token[Execution.RoleArn.1089]}'
- execution_start_time = '${Token[Execution.StartTime.1090]}'
- state_entered_time = '${Token[State.EnteredTime.1091]}'
- state_machine_id = '${Token[StateMachine.Id.1092]}'
- state_machine_name = '${Token[StateMachine.Name.1093]}'
- state_name = '${Token[State.Name.1094]}'
- state_retry_count = '${Token[State.RetryCount.1095]}'
- task_token = '${Token[Task.Token.1096]}'
Static Methods
- classmethod array(*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 (
str
) –- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod array_contains(array, 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 (
Any
) –value (
Any
) –
- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod array_get_item(array, index)
Make an intrinsic States.ArrayGetItem expression.
Use this function to get a specified index’s value in an array.
- Parameters:
array (
Any
) –index (
Union
[int
,float
]) –
- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod array_length(array)
Make an intrinsic States.ArrayLength expression.
Use this function to get the length of an array.
- Parameters:
array (
Any
) –- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod array_partition(array, chunk_size)
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 (
Any
) –chunk_size (
Union
[int
,float
]) –
- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod array_range(start, end, 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 (
Union
[int
,float
]) –end (
Union
[int
,float
]) –step (
Union
[int
,float
]) –
- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod array_unique(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 (
Any
) –- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod base64_decode(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 (
str
) –- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod base64_encode(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 (
str
) –- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod format(format_string, *values)
Make an intrinsic States.Format expression.
This can be used to embed JSON Path variables inside a format string.
For example:
sfn.JsonPath.format("Hello, my name is {}.", sfn.JsonPath.string_at("$.name"))
- Parameters:
format_string (
str
) –values (
str
) –
- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod hash(data, 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 (
Any
) –algorithm (
str
) –
- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod is_encoded_json_path(value)
Determines if the indicated string is an encoded JSON path.
- Parameters:
value (
str
) – string to be evaluated.- Return type:
bool
- classmethod json_merge(value1, value2)
Make an intrinsic States.JsonMerge expression.
Use this function to merge two JSON objects into a single object.
- Parameters:
value1 (
Any
) –value2 (
Any
) –
- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod json_to_string(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:
sfn.JsonPath.json_to_string(sfn.JsonPath.object_at("$.someObject"))
- Parameters:
value (
Any
) –- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod list_at(path)
Instead of using a literal string list, get the value from a JSON path.
- Parameters:
path (
str
) –- Return type:
List
[str
]
- classmethod math_add(num1, 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 (
Union
[int
,float
]) –num2 (
Union
[int
,float
]) –
- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod math_random(start, 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 (
Union
[int
,float
]) –end (
Union
[int
,float
]) –
- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod number_at(path)
Instead of using a literal number, get the value from a JSON path.
- Parameters:
path (
str
) –- Return type:
Union
[int
,float
]
- classmethod object_at(path)
Reference a complete (complex) object in a JSON path location.
- Parameters:
path (
str
) –- Return type:
- classmethod string_at(path)
Instead of using a literal string, get the value from a JSON path.
- Parameters:
path (
str
) –- Return type:
str
- classmethod string_split(input_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:
input_string (
str
) –splitter (
str
) –
- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
str
- classmethod string_to_json(json_string)
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:
sfn.JsonPath.string_to_json(sfn.JsonPath.string_at("$.someJsonBody"))
- Parameters:
json_string (
str
) –- See:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
- Return type:
- classmethod 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.