HttpInvokeProps

class aws_cdk.aws_stepfunctions_tasks.HttpInvokeProps(*, comment=None, credentials=None, heartbeat=None, heartbeat_timeout=None, input_path=None, integration_pattern=None, output_path=None, result_path=None, result_selector=None, state_name=None, task_timeout=None, timeout=None, api_endpoint, api_root, connection, method, body=None, headers=None, query_string_parameters=None, url_encoding_format=None)

Bases: TaskStateBaseProps

Properties for calling an external HTTP endpoint with HttpInvoke.

Parameters:
  • comment (Optional[str]) – An optional description for this state. Default: - No comment

  • credentials (Union[Credentials, Dict[str, Any], None]) – Credentials for an IAM Role that the State Machine assumes for executing the task. This enables cross-account resource invocations. Default: - None (Task is executed using the State Machine’s execution role)

  • heartbeat (Optional[Duration]) – (deprecated) Timeout for the heartbeat. Default: - None

  • heartbeat_timeout (Optional[Timeout]) – Timeout for the heartbeat. [disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface Default: - None

  • input_path (Optional[str]) – 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: - The entire task input (JSON path ‘$’)

  • integration_pattern (Optional[IntegrationPattern]) – AWS Step Functions integrates with services directly in the Amazon States Language. You can control these AWS services using service integration patterns. Depending on the AWS Service, the Service Integration Pattern availability will vary. Default: - IntegrationPattern.REQUEST_RESPONSE for most tasks. IntegrationPattern.RUN_JOB for the following exceptions: BatchSubmitJob, EmrAddStep, EmrCreateCluster, EmrTerminationCluster, and EmrContainersStartJobRun.

  • output_path (Optional[str]) – JSONPath expression to select select a portion of the state output to pass to the next state. May also be the special value JsonPath.DISCARD, which will cause the effective output to be the empty object {}. Default: - The entire JSON node determined by the state input, the task result, and resultPath is passed to the next state (JSON path ‘$’)

  • result_path (Optional[str]) – 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: - Replaces the entire input with the result (JSON path ‘$’)

  • result_selector (Optional[Mapping[str, Any]]) – 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

  • state_name (Optional[str]) – Optional name for this state. Default: - The construct ID will be used as state name

  • task_timeout (Optional[Timeout]) – Timeout for the task. [disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface Default: - None

  • timeout (Optional[Duration]) – (deprecated) Timeout for the task. Default: - None

  • api_endpoint (TaskInput) – The API endpoint to call, relative to apiRoot.

  • api_root (str) – Permissions are granted to call all resources under this path.

  • connection (IConnection) – The EventBridge Connection to use for authentication.

  • method (TaskInput) – The HTTP method to use.

  • body (Optional[TaskInput]) – The body to send to the HTTP endpoint. Default: - No body is sent with the request.

  • headers (Optional[TaskInput]) – The headers to send to the HTTP endpoint. Default: - No additional headers are added to the request.

  • query_string_parameters (Optional[TaskInput]) – The query string parameters to send to the HTTP endpoint. Default: - No query string parameters are sent in the request.

  • url_encoding_format (Optional[URLEncodingFormat]) – Determines whether to apply URL encoding to the request body, and which array encoding format to use. URLEncodingFormat.NONE passes the JSON-serialized RequestBody field as the HTTP request body. Otherwise, the HTTP request body is the URL-encoded form data of the RequestBody field using the specified array encoding format, and the Content-Type header is set to application/x-www-form-urlencoded. Default: - URLEncodingFormat.NONE

ExampleMetadata:

infused

Example:

import aws_cdk.aws_events as events


connection = events.Connection(self, "Connection",
    authorization=events.Authorization.basic("username", SecretValue.unsafe_plain_text("password"))
)

tasks.HttpInvoke(self, "Invoke HTTP API",
    api_root="https://api.example.com",
    api_endpoint=sfn.TaskInput.from_text("https://api.example.com/path/to/resource"),
    body=sfn.TaskInput.from_object({"foo": "bar"}),
    connection=connection,
    headers=sfn.TaskInput.from_object({"Content-Type": "application/json"}),
    method=sfn.TaskInput.from_text("POST"),
    query_string_parameters=sfn.TaskInput.from_object({"id": "123"}),
    url_encoding_format=tasks.URLEncodingFormat.BRACKETS
)

Attributes

api_endpoint

The API endpoint to call, relative to apiRoot.

Example:

sfn.TaskInput.from_text("path/to/resource")
api_root

Permissions are granted to call all resources under this path.

Example:

"https://api.example.com"
body

The body to send to the HTTP endpoint.

Default:
  • No body is sent with the request.

comment

An optional description for this state.

Default:
  • No comment

connection

The EventBridge Connection to use for authentication.

credentials

Credentials for an IAM Role that the State Machine assumes for executing the task.

This enables cross-account resource invocations.

Default:
  • None (Task is executed using the State Machine’s execution role)

See:

https://docs.aws.amazon.com/step-functions/latest/dg/concepts-access-cross-acct-resources.html

headers

The headers to send to the HTTP endpoint.

Default:
  • No additional headers are added to the request.

Example:

sfn.TaskInput.from_object({"Content-Type": "application/json"})
heartbeat

(deprecated) Timeout for the heartbeat.

Default:
  • None

Deprecated:

use heartbeatTimeout

Stability:

deprecated

heartbeat_timeout

Timeout for the heartbeat.

[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface

Default:
  • None

input_path

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:
  • The entire task input (JSON path ‘$’)

integration_pattern

AWS Step Functions integrates with services directly in the Amazon States Language.

You can control these AWS services using service integration patterns.

Depending on the AWS Service, the Service Integration Pattern availability will vary.

Default:

  • IntegrationPattern.REQUEST_RESPONSE for most tasks.

IntegrationPattern.RUN_JOB for the following exceptions: BatchSubmitJob, EmrAddStep, EmrCreateCluster, EmrTerminationCluster, and EmrContainersStartJobRun.

See:

https://docs.aws.amazon.com/step-functions/latest/dg/connect-supported-services.html

method

The HTTP method to use.

Example:

sfn.TaskInput.from_text("GET")
output_path

JSONPath expression to select select a portion of the state output to pass to the next state.

May also be the special value JsonPath.DISCARD, which will cause the effective output to be the empty object {}.

Default:

  • The entire JSON node determined by the state input, the task result,

and resultPath is passed to the next state (JSON path ‘$’)

query_string_parameters

The query string parameters to send to the HTTP endpoint.

Default:
  • No query string parameters are sent in the request.

result_path

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:
  • Replaces the entire input with the result (JSON path ‘$’)

result_selector

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

See:

https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-resultselector

state_name

Optional name for this state.

Default:
  • The construct ID will be used as state name

task_timeout

Timeout for the task.

[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface

Default:
  • None

timeout

(deprecated) Timeout for the task.

Default:
  • None

Deprecated:

use taskTimeout

Stability:

deprecated

url_encoding_format

Determines whether to apply URL encoding to the request body, and which array encoding format to use.

URLEncodingFormat.NONE passes the JSON-serialized RequestBody field as the HTTP request body. Otherwise, the HTTP request body is the URL-encoded form data of the RequestBody field using the specified array encoding format, and the Content-Type header is set to application/x-www-form-urlencoded.

Default:
  • URLEncodingFormat.NONE