internal virtual CreateStateMachineResponse CreateStateMachine(CreateStateMachineRequest request) { var marshaller = new CreateStateMachineRequestMarshaller(); var unmarshaller = CreateStateMachineResponseUnmarshaller.Instance; return(Invoke <CreateStateMachineRequest, CreateStateMachineResponse>(request, marshaller, unmarshaller)); }
/// <summary> /// Initiates the asynchronous execution of the CreateStateMachine operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateStateMachine operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/CreateStateMachine">REST API Reference for CreateStateMachine Operation</seealso> public virtual Task <CreateStateMachineResponse> CreateStateMachineAsync(CreateStateMachineRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateStateMachineRequestMarshaller(); var unmarshaller = CreateStateMachineResponseUnmarshaller.Instance; return(InvokeAsync <CreateStateMachineRequest, CreateStateMachineResponse>(request, marshaller, unmarshaller, cancellationToken)); }
internal virtual CreateStateMachineResponse CreateStateMachine(CreateStateMachineRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = CreateStateMachineRequestMarshaller.Instance; options.ResponseUnmarshaller = CreateStateMachineResponseUnmarshaller.Instance; return(Invoke <CreateStateMachineResponse>(request, options)); }
/// <summary> /// Initiates the asynchronous execution of the CreateStateMachine operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateStateMachine operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/CreateStateMachine">REST API Reference for CreateStateMachine Operation</seealso> public virtual Task <CreateStateMachineResponse> CreateStateMachineAsync(CreateStateMachineRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = CreateStateMachineRequestMarshaller.Instance; options.ResponseUnmarshaller = CreateStateMachineResponseUnmarshaller.Instance; return(InvokeAsync <CreateStateMachineResponse>(request, options, cancellationToken)); }
public async Task Can_be_invoked_from_step_functions_local() { // 1. Create the StepFunctions Client var credentials = new BasicAWSCredentials("not", "used"); var config = new AmazonStepFunctionsConfig { ServiceURL = _stepFunctionsServiceUrl.ToString() }; var client = new AmazonStepFunctionsClient(credentials, config); // 2. Create step machine with a single task the invokes a lambda function // The FunctionName contains the lambda to be invoked. var request = new CreateStateMachineRequest { Name = "Foo", Type = StateMachineType.STANDARD, Definition = @"{ ""Comment"": ""A Hello World example demonstrating various state types of the Amazon States Language"", ""StartAt"": ""Invoke Lambda function"", ""States"": { ""Invoke Lambda function"": { ""Type"": ""Task"", ""Resource"": ""arn:aws:states:::lambda:invoke"", ""Parameters"": { ""FunctionName"": ""arn:aws:lambda:us-east-1:123456789012:function:SimpleLambdaFunction:$LATEST"", ""Payload"": { ""Input.$"": ""$.Payload"" } }, ""End"": true } } }" }; var createStateMachineResponse = await client.CreateStateMachineAsync(request); // 3. Create a StepFunction execution. var startExecutionRequest = new StartExecutionRequest { Name = Guid.NewGuid().ToString(), StateMachineArn = createStateMachineResponse.StateMachineArn, Input = @"{ ""Payload"": { ""Foo"": ""Bar"" } }" }; var startExecutionResponse = await client.StartExecutionAsync(startExecutionRequest); var getExecutionHistoryRequest = new GetExecutionHistoryRequest { ExecutionArn = startExecutionResponse.ExecutionArn, IncludeExecutionData = true, }; // 4. Poll and wait for the while (true) { var getExecutionHistoryResponse = await client.GetExecutionHistoryAsync(getExecutionHistoryRequest); var historyEvent = getExecutionHistoryResponse.Events.Last(); if (historyEvent.ExecutionSucceededEventDetails != null) { _outputHelper.WriteLine("Execution succeeded"); _outputHelper.WriteLine(historyEvent.ExecutionSucceededEventDetails.Output); break; } if (historyEvent.ExecutionFailedEventDetails != null) { _outputHelper.WriteLine("Execution failed"); _outputHelper.WriteLine(historyEvent.ExecutionFailedEventDetails.Cause); break; } } }