All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.cloudshiftdev.awscdk.services.stepfunctions.TaskInput.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.CdkObject
import io.cloudshiftdev.awscdk.common.CdkObjectWrappers
import kotlin.Any
import kotlin.String
import kotlin.collections.Map

/**
 * Type union for task classes that accept multiple types of payload.
 *
 * Example:
 *
 * ```
 * Function fn;
 * LambdaInvoke.Builder.create(this, "Invoke with callback")
 * .lambdaFunction(fn)
 * .integrationPattern(IntegrationPattern.WAIT_FOR_TASK_TOKEN)
 * .payload(TaskInput.fromObject(Map.of(
 * "token", JsonPath.getTaskToken(),
 * "input", JsonPath.stringAt("$.someField"))))
 * .build();
 * ```
 */
public open class TaskInput(
  cdkObject: software.amazon.awscdk.services.stepfunctions.TaskInput,
) : CdkObject(cdkObject) {
  /**
   * type of task input.
   */
  public open fun type(): InputType = unwrap(this).getType().let(InputType::wrap)

  /**
   * payload for the corresponding input type.
   *
   * It can be a JSON-encoded object, context, data, etc.
   */
  public open fun `value`(): Any = unwrap(this).getValue()

  public companion object {
    public fun fromJsonPathAt(path: String): TaskInput =
        software.amazon.awscdk.services.stepfunctions.TaskInput.fromJsonPathAt(path).let(TaskInput::wrap)

    public fun fromObject(obj: Map): TaskInput =
        software.amazon.awscdk.services.stepfunctions.TaskInput.fromObject(obj.mapValues{CdkObjectWrappers.unwrap(it.value)}).let(TaskInput::wrap)

    public fun fromText(text: String): TaskInput =
        software.amazon.awscdk.services.stepfunctions.TaskInput.fromText(text).let(TaskInput::wrap)

    internal fun wrap(cdkObject: software.amazon.awscdk.services.stepfunctions.TaskInput): TaskInput
        = TaskInput(cdkObject)

    internal fun unwrap(wrapped: TaskInput): software.amazon.awscdk.services.stepfunctions.TaskInput
        = wrapped.cdkObject as software.amazon.awscdk.services.stepfunctions.TaskInput
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy