Show / Hide Table of Contents

Class HttpInvoke

A Step Functions Task to call a public third-party API.

Inheritance
object
State
TaskStateBase
HttpInvoke
Implements
IChainable
INextable
Inherited Members
TaskStateBase.AddCatch(IChainable, ICatchProps)
TaskStateBase.AddRetry(IRetryProps)
TaskStateBase.Metric(string, IMetricOptions)
TaskStateBase.MetricFailed(IMetricOptions)
TaskStateBase.MetricHeartbeatTimedOut(IMetricOptions)
TaskStateBase.MetricRunTime(IMetricOptions)
TaskStateBase.MetricScheduled(IMetricOptions)
TaskStateBase.MetricScheduleTime(IMetricOptions)
TaskStateBase.MetricStarted(IMetricOptions)
TaskStateBase.MetricSucceeded(IMetricOptions)
TaskStateBase.MetricTime(IMetricOptions)
TaskStateBase.MetricTimedOut(IMetricOptions)
TaskStateBase.Next(IChainable)
TaskStateBase.ToStateJson(QueryLanguage?)
TaskStateBase.WhenBoundToGraph(StateGraph)
TaskStateBase.EndStates
State.FilterNextables(State[])
State.FindReachableEndStates(State, IFindStateOptions)
State.FindReachableStates(State, IFindStateOptions)
State.PrefixStates(IConstruct, string)
State.AddBranch(StateGraph)
State.AddChoice(Condition, State, IChoiceTransitionOptions)
State.AddItemProcessor(StateGraph, IProcessorConfig)
State.AddIterator(StateGraph)
State.AddPrefix(string)
State.BindToGraph(StateGraph)
State.MakeDefault(State)
State.MakeNext(State)
State.RenderAssign(QueryLanguage?)
State.RenderBranches()
State.RenderChoices(QueryLanguage?)
State.RenderInputOutput()
State.RenderItemProcessor()
State.RenderIterator()
State.RenderNextEnd()
State.RenderQueryLanguage(QueryLanguage?)
State.RenderResultSelector()
State.RenderRetryCatch(QueryLanguage?)
State.ValidateState()
State.Branches
State.Id
State.StartState
State.StateId
State.Arguments
State.Assign
State.Comment
State.InputPath
State.OutputPath
State.Outputs
State.Parameters
State.QueryLanguage
State.ResultPath
State.ResultSelector
State.StateName
State.DefaultChoice
State.Iteration
State.Processor
State.ProcessorConfig
State.ProcessorMode
Namespace: Amazon.CDK.AWS.StepFunctions.Tasks
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class HttpInvoke : TaskStateBase, IChainable, INextable
Syntax (vb)
Public Class HttpInvoke Inherits TaskStateBase Implements IChainable, INextable
Remarks

ExampleMetadata: infused

Examples
using Amazon.CDK.AWS.Events;
            Connection connection;


            var getIssue = HttpInvoke.Jsonata(this, "Get Issue", new HttpInvokeJsonataProps {
                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 = new Dictionary<string, object> {
                    { "hostname", "{% $states.input.hostname %}" },
                    { "issue", "{% $parse($states.result.ResponseBody) %}" }
                }
            });

            var updateLabels = HttpInvoke.Jsonata(this, "Update Issue Labels", new HttpInvokeJsonataProps {
                Connection = connection,
                ApiRoot = "{% 'https://' & $states.input.hostname %}",
                ApiEndpoint = TaskInput.FromText("{% 'issues/' & $states.input.issue.id & 'labels' %}"),
                Method = TaskInput.FromText("POST"),
                Body = TaskInput.FromObject(new Dictionary<string, object> {
                    { "labels", "{% [$type, $component] %}" }
                })
            });
            var notMatchTitleTemplate = Pass.Jsonata(this, "Not Match Title Template");

            var definition = getIssue.Next(Choice.Jsonata(this, "Match Title Template?").When(Condition.Jsonata("{% $contains($issue.title, /(feat)|(fix)|(chore)(w*):.*/) %}"), updateLabels, new ChoiceTransitionOptions {
                Assign = new Dictionary<string, object> {
                    { "type", "{% $match($states.input.title, /(w*)((.*))/).groups[0] %}" },
                    { "component", "{% $match($states.input.title, /(w*)((.*))/).groups[1] %}" }
                }
            }).Otherwise(notMatchTitleTemplate));

            new StateMachine(this, "StateMachine", new StateMachineProps {
                DefinitionBody = DefinitionBody.FromChainable(definition),
                Timeout = Duration.Minutes(5),
                Comment = "automate issue labeling state machine"
            });

