io.cloudshiftdev.awscdk.services.stepfunctions.MapProps.kt Maven / Gradle / Ivy
The newest version!
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package io.cloudshiftdev.awscdk.services.stepfunctions
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import io.cloudshiftdev.awscdk.common.CdkObject
import io.cloudshiftdev.awscdk.common.CdkObjectWrappers
import kotlin.Any
import kotlin.Deprecated
import kotlin.Number
import kotlin.String
import kotlin.Unit
import kotlin.collections.Map
/**
* Properties for defining a Map state.
*
* Example:
*
* ```
* Map map = Map.Builder.create(this, "Map State")
* .maxConcurrency(1)
* .itemsPath(JsonPath.stringAt("$.inputForMap"))
* .itemSelector(Map.of(
* "item", JsonPath.stringAt("$.Map.Item.Value")))
* .resultPath("$.mapOutput")
* .build();
* // The Map iterator can contain a IChainable, which can be an individual or multiple steps
* chained together.
* // Below example is with a Choice and Pass step
* Choice choice = new Choice(this, "Choice");
* Condition condition1 = Condition.stringEquals("$.item.status", "SUCCESS");
* Pass step1 = new Pass(this, "Step1");
* Pass step2 = new Pass(this, "Step2");
* Pass finish = new Pass(this, "Finish");
* Chain definition = choice.when(condition1, step1).otherwise(step2).afterwards().next(finish);
* map.itemProcessor(definition);
* ```
*/
public interface MapProps : MapBaseProps {
/**
* (deprecated) The JSON that you want to override your default iteration input (mutually
* exclusive with `itemSelector`).
*
* Default: $
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/input-output-itemselector.html)
* @deprecated Step Functions has deprecated the `parameters` field in favor of
* the new `itemSelector` field
*/
@Deprecated(message = "deprecated in CDK")
public fun parameters(): Map = unwrap(this).getParameters() ?: emptyMap()
/**
* A builder for [MapProps]
*/
@CdkDslMarker
public interface Builder {
/**
* @param comment An optional description for this state.
*/
public fun comment(comment: String)
/**
* @param inputPath JSONPath expression to select part of the state to be the input to this
* state.
* May also be the special value JsonPath.DISCARD, which will cause the effective
* input to be the empty object {}.
*/
public fun inputPath(inputPath: String)
/**
* @param itemSelector The JSON that you want to override your default iteration input (mutually
* exclusive with `parameters`).
*/
public fun itemSelector(itemSelector: Map)
/**
* @param itemsPath JSONPath expression to select the array to iterate over.
*/
public fun itemsPath(itemsPath: String)
/**
* @param maxConcurrency MaxConcurrency.
* An upper bound on the number of iterations you want running at once.
*/
public fun maxConcurrency(maxConcurrency: Number)
/**
* @param maxConcurrencyPath MaxConcurrencyPath.
* A JsonPath that specifies the maximum concurrency dynamically from the state input.
*/
public fun maxConcurrencyPath(maxConcurrencyPath: String)
/**
* @param outputPath JSONPath expression to select part of the state to be the output to this
* state.
* May also be the special value JsonPath.DISCARD, which will cause the effective
* output to be the empty object {}.
*/
public fun outputPath(outputPath: String)
/**
* @param parameters The JSON that you want to override your default iteration input (mutually
* exclusive with `itemSelector`).
* @deprecated Step Functions has deprecated the `parameters` field in favor of
* the new `itemSelector` field
*/
@Deprecated(message = "deprecated in CDK")
public fun parameters(parameters: Map)
/**
* @param resultPath JSONPath expression to indicate where to inject the state's output.
* May also be the special value JsonPath.DISCARD, which will cause the state's
* input to become its output.
*/
public fun resultPath(resultPath: String)
/**
* @param resultSelector The JSON that will replace the state's raw result and become the
* effective result before ResultPath is applied.
* You can use ResultSelector to create a payload with values that are static
* or selected from the state's raw result.
*/
public fun resultSelector(resultSelector: Map)
/**
* @param stateName Optional name for this state.
*/
public fun stateName(stateName: String)
}
private class BuilderImpl : Builder {
private val cdkBuilder: software.amazon.awscdk.services.stepfunctions.MapProps.Builder =
software.amazon.awscdk.services.stepfunctions.MapProps.builder()
/**
* @param comment An optional description for this state.
*/
override fun comment(comment: String) {
cdkBuilder.comment(comment)
}
/**
* @param inputPath JSONPath expression to select part of the state to be the input to this
* state.
* May also be the special value JsonPath.DISCARD, which will cause the effective
* input to be the empty object {}.
*/
override fun inputPath(inputPath: String) {
cdkBuilder.inputPath(inputPath)
}
/**
* @param itemSelector The JSON that you want to override your default iteration input (mutually
* exclusive with `parameters`).
*/
override fun itemSelector(itemSelector: Map) {
cdkBuilder.itemSelector(itemSelector.mapValues{CdkObjectWrappers.unwrap(it.value)})
}
/**
* @param itemsPath JSONPath expression to select the array to iterate over.
*/
override fun itemsPath(itemsPath: String) {
cdkBuilder.itemsPath(itemsPath)
}
/**
* @param maxConcurrency MaxConcurrency.
* An upper bound on the number of iterations you want running at once.
*/
override fun maxConcurrency(maxConcurrency: Number) {
cdkBuilder.maxConcurrency(maxConcurrency)
}
/**
* @param maxConcurrencyPath MaxConcurrencyPath.
* A JsonPath that specifies the maximum concurrency dynamically from the state input.
*/
override fun maxConcurrencyPath(maxConcurrencyPath: String) {
cdkBuilder.maxConcurrencyPath(maxConcurrencyPath)
}
/**
* @param outputPath JSONPath expression to select part of the state to be the output to this
* state.
* May also be the special value JsonPath.DISCARD, which will cause the effective
* output to be the empty object {}.
*/
override fun outputPath(outputPath: String) {
cdkBuilder.outputPath(outputPath)
}
/**
* @param parameters The JSON that you want to override your default iteration input (mutually
* exclusive with `itemSelector`).
* @deprecated Step Functions has deprecated the `parameters` field in favor of
* the new `itemSelector` field
*/
@Deprecated(message = "deprecated in CDK")
override fun parameters(parameters: Map) {
cdkBuilder.parameters(parameters.mapValues{CdkObjectWrappers.unwrap(it.value)})
}
/**
* @param resultPath JSONPath expression to indicate where to inject the state's output.
* May also be the special value JsonPath.DISCARD, which will cause the state's
* input to become its output.
*/
override fun resultPath(resultPath: String) {
cdkBuilder.resultPath(resultPath)
}
/**
* @param resultSelector The JSON that will replace the state's raw result and become the
* effective result before ResultPath is applied.
* You can use ResultSelector to create a payload with values that are static
* or selected from the state's raw result.
*/
override fun resultSelector(resultSelector: Map) {
cdkBuilder.resultSelector(resultSelector.mapValues{CdkObjectWrappers.unwrap(it.value)})
}
/**
* @param stateName Optional name for this state.
*/
override fun stateName(stateName: String) {
cdkBuilder.stateName(stateName)
}
public fun build(): software.amazon.awscdk.services.stepfunctions.MapProps = cdkBuilder.build()
}
private class Wrapper(
cdkObject: software.amazon.awscdk.services.stepfunctions.MapProps,
) : CdkObject(cdkObject),
MapProps {
/**
* An optional description for this state.
*
* Default: No comment
*/
override fun comment(): String? = unwrap(this).getComment()
/**
* JSONPath expression to select part of the state to be the input to this state.
*
* May also be the special value JsonPath.DISCARD, which will cause the effective
* input to be the empty object {}.
*
* Default: $
*/
override fun inputPath(): String? = unwrap(this).getInputPath()
/**
* The JSON that you want to override your default iteration input (mutually exclusive with
* `parameters`).
*
* Default: $
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/input-output-itemselector.html)
*/
override fun itemSelector(): Map = unwrap(this).getItemSelector() ?: emptyMap()
/**
* JSONPath expression to select the array to iterate over.
*
* Default: $
*/
override fun itemsPath(): String? = unwrap(this).getItemsPath()
/**
* MaxConcurrency.
*
* An upper bound on the number of iterations you want running at once.
*
* Default: - full concurrency
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-asl-use-map-state-inline.html#map-state-inline-additional-fields)
*/
override fun maxConcurrency(): Number? = unwrap(this).getMaxConcurrency()
/**
* MaxConcurrencyPath.
*
* A JsonPath that specifies the maximum concurrency dynamically from the state input.
*
* Default: - full concurrency
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-asl-use-map-state-inline.html#map-state-inline-additional-fields)
*/
override fun maxConcurrencyPath(): String? = unwrap(this).getMaxConcurrencyPath()
/**
* JSONPath expression to select part of the state to be the output to this state.
*
* May also be the special value JsonPath.DISCARD, which will cause the effective
* output to be the empty object {}.
*
* Default: $
*/
override fun outputPath(): String? = unwrap(this).getOutputPath()
/**
* (deprecated) The JSON that you want to override your default iteration input (mutually
* exclusive with `itemSelector`).
*
* Default: $
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/input-output-itemselector.html)
* @deprecated Step Functions has deprecated the `parameters` field in favor of
* the new `itemSelector` field
*/
@Deprecated(message = "deprecated in CDK")
override fun parameters(): Map = unwrap(this).getParameters() ?: emptyMap()
/**
* JSONPath expression to indicate where to inject the state's output.
*
* May also be the special value JsonPath.DISCARD, which will cause the state's
* input to become its output.
*
* Default: $
*/
override fun resultPath(): String? = unwrap(this).getResultPath()
/**
* The JSON that will replace the state's raw result and become the effective result before
* ResultPath is applied.
*
* You can use ResultSelector to create a payload with values that are static
* or selected from the state's raw result.
*
* Default: - None
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-resultselector)
*/
override fun resultSelector(): Map = unwrap(this).getResultSelector() ?: emptyMap()
/**
* Optional name for this state.
*
* Default: - The construct ID will be used as state name
*/
override fun stateName(): String? = unwrap(this).getStateName()
}
public companion object {
public operator fun invoke(block: Builder.() -> Unit = {}): MapProps {
val builderImpl = BuilderImpl()
return Wrapper(builderImpl.apply(block).build())
}
internal fun wrap(cdkObject: software.amazon.awscdk.services.stepfunctions.MapProps): MapProps =
CdkObjectWrappers.wrap(cdkObject) as? MapProps ?: Wrapper(cdkObject)
internal fun unwrap(wrapped: MapProps): software.amazon.awscdk.services.stepfunctions.MapProps =
(wrapped as CdkObject).cdkObject as software.amazon.awscdk.services.stepfunctions.MapProps
}
}