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

com.amazonaws.services.backupgateway.AWSBackupGatewayAsyncClient Maven / Gradle / Ivy

Go to download

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

There is a newer version: 1.12.772
Show newest version
/*
 * Copyright 2017-2022 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.backupgateway;

import javax.annotation.Generated;

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

import java.util.concurrent.ExecutorService;

/**
 * Client for accessing AWS Backup Gateway 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.
 * 

*

* Backup gateway *

* Backup gateway connects Backup to your hypervisor, so you can create, store, and restore backups of your virtual * machines (VMs) anywhere, whether on-premises or in the VMware Cloud (VMC) on Amazon Web Services. *

*

* Add on-premises resources by connecting to a hypervisor through a gateway. Backup will automatically discover the * resources in your hypervisor. *

*

* Use Backup to assign virtual or on-premises resources to a backup plan, or run on-demand backups. Once you have * backed up your resources, you can view them and restore them like any resource supported by Backup. *

*

* To download the Amazon Web Services software to get started, navigate to the Backup console, choose Gateways, * then choose Create gateway. *

*

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AWSBackupGatewayAsyncClient extends AWSBackupGatewayClient implements AWSBackupGatewayAsync { private static final int DEFAULT_THREAD_POOL_SIZE = 50; private final java.util.concurrent.ExecutorService executorService; public static AWSBackupGatewayAsyncClientBuilder asyncBuilder() { return AWSBackupGatewayAsyncClientBuilder.standard(); } /** * Constructs a new asynchronous client to invoke service methods on AWS Backup Gateway using the specified * parameters. * * @param asyncClientParams * Object providing client parameters. */ AWSBackupGatewayAsyncClient(AwsAsyncClientParams asyncClientParams) { this(asyncClientParams, false); } /** * Constructs a new asynchronous client to invoke service methods on AWS Backup Gateway using the specified * parameters. * * @param asyncClientParams * Object providing client parameters. * @param endpointDiscoveryEnabled * true will enable endpoint discovery if the service supports it. */ AWSBackupGatewayAsyncClient(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 associateGatewayToServerAsync(AssociateGatewayToServerRequest request) { return associateGatewayToServerAsync(request, null); } @Override public java.util.concurrent.Future associateGatewayToServerAsync(final AssociateGatewayToServerRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final AssociateGatewayToServerRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public AssociateGatewayToServerResult call() throws Exception { AssociateGatewayToServerResult result = null; try { result = executeAssociateGatewayToServer(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 createGatewayAsync(CreateGatewayRequest request) { return createGatewayAsync(request, null); } @Override public java.util.concurrent.Future createGatewayAsync(final CreateGatewayRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateGatewayRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateGatewayResult call() throws Exception { CreateGatewayResult result = null; try { result = executeCreateGateway(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 deleteGatewayAsync(DeleteGatewayRequest request) { return deleteGatewayAsync(request, null); } @Override public java.util.concurrent.Future deleteGatewayAsync(final DeleteGatewayRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteGatewayRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteGatewayResult call() throws Exception { DeleteGatewayResult result = null; try { result = executeDeleteGateway(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 deleteHypervisorAsync(DeleteHypervisorRequest request) { return deleteHypervisorAsync(request, null); } @Override public java.util.concurrent.Future deleteHypervisorAsync(final DeleteHypervisorRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteHypervisorRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteHypervisorResult call() throws Exception { DeleteHypervisorResult result = null; try { result = executeDeleteHypervisor(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 disassociateGatewayFromServerAsync(DisassociateGatewayFromServerRequest request) { return disassociateGatewayFromServerAsync(request, null); } @Override public java.util.concurrent.Future disassociateGatewayFromServerAsync( final DisassociateGatewayFromServerRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DisassociateGatewayFromServerRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DisassociateGatewayFromServerResult call() throws Exception { DisassociateGatewayFromServerResult result = null; try { result = executeDisassociateGatewayFromServer(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 importHypervisorConfigurationAsync(ImportHypervisorConfigurationRequest request) { return importHypervisorConfigurationAsync(request, null); } @Override public java.util.concurrent.Future importHypervisorConfigurationAsync( final ImportHypervisorConfigurationRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ImportHypervisorConfigurationRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ImportHypervisorConfigurationResult call() throws Exception { ImportHypervisorConfigurationResult result = null; try { result = executeImportHypervisorConfiguration(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 listGatewaysAsync(ListGatewaysRequest request) { return listGatewaysAsync(request, null); } @Override public java.util.concurrent.Future listGatewaysAsync(final ListGatewaysRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListGatewaysRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListGatewaysResult call() throws Exception { ListGatewaysResult result = null; try { result = executeListGateways(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 listHypervisorsAsync(ListHypervisorsRequest request) { return listHypervisorsAsync(request, null); } @Override public java.util.concurrent.Future listHypervisorsAsync(final ListHypervisorsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListHypervisorsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListHypervisorsResult call() throws Exception { ListHypervisorsResult result = null; try { result = executeListHypervisors(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 listVirtualMachinesAsync(ListVirtualMachinesRequest request) { return listVirtualMachinesAsync(request, null); } @Override public java.util.concurrent.Future listVirtualMachinesAsync(final ListVirtualMachinesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListVirtualMachinesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListVirtualMachinesResult call() throws Exception { ListVirtualMachinesResult result = null; try { result = executeListVirtualMachines(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 putMaintenanceStartTimeAsync(PutMaintenanceStartTimeRequest request) { return putMaintenanceStartTimeAsync(request, null); } @Override public java.util.concurrent.Future putMaintenanceStartTimeAsync(final PutMaintenanceStartTimeRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final PutMaintenanceStartTimeRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public PutMaintenanceStartTimeResult call() throws Exception { PutMaintenanceStartTimeResult result = null; try { result = executePutMaintenanceStartTime(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 testHypervisorConfigurationAsync(TestHypervisorConfigurationRequest request) { return testHypervisorConfigurationAsync(request, null); } @Override public java.util.concurrent.Future testHypervisorConfigurationAsync(final TestHypervisorConfigurationRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final TestHypervisorConfigurationRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public TestHypervisorConfigurationResult call() throws Exception { TestHypervisorConfigurationResult result = null; try { result = executeTestHypervisorConfiguration(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 updateGatewayInformationAsync(UpdateGatewayInformationRequest request) { return updateGatewayInformationAsync(request, null); } @Override public java.util.concurrent.Future updateGatewayInformationAsync(final UpdateGatewayInformationRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateGatewayInformationRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateGatewayInformationResult call() throws Exception { UpdateGatewayInformationResult result = null; try { result = executeUpdateGatewayInformation(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 updateHypervisorAsync(UpdateHypervisorRequest request) { return updateHypervisorAsync(request, null); } @Override public java.util.concurrent.Future updateHypervisorAsync(final UpdateHypervisorRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateHypervisorRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateHypervisorResult call() throws Exception { UpdateHypervisorResult result = null; try { result = executeUpdateHypervisor(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