Synopsis

Constructors

HttpInvoke(Construct, string, IHttpInvokeProps)

A Step Functions Task to call a public third-party API.

Properties

TaskMetrics

A Step Functions Task to call a public third-party API.

TaskPolicies

A Step Functions Task to call a public third-party API.

Methods

BuildTaskPolicyStatements()

A Step Functions Task to call a public third-party API.

JsonPath(Construct, string, IHttpInvokeJsonPathProps)

A Step Functions Task to call a public third-party API using JSONPath.

Jsonata(Construct, string, IHttpInvokeJsonataProps)

A Step Functions Task to call a public third-party API using JSONata.

Constructors

HttpInvoke(Construct, string, IHttpInvokeProps)

A Step Functions Task to call a public third-party API.

public HttpInvoke(Construct scope, string id, IHttpInvokeProps props)
Parameters
scope Construct
id string

Descriptive identifier for this chainable.

props IHttpInvokeProps
Remarks

ExampleMetadata: infused

Properties

TaskMetrics

A Step Functions Task to call a public third-party API.

protected override ITaskMetricsConfig? TaskMetrics { get; }
Property Value

ITaskMetricsConfig

Overrides
TaskStateBase.TaskMetrics
Remarks

ExampleMetadata: infused

TaskPolicies

A Step Functions Task to call a public third-party API.

protected override PolicyStatement[]? TaskPolicies { get; }
Property Value

PolicyStatement[]

Overrides
TaskStateBase.TaskPolicies
Remarks

ExampleMetadata: infused

Methods

BuildTaskPolicyStatements()

A Step Functions Task to call a public third-party API.

protected virtual PolicyStatement[] BuildTaskPolicyStatements()
Returns

PolicyStatement[]

Remarks

ExampleMetadata: infused

Examples
using Amazon.CDK.AWS.Events;
            Connection connection;


            var getIssue = HttpInvoke.Jsonata(this, "Get Issue", new HttpInvokeJsonataProps {
                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 = new Dictionary<string, object> {
                    { "hostname", "{% $states.input.hostname %}" },
                    { "issue", "{% $parse($states.result.ResponseBody) %}" }
                }
            });

            var updateLabels = HttpInvoke.Jsonata(this, "Update Issue Labels", new HttpInvokeJsonataProps {
                Connection = connection,
                ApiRoot = "{% 'https://' & $states.input.hostname %}",
                ApiEndpoint = TaskInput.FromText("{% 'issues/' & $states.input.issue.id & 'labels' %}"),
                Method = TaskInput.FromText("POST"),
                Body = TaskInput.FromObject(new Dictionary<string, object> {
                    { "labels", "{% [$type, $component] %}" }
                })
            });
            var notMatchTitleTemplate = Pass.Jsonata(this, "Not Match Title Template");

            var definition = getIssue.Next(Choice.Jsonata(this, "Match Title Template?").When(Condition.Jsonata("{% $contains($issue.title, /(feat)|(fix)|(chore)(w*):.*/) %}"), updateLabels, new ChoiceTransitionOptions {
                Assign = new Dictionary<string, object> {
                    { "type", "{% $match($states.input.title, /(w*)((.*))/).groups[0] %}" },
                    { "component", "{% $match($states.input.title, /(w*)((.*))/).groups[1] %}" }
                }
            }).Otherwise(notMatchTitleTemplate));

            new StateMachine(this, "StateMachine", new StateMachineProps {
                DefinitionBody = DefinitionBody.FromChainable(definition),
                Timeout = Duration.Minutes(5),
                Comment = "automate issue labeling state machine"
            });

JsonPath(Construct, string, IHttpInvokeJsonPathProps)

A Step Functions Task to call a public third-party API using JSONPath.

public static HttpInvoke JsonPath(Construct scope, string id, IHttpInvokeJsonPathProps props)
Parameters
scope Construct
id string
props IHttpInvokeJsonPathProps
Returns

HttpInvoke

Remarks

ExampleMetadata: infused

Jsonata(Construct, string, IHttpInvokeJsonataProps)

A Step Functions Task to call a public third-party API using JSONata.

public static HttpInvoke Jsonata(Construct scope, string id, IHttpInvokeJsonataProps props)
Parameters
scope Construct
id string
props IHttpInvokeJsonataProps
Returns

HttpInvoke

Remarks

ExampleMetadata: infused

Implements

IChainable
INextable
Back to top Generated by DocFX