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

com.amazonaws.services.synthetics.AWSSyntheticsAsyncClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Synthetics module holds the client classes that are used for communicating with Synthetics Service

There is a newer version: 1.12.772
Show newest version
/*
 * Copyright 2019-2024 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 com.amazonaws.services.synthetics;

import javax.annotation.Generated;

import com.amazonaws.services.synthetics.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;

import java.util.concurrent.ExecutorService;

/**
 * Client for accessing Synthetics asynchronously. Each asynchronous method will return a Java Future object
 * representing the asynchronous operation; overloads which accept an {@code AsyncHandler} can be used to receive
 * notification when an asynchronous operation completes.
 * 

* Amazon CloudWatch Synthetics *

* You can use Amazon CloudWatch Synthetics to continually monitor your services. You can create and manage * canaries, which are modular, lightweight scripts that monitor your endpoints and APIs from the outside-in. You * can set up your canaries to run 24 hours a day, once per minute. The canaries help you check the availability and * latency of your web services and troubleshoot anomalies by investigating load time data, screenshots of the UI, logs, * and metrics. The canaries seamlessly integrate with CloudWatch ServiceLens to help you trace the causes of impacted * nodes in your applications. For more information, see Using ServiceLens to Monitor * the Health of Your Applications in the Amazon CloudWatch User Guide. *

*

* Before you create and manage canaries, be aware of the security considerations. For more information, see Security * Considerations for Synthetics Canaries. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AWSSyntheticsAsyncClient extends AWSSyntheticsClient implements AWSSyntheticsAsync { private static final int DEFAULT_THREAD_POOL_SIZE = 50; private final java.util.concurrent.ExecutorService executorService; public static AWSSyntheticsAsyncClientBuilder asyncBuilder() { return AWSSyntheticsAsyncClientBuilder.standard(); } /** * Constructs a new asynchronous client to invoke service methods on Synthetics using the specified parameters. * * @param asyncClientParams * Object providing client parameters. */ AWSSyntheticsAsyncClient(AwsAsyncClientParams asyncClientParams) { this(asyncClientParams, false); } /** * Constructs a new asynchronous client to invoke service methods on Synthetics using the specified parameters. * * @param asyncClientParams * Object providing client parameters. * @param endpointDiscoveryEnabled * true will enable endpoint discovery if the service supports it. */ AWSSyntheticsAsyncClient(AwsAsyncClientParams asyncClientParams, boolean endpointDiscoveryEnabled) { super(asyncClientParams, endpointDiscoveryEnabled); this.executorService = asyncClientParams.getExecutor(); } /** * Returns the executor service used by this client to execute async requests. * * @return The executor service used by this client to execute async requests. */ public ExecutorService getExecutorService() { return executorService; } @Override public java.util.concurrent.Future associateResourceAsync(AssociateResourceRequest request) { return associateResourceAsync(request, null); } @Override public java.util.concurrent.Future associateResourceAsync(final AssociateResourceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final AssociateResourceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public AssociateResourceResult call() throws Exception { AssociateResourceResult result = null; try { result = executeAssociateResource(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future createCanaryAsync(CreateCanaryRequest request) { return createCanaryAsync(request, null); } @Override public java.util.concurrent.Future createCanaryAsync(final CreateCanaryRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateCanaryRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateCanaryResult call() throws Exception { CreateCanaryResult result = null; try { result = executeCreateCanary(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future createGroupAsync(CreateGroupRequest request) { return createGroupAsync(request, null); } @Override public java.util.concurrent.Future createGroupAsync(final CreateGroupRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateGroupRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateGroupResult call() throws Exception { CreateGroupResult result = null; try { result = executeCreateGroup(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future deleteCanaryAsync(DeleteCanaryRequest request) { return deleteCanaryAsync(request, null); } @Override public java.util.concurrent.Future deleteCanaryAsync(final DeleteCanaryRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteCanaryRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteCanaryResult call() throws Exception { DeleteCanaryResult result = null; try { result = executeDeleteCanary(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future deleteGroupAsync(DeleteGroupRequest request) { return deleteGroupAsync(request, null); } @Override public java.util.concurrent.Future deleteGroupAsync(final DeleteGroupRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteGroupRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteGroupResult call() throws Exception { DeleteGroupResult result = null; try { result = executeDeleteGroup(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future describeCanariesAsync(DescribeCanariesRequest request) { return describeCanariesAsync(request, null); } @Override public java.util.concurrent.Future describeCanariesAsync(final DescribeCanariesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeCanariesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeCanariesResult call() throws Exception { DescribeCanariesResult result = null; try { result = executeDescribeCanaries(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future describeCanariesLastRunAsync(DescribeCanariesLastRunRequest request) { return describeCanariesLastRunAsync(request, null); } @Override public java.util.concurrent.Future describeCanariesLastRunAsync(final DescribeCanariesLastRunRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeCanariesLastRunRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeCanariesLastRunResult call() throws Exception { DescribeCanariesLastRunResult result = null; try { result = executeDescribeCanariesLastRun(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future describeRuntimeVersionsAsync(DescribeRuntimeVersionsRequest request) { return describeRuntimeVersionsAsync(request, null); } @Override public java.util.concurrent.Future describeRuntimeVersionsAsync(final DescribeRuntimeVersionsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeRuntimeVersionsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeRuntimeVersionsResult call() throws Exception { DescribeRuntimeVersionsResult result = null; try { result = executeDescribeRuntimeVersions(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future disassociateResourceAsync(DisassociateResourceRequest request) { return disassociateResourceAsync(request, null); } @Override public java.util.concurrent.Future disassociateResourceAsync(final DisassociateResourceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DisassociateResourceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DisassociateResourceResult call() throws Exception { DisassociateResourceResult result = null; try { result = executeDisassociateResource(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future getCanaryAsync(GetCanaryRequest request) { return getCanaryAsync(request, null); } @Override public java.util.concurrent.Future getCanaryAsync(final GetCanaryRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetCanaryRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetCanaryResult call() throws Exception { GetCanaryResult result = null; try { result = executeGetCanary(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future getCanaryRunsAsync(GetCanaryRunsRequest request) { return getCanaryRunsAsync(request, null); } @Override public java.util.concurrent.Future getCanaryRunsAsync(final GetCanaryRunsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetCanaryRunsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetCanaryRunsResult call() throws Exception { GetCanaryRunsResult result = null; try { result = executeGetCanaryRuns(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future getGroupAsync(GetGroupRequest request) { return getGroupAsync(request, null); } @Override public java.util.concurrent.Future getGroupAsync(final GetGroupRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetGroupRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetGroupResult call() throws Exception { GetGroupResult result = null; try { result = executeGetGroup(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future listAssociatedGroupsAsync(ListAssociatedGroupsRequest request) { return listAssociatedGroupsAsync(request, null); } @Override public java.util.concurrent.Future listAssociatedGroupsAsync(final ListAssociatedGroupsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListAssociatedGroupsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListAssociatedGroupsResult call() throws Exception { ListAssociatedGroupsResult result = null; try { result = executeListAssociatedGroups(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future listGroupResourcesAsync(ListGroupResourcesRequest request) { return listGroupResourcesAsync(request, null); } @Override public java.util.concurrent.Future listGroupResourcesAsync(final ListGroupResourcesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListGroupResourcesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListGroupResourcesResult call() throws Exception { ListGroupResourcesResult result = null; try { result = executeListGroupResources(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future listGroupsAsync(ListGroupsRequest request) { return listGroupsAsync(request, null); } @Override public java.util.concurrent.Future listGroupsAsync(final ListGroupsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListGroupsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListGroupsResult call() throws Exception { ListGroupsResult result = null; try { result = executeListGroups(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future listTagsForResourceAsync(ListTagsForResourceRequest request) { return listTagsForResourceAsync(request, null); } @Override public java.util.concurrent.Future listTagsForResourceAsync(final ListTagsForResourceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListTagsForResourceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListTagsForResourceResult call() throws Exception { ListTagsForResourceResult result = null; try { result = executeListTagsForResource(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future startCanaryAsync(StartCanaryRequest request) { return startCanaryAsync(request, null); } @Override public java.util.concurrent.Future startCanaryAsync(final StartCanaryRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final StartCanaryRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public StartCanaryResult call() throws Exception { StartCanaryResult result = null; try { result = executeStartCanary(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future stopCanaryAsync(StopCanaryRequest request) { return stopCanaryAsync(request, null); } @Override public java.util.concurrent.Future stopCanaryAsync(final StopCanaryRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final StopCanaryRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public StopCanaryResult call() throws Exception { StopCanaryResult result = null; try { result = executeStopCanary(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future tagResourceAsync(TagResourceRequest request) { return tagResourceAsync(request, null); } @Override public java.util.concurrent.Future tagResourceAsync(final TagResourceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final TagResourceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public TagResourceResult call() throws Exception { TagResourceResult result = null; try { result = executeTagResource(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future untagResourceAsync(UntagResourceRequest request) { return untagResourceAsync(request, null); } @Override public java.util.concurrent.Future untagResourceAsync(final UntagResourceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UntagResourceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UntagResourceResult call() throws Exception { UntagResourceResult result = null; try { result = executeUntagResource(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future updateCanaryAsync(UpdateCanaryRequest request) { return updateCanaryAsync(request, null); } @Override public java.util.concurrent.Future updateCanaryAsync(final UpdateCanaryRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateCanaryRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateCanaryResult call() throws Exception { UpdateCanaryResult result = null; try { result = executeUpdateCanary(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } /** * Shuts down the client, releasing all managed resources. This includes forcibly terminating all pending * asynchronous service calls. Clients who wish to give pending asynchronous service calls time to complete should * call {@code getExecutorService().shutdown()} followed by {@code getExecutorService().awaitTermination()} prior to * calling this method. */ @Override public void shutdown() { super.shutdown(); executorService.shutdownNow(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy