Interface IHttpInvokeJsonataProps
Properties for calling an external HTTP endpoint with HttpInvoke using JSONata.
Inherited Members
Namespace: Amazon.CDK.AWS.StepFunctions.Tasks
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IHttpInvokeJsonataProps : ITaskStateJsonataBaseProps, IStateBaseProps, ITaskStateBaseOptions, IAssignableStateOptions, IJsonataCommonOptions
Syntax (vb)
Public Interface IHttpInvokeJsonataProps Inherits ITaskStateJsonataBaseProps, IStateBaseProps, ITaskStateBaseOptions, IAssignableStateOptions, IJsonataCommonOptions
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
Properties
| ApiEndpoint | The API endpoint to call, relative to |
| ApiRoot | Permissions are granted to call all resources under this path. |
| Body | The body to send to the HTTP endpoint. |
| Connection | The EventBridge Connection to use for authentication. |
| Headers | The headers to send to the HTTP endpoint. |
| Method | The HTTP method to use. |
| QueryStringParameters | The query string parameters to send to the HTTP endpoint. |
| UrlEncodingFormat | Determines whether to apply URL encoding to the request body, and which array encoding format to use. |
Properties
ApiEndpoint
The API endpoint to call, relative to apiRoot.
TaskInput ApiEndpoint { get; }
Property Value
Remarks
ExampleMetadata: infused
Examples
TaskInput.FromText("path/to/resource");
ApiRoot
Permissions are granted to call all resources under this path.
string ApiRoot { get; }
Property Value
Remarks
ExampleMetadata: infused
Examples
"https://api.example.com";
Body
The body to send to the HTTP endpoint.
TaskInput? Body { get; }
Property Value
Remarks
Default: - No body is sent with the request.
Connection
The EventBridge Connection to use for authentication.
IConnection Connection { get; }
Property Value
Remarks
ExampleMetadata: infused
Headers
The headers to send to the HTTP endpoint.
TaskInput? Headers { get; }
Property Value
Remarks
Default: - No additional headers are added to the request.
Examples
TaskInput.FromObject(new Dictionary<string, object> { { "Content-Type", "application/json" } });
Method
The HTTP method to use.
TaskInput Method { get; }
Property Value
Remarks
ExampleMetadata: infused
Examples
TaskInput.FromText("GET");
QueryStringParameters
The query string parameters to send to the HTTP endpoint.
TaskInput? QueryStringParameters { get; }
Property Value
Remarks
Default: - No query string parameters are sent in the request.
UrlEncodingFormat
Determines whether to apply URL encoding to the request body, and which array encoding format to use.
URLEncodingFormat? UrlEncodingFormat { get; }
Property Value
Remarks
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