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

software.amazon.awssdk.services.sfn.DefaultSFNClient 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 javax.annotation.Generated;
import software.amazon.awssdk.AmazonServiceException;
import software.amazon.awssdk.SdkBaseException;
import software.amazon.awssdk.SdkClientException;
import software.amazon.awssdk.annotation.SdkInternalApi;
import software.amazon.awssdk.client.AwsSyncClientParams;
import software.amazon.awssdk.client.ClientExecutionParams;
import software.amazon.awssdk.client.ClientHandler;
import software.amazon.awssdk.client.ClientHandlerParams;
import software.amazon.awssdk.client.SdkClientHandler;
import software.amazon.awssdk.http.HttpResponseHandler;
import software.amazon.awssdk.protocol.json.JsonClientMetadata;
import software.amazon.awssdk.protocol.json.JsonErrorResponseMetadata;
import software.amazon.awssdk.protocol.json.JsonErrorShapeMetadata;
import software.amazon.awssdk.protocol.json.JsonOperationMetadata;
import software.amazon.awssdk.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.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.SFNException;
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.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.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;

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

    private final SdkJsonProtocolFactory protocolFactory;

    private final AwsSyncClientParams clientParams;

    protected DefaultSFNClient(AwsSyncClientParams clientParams) {
        this.clientHandler = new SdkClientHandler(new ClientHandlerParams().withClientParams(clientParams)
                .withCalculateCrc32FromCompressedDataEnabled(false));
        this.clientParams = clientParams;
        this.protocolFactory = init();
    }

    /**
     * 

* Creates an activity. *

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

* Creates a state machine. *

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

* Deletes an activity. *

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

* Deletes a state machine. This is an asynchronous operation-- it sets the state machine's status to "DELETING" and * begins the delete process. *

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

* Describes an activity. *

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

* Describes an execution. *

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

* Describes a state machine. *

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

* Used by workers to retrieve a task (with the specified activity ARN) 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 will * return an empty result, that is, the taskToken returned is an empty 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 Result of the GetActivityTask operation returned by the service. * @throws ActivityDoesNotExistException * The specified activity does not exist. * @throws ActivityWorkerLimitExceededException * The maximum number of workers concurrently polling for activity tasks has been reached. * @throws InvalidArnException * The provided Amazon Resource Name (ARN) is invalid. * @throws SdkBaseException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc) * @throws SFNException * Base exception for all service exceptions. Unknown exceptions will be thrown as an instance of this type * @sample SFNClient.GetActivityTask * @see AWS API * Documentation */ @Override public GetActivityTaskResponse getActivityTask(GetActivityTaskRequest getActivityTaskRequest) throws ActivityDoesNotExistException, ActivityWorkerLimitExceededException, InvalidArnException, SdkBaseException, SdkClientException, SFNException { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true), new GetActivityTaskResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withInput(getActivityTaskRequest).withMarshaller(new GetActivityTaskRequestMarshaller(protocolFactory))); } /** *

* 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. The results may be split into multiple pages. To retrieve subsequent pages, make the * call again using the nextToken returned by the previous call. *

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

* Lists the existing activities. The results may be split into multiple pages. To retrieve subsequent pages, make * the call again using the nextToken returned by the previous call. *

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

* Lists the executions of a state machine that meet the filtering criteria. The results may be split into multiple * pages. To retrieve subsequent pages, make the call again using the nextToken returned by the * previous call. *

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

* Lists the existing state machines. The results may be split into multiple pages. To retrieve subsequent pages, * make the call again using the nextToken returned by the previous call. *

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

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

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

* 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 will contain 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 Result of the SendTaskHeartbeat operation returned by the service. * @throws TaskDoesNotExistException * @throws InvalidTokenException * The provided token is invalid. * @throws TaskTimedOutException * @throws SdkBaseException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc) * @throws SFNException * Base exception for all service exceptions. Unknown exceptions will be thrown as an instance of this type * @sample SFNClient.SendTaskHeartbeat * @see AWS API * Documentation */ @Override public SendTaskHeartbeatResponse sendTaskHeartbeat(SendTaskHeartbeatRequest sendTaskHeartbeatRequest) throws TaskDoesNotExistException, InvalidTokenException, TaskTimedOutException, SdkBaseException, SdkClientException, SFNException { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true), new SendTaskHeartbeatResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withInput(sendTaskHeartbeatRequest).withMarshaller(new SendTaskHeartbeatRequestMarshaller(protocolFactory))); } /** *

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

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

* Starts a state machine execution. *

* * @param startExecutionRequest * @return Result of the StartExecution operation returned by the service. * @throws ExecutionLimitExceededException * The maximum number of running executions has been reached. Running executions must end or be stopped * before a new execution can be started. * @throws ExecutionAlreadyExistsException * An execution with the same name already exists. * @throws InvalidArnException * The provided Amazon Resource Name (ARN) is invalid. * @throws InvalidExecutionInputException * The provided JSON input data is invalid. * @throws InvalidNameException * The provided name is invalid. * @throws StateMachineDoesNotExistException * The specified state machine does not exist. * @throws StateMachineDeletingException * The specified state machine is being deleted. * @throws SdkBaseException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc) * @throws SFNException * Base exception for all service exceptions. Unknown exceptions will be thrown as an instance of this type * @sample SFNClient.StartExecution * @see AWS API * Documentation */ @Override public StartExecutionResponse startExecution(StartExecutionRequest startExecutionRequest) throws ExecutionLimitExceededException, ExecutionAlreadyExistsException, InvalidArnException, InvalidExecutionInputException, InvalidNameException, StateMachineDoesNotExistException, StateMachineDeletingException, SdkBaseException, SdkClientException, SFNException { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true), new StartExecutionResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withInput(startExecutionRequest).withMarshaller(new StartExecutionRequestMarshaller(protocolFactory))); } /** *

* Stops an execution. *

* * @param stopExecutionRequest * @return Result of the StopExecution operation returned by the service. * @throws ExecutionDoesNotExistException * The specified execution does not exist. * @throws InvalidArnException * The provided Amazon Resource Name (ARN) is invalid. * @throws SdkBaseException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc) * @throws SFNException * Base exception for all service exceptions. Unknown exceptions will be thrown as an instance of this type * @sample SFNClient.StopExecution * @see AWS API * Documentation */ @Override public StopExecutionResponse stopExecution(StopExecutionRequest stopExecutionRequest) throws ExecutionDoesNotExistException, InvalidArnException, SdkBaseException, SdkClientException, SFNException { HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true), new StopExecutionResponseUnmarshaller()); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(); return clientHandler.execute(new ClientExecutionParams() .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withInput(stopExecutionRequest).withMarshaller(new StopExecutionRequestMarshaller(protocolFactory))); } private HttpResponseHandler createErrorResponseHandler() { return protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata()); } private software.amazon.awssdk.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("StateMachineDoesNotExist").withModeledClass( StateMachineDoesNotExistException.class)) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ExecutionDoesNotExist").withModeledClass( ExecutionDoesNotExistException.class))); } @Override public void close() throws Exception { clientHandler.close(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy