Class HttpInvoke
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.services.stepfunctions.State
software.amazon.awscdk.services.stepfunctions.TaskStateBase
software.amazon.awscdk.services.stepfunctions.tasks.HttpInvoke
- All Implemented Interfaces:
IChainable,INextable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-13T16:10:15.382Z")
@Stability(Stable)
public class HttpInvoke
extends TaskStateBase
A Step Functions Task to call a public third-party API.
Example:
import software.amazon.awscdk.services.events.*;
Connection connection;
HttpInvoke getIssue = HttpInvoke.jsonata(this, "Get Issue", HttpInvokeJsonataProps.builder()
.connection(connection)
.apiRoot("{% 'https://' & $states.input.hostname %}")
.apiEndpoint(TaskInput.fromText("{% 'issues/' & $states.input.issue.id %}"))
.method(TaskInput.fromText("GET"))
// Parse the API call result to object and set to the variables
.assign(Map.of(
"hostname", "{% $states.input.hostname %}",
"issue", "{% $parse($states.result.ResponseBody) %}"))
.build());
HttpInvoke updateLabels = HttpInvoke.jsonata(this, "Update Issue Labels", HttpInvokeJsonataProps.builder()
.connection(connection)
.apiRoot("{% 'https://' & $states.input.hostname %}")
.apiEndpoint(TaskInput.fromText("{% 'issues/' & $states.input.issue.id & 'labels' %}"))
.method(TaskInput.fromText("POST"))
.body(TaskInput.fromObject(Map.of(
"labels", "{% [$type, $component] %}")))
.build());
Pass notMatchTitleTemplate = Pass.jsonata(this, "Not Match Title Template");
Chain definition = getIssue.next(Choice.jsonata(this, "Match Title Template?").when(Condition.jsonata("{% $contains($issue.title, /(feat)|(fix)|(chore)(w*):.*/) %}"), updateLabels, ChoiceTransitionOptions.builder()
.assign(Map.of(
"type", "{% $match($states.input.title, /(w*)((.*))/).groups[0] %}",
"component", "{% $match($states.input.title, /(w*)((.*))/).groups[1] %}"))
.build()).otherwise(notMatchTitleTemplate));
StateMachine.Builder.create(this, "StateMachine")
.definitionBody(DefinitionBody.fromChainable(definition))
.timeout(Duration.minutes(5))
.comment("automate issue labeling state machine")
.build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.stepfunctions.IChainable
IChainable.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.stepfunctions.INextable
INextable.Jsii$Default -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHttpInvoke(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedHttpInvoke(software.amazon.jsii.JsiiObjectRef objRef) HttpInvoke(software.constructs.Construct scope, String id, HttpInvokeProps props) -
Method Summary
Modifier and TypeMethodDescriptionprotected List<PolicyStatement> protected TaskMetricsConfigprotected List<PolicyStatement> static HttpInvokejsonata(software.constructs.Construct scope, String id, HttpInvokeJsonataProps props) A Step Functions Task to call a public third-party API using JSONata.static HttpInvokejsonPath(software.constructs.Construct scope, String id, HttpInvokeJsonPathProps props) A Step Functions Task to call a public third-party API using JSONPath.Methods inherited from class software.amazon.awscdk.services.stepfunctions.TaskStateBase
addCatch, addCatch, addRetry, addRetry, getEndStates, metric, metric, metricFailed, metricFailed, metricHeartbeatTimedOut, metricHeartbeatTimedOut, metricRunTime, metricRunTime, metricScheduled, metricScheduled, metricScheduleTime, metricScheduleTime, metricStarted, metricStarted, metricSucceeded, metricSucceeded, metricTime, metricTime, metricTimedOut, metricTimedOut, next, toStateJson, toStateJson, whenBoundToGraphMethods inherited from class software.amazon.awscdk.services.stepfunctions.State
addBranch, addChoice, addChoice, addItemProcessor, addItemProcessor, addIterator, addPrefix, bindToGraph, filterNextables, findReachableEndStates, findReachableEndStates, findReachableStates, findReachableStates, getArguments, getAssign, getBranches, getComment, getDefaultChoice, getId, getInputPath, getIteration, getOutputPath, getOutputs, getParameters, getProcessor, getProcessorConfig, getProcessorMode, getQueryLanguage, getResultPath, getResultSelector, getStartState, getStateId, getStateName, makeDefault, makeNext, prefixStates, renderAssign, renderAssign, renderBranches, renderChoices, renderChoices, renderInputOutput, renderItemProcessor, renderIterator, renderNextEnd, renderQueryLanguage, renderQueryLanguage, renderResultSelector, renderRetryCatch, renderRetryCatch, setDefaultChoice, setIteration, setProcessor, setProcessorConfig, setProcessorMode, validateStateMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
HttpInvoke
protected HttpInvoke(software.amazon.jsii.JsiiObjectRef objRef) -
HttpInvoke
protected HttpInvoke(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
HttpInvoke
@Stability(Stable) public HttpInvoke(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull HttpInvokeProps props) - Parameters:
scope- This parameter is required.id- Descriptive identifier for this chainable. This parameter is required.props- This parameter is required.
-
-
Method Details
-
jsonata
@Stability(Stable) @NotNull public static HttpInvoke jsonata(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull HttpInvokeJsonataProps props) A Step Functions Task to call a public third-party API using JSONata.- Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
jsonPath
@Stability(Stable) @NotNull public static HttpInvoke jsonPath(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull HttpInvokeJsonPathProps props) A Step Functions Task to call a public third-party API using JSONPath.- Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
buildTaskPolicyStatements
-
getTaskMetrics
- Specified by:
getTaskMetricsin classTaskStateBase
-
getTaskPolicies
- Specified by:
getTaskPoliciesin classTaskStateBase
-