io.cloudshiftdev.awscdk.services.stepfunctions.StateProps.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.String
import kotlin.Unit
import kotlin.collections.Map
/**
* Properties shared by all states.
*
* Example:
*
* ```
* // The code below shows an example of how to instantiate this type.
* // The values are placeholders you should change.
* import io.cloudshiftdev.awscdk.services.stepfunctions.*;
* Object parameters;
* Object resultSelector;
* StateProps stateProps = StateProps.builder()
* .comment("comment")
* .inputPath("inputPath")
* .outputPath("outputPath")
* .parameters(Map.of(
* "parametersKey", parameters))
* .resultPath("resultPath")
* .resultSelector(Map.of(
* "resultSelectorKey", resultSelector))
* .stateName("stateName")
* .build();
* ```
*/
public interface StateProps {
/**
* A comment describing this state.
*
* Default: No comment
*/
public 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: $
*/
public fun inputPath(): String? = unwrap(this).getInputPath()
/**
* 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: $
*/
public fun outputPath(): String? = unwrap(this).getOutputPath()
/**
* Parameters pass a collection of key-value pairs, either static values or JSONPath expressions
* that select from the input.
*
* Default: No parameters
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters)
*/
public 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: $
*/
public 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)
*/
public fun resultSelector(): Map = unwrap(this).getResultSelector() ?: emptyMap()
/**
* Optional name for this state.
*
* Default: - The construct ID will be used as state name
*/
public fun stateName(): String? = unwrap(this).getStateName()
/**
* A builder for [StateProps]
*/
@CdkDslMarker
public interface Builder {
/**
* @param comment A comment describing 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 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 Parameters pass a collection of key-value pairs, either static values or
* JSONPath expressions that select from the input.
*/
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.StateProps.Builder =
software.amazon.awscdk.services.stepfunctions.StateProps.builder()
/**
* @param comment A comment describing 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 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 Parameters pass a collection of key-value pairs, either static values or
* JSONPath expressions that select from the input.
*/
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.StateProps =
cdkBuilder.build()
}
private class Wrapper(
cdkObject: software.amazon.awscdk.services.stepfunctions.StateProps,
) : CdkObject(cdkObject),
StateProps {
/**
* A comment describing 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()
/**
* 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()
/**
* Parameters pass a collection of key-value pairs, either static values or JSONPath expressions
* that select from the input.
*
* Default: No parameters
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters)
*/
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 = {}): StateProps {
val builderImpl = BuilderImpl()
return Wrapper(builderImpl.apply(block).build())
}
internal fun wrap(cdkObject: software.amazon.awscdk.services.stepfunctions.StateProps):
StateProps = CdkObjectWrappers.wrap(cdkObject) as? StateProps ?: Wrapper(cdkObject)
internal fun unwrap(wrapped: StateProps):
software.amazon.awscdk.services.stepfunctions.StateProps = (wrapped as CdkObject).cdkObject
as software.amazon.awscdk.services.stepfunctions.StateProps
}
}