All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.sfn.DefaultSFNAsyncClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Step Functions module holds the client classes that are used for communicating with AWS Step Functions.

There is a newer version: 2.0.0-preview-11
Show newest version
/*
 * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.sfn;

import java.util.concurrent.CompletableFuture;
import javax.annotation.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.client.AsyncClientHandler;
import software.amazon.awssdk.core.client.ClientExecutionParams;
import software.amazon.awssdk.core.client.SdkAsyncClientHandler;
import software.amazon.awssdk.core.config.AsyncClientConfiguration;
import software.amazon.awssdk.core.exception.SdkServiceException;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.protocol.json.JsonClientMetadata;
import software.amazon.awssdk.core.protocol.json.JsonErrorResponseMetadata;
import software.amazon.awssdk.core.protocol.json.JsonErrorShapeMetadata;
import software.amazon.awssdk.core.protocol.json.JsonOperationMetadata;
import software.amazon.awssdk.core.protocol.json.SdkJsonProtocolFactory;
import software.amazon.awssdk.services.sfn.model.ActivityDoesNotExistException;
import software.amazon.awssdk.services.sfn.model.ActivityLimitExceededException;
import software.amazon.awssdk.services.sfn.model.ActivityWorkerLimitExceededException;
import software.amazon.awssdk.services.sfn.model.CreateActivityRequest;
import software.amazon.awssdk.services.sfn.model.CreateActivityResponse;
import software.amazon.awssdk.services.sfn.model.CreateStateMachineRequest;
import software.amazon.awssdk.services.sfn.model.CreateStateMachineResponse;
import software.amazon.awssdk.services.sfn.model.DeleteActivityRequest;
import software.amazon.awssdk.services.sfn.model.DeleteActivityResponse;
import software.amazon.awssdk.services.sfn.model.DeleteStateMachineRequest;
import software.amazon.awssdk.services.sfn.model.DeleteStateMachineResponse;
import software.amazon.awssdk.services.sfn.model.DescribeActivityRequest;
import software.amazon.awssdk.services.sfn.model.DescribeActivityResponse;
import software.amazon.awssdk.services.sfn.model.DescribeExecutionRequest;
import software.amazon.awssdk.services.sfn.model.DescribeExecutionResponse;
import software.amazon.awssdk.services.sfn.model.DescribeStateMachineForExecutionRequest;
import software.amazon.awssdk.services.sfn.model.DescribeStateMachineForExecutionResponse;
import software.amazon.awssdk.services.sfn.model.DescribeStateMachineRequest;
import software.amazon.awssdk.services.sfn.model.DescribeStateMachineResponse;
import software.amazon.awssdk.services.sfn.model.ExecutionAlreadyExistsException;
import software.amazon.awssdk.services.sfn.model.ExecutionDoesNotExistException;
import software.amazon.awssdk.services.sfn.model.ExecutionLimitExceededException;
import software.amazon.awssdk.services.sfn.model.GetActivityTaskRequest;
import software.amazon.awssdk.services.sfn.model.GetActivityTaskResponse;
import software.amazon.awssdk.services.sfn.model.GetExecutionHistoryRequest;
import software.amazon.awssdk.services.sfn.model.GetExecutionHistoryResponse;
import software.amazon.awssdk.services.sfn.model.InvalidArnException;
import software.amazon.awssdk.services.sfn.model.InvalidDefinitionException;
import software.amazon.awssdk.services.sfn.model.InvalidExecutionInputException;
import software.amazon.awssdk.services.sfn.model.InvalidNameException;
import software.amazon.awssdk.services.sfn.model.InvalidOutputException;
import software.amazon.awssdk.services.sfn.model.InvalidTokenException;
import software.amazon.awssdk.services.sfn.model.ListActivitiesRequest;
import software.amazon.awssdk.services.sfn.model.ListActivitiesResponse;
import software.amazon.awssdk.services.sfn.model.ListExecutionsRequest;
import software.amazon.awssdk.services.sfn.model.ListExecutionsResponse;
import software.amazon.awssdk.services.sfn.model.ListStateMachinesRequest;
import software.amazon.awssdk.services.sfn.model.ListStateMachinesResponse;
import software.amazon.awssdk.services.sfn.model.MissingRequiredParameterException;
import software.amazon.awssdk.services.sfn.model.SendTaskFailureRequest;
import software.amazon.awssdk.services.sfn.model.SendTaskFailureResponse;
import software.amazon.awssdk.services.sfn.model.SendTaskHeartbeatRequest;
import software.amazon.awssdk.services.sfn.model.SendTaskHeartbeatResponse;
import software.amazon.awssdk.services.sfn.model.SendTaskSuccessRequest;
import software.amazon.awssdk.services.sfn.model.SendTaskSuccessResponse;
import software.amazon.awssdk.services.sfn.model.StartExecutionRequest;
import software.amazon.awssdk.services.sfn.model.StartExecutionResponse;
import software.amazon.awssdk.services.sfn.model.StateMachineAlreadyExistsException;
import software.amazon.awssdk.services.sfn.model.StateMachineDeletingException;
import software.amazon.awssdk.services.sfn.model.StateMachineDoesNotExistException;
import software.amazon.awssdk.services.sfn.model.StateMachineLimitExceededException;
import software.amazon.awssdk.services.sfn.model.StopExecutionRequest;
import software.amazon.awssdk.services.sfn.model.StopExecutionResponse;
import software.amazon.awssdk.services.sfn.model.TaskDoesNotExistException;
import software.amazon.awssdk.services.sfn.model.TaskTimedOutException;
import software.amazon.awssdk.services.sfn.model.UpdateStateMachineRequest;
import software.amazon.awssdk.services.sfn.model.UpdateStateMachineResponse;
import software.amazon.awssdk.services.sfn.transform.CreateActivityRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.CreateActivityResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.CreateStateMachineRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.CreateStateMachineResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.DeleteActivityRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.DeleteActivityResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.DeleteStateMachineRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.DeleteStateMachineResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.DescribeActivityRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.DescribeActivityResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.DescribeExecutionRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.DescribeExecutionResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.DescribeStateMachineForExecutionRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.DescribeStateMachineForExecutionResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.DescribeStateMachineRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.DescribeStateMachineResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.GetActivityTaskRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.GetActivityTaskResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.GetExecutionHistoryRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.GetExecutionHistoryResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.ListActivitiesRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.ListActivitiesResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.ListExecutionsRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.ListExecutionsResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.ListStateMachinesRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.ListStateMachinesResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.SendTaskFailureRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.SendTaskFailureResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.SendTaskHeartbeatRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.SendTaskHeartbeatResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.SendTaskSuccessRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.SendTaskSuccessResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.StartExecutionRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.StartExecutionResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.StopExecutionRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.StopExecutionResponseUnmarshaller;
import software.amazon.awssdk.services.sfn.transform.UpdateStateMachineRequestMarshaller;
import software.amazon.awssdk.services.sfn.transform.UpdateStateMachineResponseUnmarshaller;

/**
 * Internal implementation of {@link SFNAsyncClient}.
 *
 * @see SFNAsyncClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultSFNAsyncClient implements SFNAsyncClient {
    private final AsyncClientHandler clientHandler;

    private final SdkJsonProtocolFactory protocolFactory;

    protected DefaultSFNAsyncClient(AsyncClientConfiguration clientConfiguration) {
        this.clientHandler = new SdkAsyncClientHandler(clientConfiguration, null);
        this.protocolFactory = init();
    }

    /**
     * 

* Creates an activity. An activity is a task which you write in any programming language and host on any machine * which has access to AWS Step Functions. Activities must poll Step Functions using the * GetActivityTask API action and respond using SendTask* API actions. This function lets * Step Functions know the existence of your activity and returns an identifier for use in a state machine and when * polling from the activity. *

* * @param createActivityRequest * @return A Java Future containing the result of the CreateActivity operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ActivityLimitExceededException The maximum number of activities has been reached. Existing activities * must be deleted before a new activity can be created.
  • *
  • InvalidNameException The provided name is invalid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.CreateActivity * @see AWS API * Documentation */ @Override public CompletableFuture createActivity(CreateActivityRequest createActivityRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateActivityResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new CreateActivityRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createActivityRequest)); } /** *

* Creates a state machine. A state machine consists of a collection of states that can do work (Task * states), determine to which states to transition next (Choice states), stop an execution with an * error (Fail states), and so on. State machines are specified using a JSON-based, structured * language. *

* * @param createStateMachineRequest * @return A Java Future containing the result of the CreateStateMachine operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • InvalidArnException The provided Amazon Resource Name (ARN) is invalid.
  • *
  • InvalidDefinitionException The provided Amazon States Language definition is invalid.
  • *
  • InvalidNameException The provided name is invalid.
  • *
  • StateMachineAlreadyExistsException A state machine with the same name but a different definition or * role ARN already exists.
  • *
  • StateMachineDeletingException The specified state machine is being deleted.
  • *
  • StateMachineLimitExceededException The maximum number of state machines has been reached. Existing * state machines must be deleted before a new state machine can be created.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.CreateStateMachine * @see AWS API * Documentation */ @Override public CompletableFuture createStateMachine(CreateStateMachineRequest createStateMachineRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateStateMachineResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new CreateStateMachineRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createStateMachineRequest)); } /** *

* Deletes an activity. *

* * @param deleteActivityRequest * @return A Java Future containing the result of the DeleteActivity operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • InvalidArnException The provided Amazon Resource Name (ARN) is invalid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.DeleteActivity * @see AWS API * Documentation */ @Override public CompletableFuture deleteActivity(DeleteActivityRequest deleteActivityRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteActivityResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new DeleteActivityRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteActivityRequest)); } /** *

* Deletes a state machine. This is an asynchronous operation: It sets the state machine's status to * DELETING and begins the deletion process. Each state machine execution is deleted the next time it * makes a state transition. *

* *

* The state machine itself is deleted after all executions are completed or deleted. *

*
* * @param deleteStateMachineRequest * @return A Java Future containing the result of the DeleteStateMachine operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • InvalidArnException The provided Amazon Resource Name (ARN) is invalid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.DeleteStateMachine * @see AWS API * Documentation */ @Override public CompletableFuture deleteStateMachine(DeleteStateMachineRequest deleteStateMachineRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteStateMachineResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new DeleteStateMachineRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteStateMachineRequest)); } /** *

* Describes an activity. *

* * @param describeActivityRequest * @return A Java Future containing the result of the DescribeActivity operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ActivityDoesNotExistException The specified activity does not exist.
  • *
  • InvalidArnException The provided Amazon Resource Name (ARN) is invalid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.DescribeActivity * @see AWS API * Documentation */ @Override public CompletableFuture describeActivity(DescribeActivityRequest describeActivityRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeActivityResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new DescribeActivityRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeActivityRequest)); } /** *

* Describes an execution. *

* * @param describeExecutionRequest * @return A Java Future containing the result of the DescribeExecution operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ExecutionDoesNotExistException The specified execution does not exist.
  • *
  • InvalidArnException The provided Amazon Resource Name (ARN) is invalid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.DescribeExecution * @see AWS API * Documentation */ @Override public CompletableFuture describeExecution(DescribeExecutionRequest describeExecutionRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeExecutionResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new DescribeExecutionRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeExecutionRequest)); } /** *

* Describes a state machine. *

* * @param describeStateMachineRequest * @return A Java Future containing the result of the DescribeStateMachine operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • InvalidArnException The provided Amazon Resource Name (ARN) is invalid.
  • *
  • StateMachineDoesNotExistException The specified state machine does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.DescribeStateMachine * @see AWS * API Documentation */ @Override public CompletableFuture describeStateMachine( DescribeStateMachineRequest describeStateMachineRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeStateMachineResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new DescribeStateMachineRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeStateMachineRequest)); } /** *

* Describes the state machine associated with a specific execution. *

* * @param describeStateMachineForExecutionRequest * @return A Java Future containing the result of the DescribeStateMachineForExecution operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ExecutionDoesNotExistException The specified execution does not exist.
  • *
  • InvalidArnException The provided Amazon Resource Name (ARN) is invalid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.DescribeStateMachineForExecution * @see AWS API Documentation */ @Override public CompletableFuture describeStateMachineForExecution( DescribeStateMachineForExecutionRequest describeStateMachineForExecutionRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeStateMachineForExecutionResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler .execute(new ClientExecutionParams() .withMarshaller(new DescribeStateMachineForExecutionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withInput(describeStateMachineForExecutionRequest)); } /** *

* Used by workers to retrieve a task (with the specified activity ARN) which has been scheduled for execution by a * running state machine. This initiates a long poll, where the service holds the HTTP connection open and responds * as soon as a task becomes available (i.e. an execution of a task of this type is needed.) The maximum time the * service holds on to the request before responding is 60 seconds. If no task is available within 60 seconds, the * poll returns a taskToken with a null string. *

* *

* Workers should set their client side socket timeout to at least 65 seconds (5 seconds higher than the maximum * time the service may hold the poll request). *

*
* * @param getActivityTaskRequest * @return A Java Future containing the result of the GetActivityTask operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ActivityDoesNotExistException The specified activity does not exist.
  • *
  • ActivityWorkerLimitExceededException The maximum number of workers concurrently polling for activity * tasks has been reached.
  • *
  • InvalidArnException The provided Amazon Resource Name (ARN) is invalid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.GetActivityTask * @see AWS API * Documentation */ @Override public CompletableFuture getActivityTask(GetActivityTaskRequest getActivityTaskRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetActivityTaskResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new GetActivityTaskRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getActivityTaskRequest)); } /** *

* Returns the history of the specified execution as a list of events. By default, the results are returned in * ascending order of the timeStamp of the events. Use the reverseOrder parameter to get * the latest events first. *

*

* If a nextToken is returned by a previous call, there are more results available. To retrieve the * next page of results, make the call again using the returned token in nextToken. Keep all other * arguments unchanged. *

* * @param getExecutionHistoryRequest * @return A Java Future containing the result of the GetExecutionHistory operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ExecutionDoesNotExistException The specified execution does not exist.
  • *
  • InvalidArnException The provided Amazon Resource Name (ARN) is invalid.
  • *
  • InvalidTokenException The provided token is invalid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.GetExecutionHistory * @see AWS API * Documentation */ @Override public CompletableFuture getExecutionHistory( GetExecutionHistoryRequest getExecutionHistoryRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetExecutionHistoryResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new GetExecutionHistoryRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getExecutionHistoryRequest)); } /** *

* Lists the existing activities. *

*

* If a nextToken is returned by a previous call, there are more results available. To retrieve the * next page of results, make the call again using the returned token in nextToken. Keep all other * arguments unchanged. *

* * @param listActivitiesRequest * @return A Java Future containing the result of the ListActivities operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • InvalidTokenException The provided token is invalid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.ListActivities * @see AWS API * Documentation */ @Override public CompletableFuture listActivities(ListActivitiesRequest listActivitiesRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListActivitiesResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new ListActivitiesRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listActivitiesRequest)); } /** *

* Lists the executions of a state machine that meet the filtering criteria. *

*

* If a nextToken is returned by a previous call, there are more results available. To retrieve the * next page of results, make the call again using the returned token in nextToken. Keep all other * arguments unchanged. *

* * @param listExecutionsRequest * @return A Java Future containing the result of the ListExecutions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • InvalidArnException The provided Amazon Resource Name (ARN) is invalid.
  • *
  • InvalidTokenException The provided token is invalid.
  • *
  • StateMachineDoesNotExistException The specified state machine does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.ListExecutions * @see AWS API * Documentation */ @Override public CompletableFuture listExecutions(ListExecutionsRequest listExecutionsRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListExecutionsResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new ListExecutionsRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listExecutionsRequest)); } /** *

* Lists the existing state machines. *

*

* If a nextToken is returned by a previous call, there are more results available. To retrieve the * next page of results, make the call again using the returned token in nextToken. Keep all other * arguments unchanged. *

* * @param listStateMachinesRequest * @return A Java Future containing the result of the ListStateMachines operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • InvalidTokenException The provided token is invalid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.ListStateMachines * @see AWS API * Documentation */ @Override public CompletableFuture listStateMachines(ListStateMachinesRequest listStateMachinesRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListStateMachinesResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new ListStateMachinesRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listStateMachinesRequest)); } /** *

* Used by workers to report that the task identified by the taskToken failed. *

* * @param sendTaskFailureRequest * @return A Java Future containing the result of the SendTaskFailure operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • TaskDoesNotExistException
  • *
  • InvalidTokenException The provided token is invalid.
  • *
  • TaskTimedOutException
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.SendTaskFailure * @see AWS API * Documentation */ @Override public CompletableFuture sendTaskFailure(SendTaskFailureRequest sendTaskFailureRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SendTaskFailureResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new SendTaskFailureRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(sendTaskFailureRequest)); } /** *

* Used by workers to report to the service that the task represented by the specified taskToken is * still making progress. This action resets the Heartbeat clock. The Heartbeat threshold * is specified in the state machine's Amazon States Language definition. This action does not in itself create an * event in the execution history. However, if the task times out, the execution history contains an * ActivityTimedOut event. *

* *

* The Timeout of a task, defined in the state machine's Amazon States Language definition, is its * maximum allowed duration, regardless of the number of SendTaskHeartbeat requests received. *

*
*

* This operation is only useful for long-lived tasks to report the liveliness of the task. *

*
* * @param sendTaskHeartbeatRequest * @return A Java Future containing the result of the SendTaskHeartbeat operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • TaskDoesNotExistException
  • *
  • InvalidTokenException The provided token is invalid.
  • *
  • TaskTimedOutException
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.SendTaskHeartbeat * @see AWS API * Documentation */ @Override public CompletableFuture sendTaskHeartbeat(SendTaskHeartbeatRequest sendTaskHeartbeatRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SendTaskHeartbeatResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new SendTaskHeartbeatRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(sendTaskHeartbeatRequest)); } /** *

* Used by workers to report that the task identified by the taskToken completed successfully. *

* * @param sendTaskSuccessRequest * @return A Java Future containing the result of the SendTaskSuccess operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • TaskDoesNotExistException
  • *
  • InvalidOutputException The provided JSON output data is invalid.
  • *
  • InvalidTokenException The provided token is invalid.
  • *
  • TaskTimedOutException
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.SendTaskSuccess * @see AWS API * Documentation */ @Override public CompletableFuture sendTaskSuccess(SendTaskSuccessRequest sendTaskSuccessRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SendTaskSuccessResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new SendTaskSuccessRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(sendTaskSuccessRequest)); } /** *

* Starts a state machine execution. *

* * @param startExecutionRequest * @return A Java Future containing the result of the StartExecution operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ExecutionLimitExceededException The maximum number of running executions has been reached. Running * executions must end or be stopped before a new execution can be started.
  • *
  • ExecutionAlreadyExistsException The execution has the same name as another execution * (but a different input).

    *

    * Executions with the same name and input are considered idempotent. *

    *
  • *
  • InvalidArnException The provided Amazon Resource Name (ARN) is invalid.
  • *
  • InvalidExecutionInputException The provided JSON input data is invalid.
  • *
  • InvalidNameException The provided name is invalid.
  • *
  • StateMachineDoesNotExistException The specified state machine does not exist.
  • *
  • StateMachineDeletingException The specified state machine is being deleted.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.StartExecution * @see AWS API * Documentation */ @Override public CompletableFuture startExecution(StartExecutionRequest startExecutionRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StartExecutionResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new StartExecutionRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(startExecutionRequest)); } /** *

* Stops an execution. *

* * @param stopExecutionRequest * @return A Java Future containing the result of the StopExecution operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ExecutionDoesNotExistException The specified execution does not exist.
  • *
  • InvalidArnException The provided Amazon Resource Name (ARN) is invalid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.StopExecution * @see AWS API * Documentation */ @Override public CompletableFuture stopExecution(StopExecutionRequest stopExecutionRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StopExecutionResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new StopExecutionRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(stopExecutionRequest)); } /** *

* Updates an existing state machine by modifying its definition and/or roleArn. Running * executions will continue to use the previous definition and roleArn. *

* *

* All StartExecution calls within a few seconds will use the updated definition and * roleArn. Executions started immediately after calling UpdateStateMachine may use the * previous state machine definition and roleArn. You must include at least one of * definition or roleArn or you will receive a MissingRequiredParameter * error. *

*
* * @param updateStateMachineRequest * @return A Java Future containing the result of the UpdateStateMachine operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • InvalidArnException The provided Amazon Resource Name (ARN) is invalid.
  • *
  • InvalidDefinitionException The provided Amazon States Language definition is invalid.
  • *
  • MissingRequiredParameterException Request is missing a required parameter. This error occurs if both * definition and roleArn are not specified.
  • *
  • StateMachineDeletingException The specified state machine is being deleted.
  • *
  • StateMachineDoesNotExistException The specified state machine does not exist.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • SFNException Base class for all service exceptions. Unknown exceptions will be thrown as an instance * of this type.
  • *
* @sample SFNAsyncClient.UpdateStateMachine * @see AWS API * Documentation */ @Override public CompletableFuture updateStateMachine(UpdateStateMachineRequest updateStateMachineRequest) { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateStateMachineResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withMarshaller(new UpdateStateMachineRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(updateStateMachineRequest)); } @Override public void close() { clientHandler.close(); } private software.amazon.awssdk.core.protocol.json.SdkJsonProtocolFactory init() { return new SdkJsonProtocolFactory(new JsonClientMetadata() .withProtocolVersion("1.0") .withSupportsCbor(false) .withSupportsIon(false) .withBaseServiceExceptionClass(software.amazon.awssdk.services.sfn.model.SFNException.class) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ActivityDoesNotExist").withModeledClass( ActivityDoesNotExistException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("StateMachineLimitExceeded").withModeledClass( StateMachineLimitExceededException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidToken").withModeledClass(InvalidTokenException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidDefinition").withModeledClass( InvalidDefinitionException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidName").withModeledClass(InvalidNameException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidOutput") .withModeledClass(InvalidOutputException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ActivityLimitExceeded").withModeledClass( ActivityLimitExceededException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("StateMachineAlreadyExists").withModeledClass( StateMachineAlreadyExistsException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ExecutionLimitExceeded").withModeledClass( ExecutionLimitExceededException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidExecutionInput").withModeledClass( InvalidExecutionInputException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidArn").withModeledClass(InvalidArnException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("StateMachineDeleting").withModeledClass( StateMachineDeletingException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ActivityWorkerLimitExceeded").withModeledClass( ActivityWorkerLimitExceededException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("TaskDoesNotExist").withModeledClass( TaskDoesNotExistException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("TaskTimedOut").withModeledClass(TaskTimedOutException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ExecutionAlreadyExists").withModeledClass( ExecutionAlreadyExistsException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("MissingRequiredParameter").withModeledClass( MissingRequiredParameterException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("StateMachineDoesNotExist").withModeledClass( StateMachineDoesNotExistException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ExecutionDoesNotExist").withModeledClass( ExecutionDoesNotExistException.class))); } private HttpResponseHandler createErrorResponseHandler() { return protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy