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

com.amazonaws.services.recyclebin.AmazonRecycleBinAsyncClient Maven / Gradle / Ivy

Go to download

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

The 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.recyclebin;

import javax.annotation.Generated;

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

import java.util.concurrent.ExecutorService;

/**
 * Client for accessing Amazon Recycle Bin 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.
 * 

*

* This is the Recycle Bin API Reference. This documentation provides descriptions and syntax for each of the * actions and data types in Recycle Bin. *

*

* Recycle Bin is a resource recovery feature that enables you to restore accidentally deleted snapshots and EBS-backed * AMIs. When using Recycle Bin, if your resources are deleted, they are retained in the Recycle Bin for a time period * that you specify. *

*

* You can restore a resource from the Recycle Bin at any time before its retention period expires. After you restore a * resource from the Recycle Bin, the resource is removed from the Recycle Bin, and you can then use it in the same way * you use any other resource of that type in your account. If the retention period expires and the resource is not * restored, the resource is permanently deleted from the Recycle Bin and is no longer available for recovery. For more * information about Recycle Bin, see * Recycle Bin in the Amazon Elastic Compute Cloud User Guide. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AmazonRecycleBinAsyncClient extends AmazonRecycleBinClient implements AmazonRecycleBinAsync { private static final int DEFAULT_THREAD_POOL_SIZE = 50; private final java.util.concurrent.ExecutorService executorService; public static AmazonRecycleBinAsyncClientBuilder asyncBuilder() { return AmazonRecycleBinAsyncClientBuilder.standard(); } /** * Constructs a new asynchronous client to invoke service methods on Amazon Recycle Bin using the specified * parameters. * * @param asyncClientParams * Object providing client parameters. */ AmazonRecycleBinAsyncClient(AwsAsyncClientParams asyncClientParams) { this(asyncClientParams, false); } /** * Constructs a new asynchronous client to invoke service methods on Amazon Recycle Bin using the specified * parameters. * * @param asyncClientParams * Object providing client parameters. * @param endpointDiscoveryEnabled * true will enable endpoint discovery if the service supports it. */ AmazonRecycleBinAsyncClient(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 createRuleAsync(CreateRuleRequest request) { return createRuleAsync(request, null); } @Override public java.util.concurrent.Future createRuleAsync(final CreateRuleRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateRuleRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateRuleResult call() throws Exception { CreateRuleResult result = null; try { result = executeCreateRule(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 deleteRuleAsync(DeleteRuleRequest request) { return deleteRuleAsync(request, null); } @Override public java.util.concurrent.Future deleteRuleAsync(final DeleteRuleRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteRuleRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteRuleResult call() throws Exception { DeleteRuleResult result = null; try { result = executeDeleteRule(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 getRuleAsync(GetRuleRequest request) { return getRuleAsync(request, null); } @Override public java.util.concurrent.Future getRuleAsync(final GetRuleRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetRuleRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetRuleResult call() throws Exception { GetRuleResult result = null; try { result = executeGetRule(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 listRulesAsync(ListRulesRequest request) { return listRulesAsync(request, null); } @Override public java.util.concurrent.Future listRulesAsync(final ListRulesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListRulesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListRulesResult call() throws Exception { ListRulesResult result = null; try { result = executeListRules(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 lockRuleAsync(LockRuleRequest request) { return lockRuleAsync(request, null); } @Override public java.util.concurrent.Future lockRuleAsync(final LockRuleRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final LockRuleRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public LockRuleResult call() throws Exception { LockRuleResult result = null; try { result = executeLockRule(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 unlockRuleAsync(UnlockRuleRequest request) { return unlockRuleAsync(request, null); } @Override public java.util.concurrent.Future unlockRuleAsync(final UnlockRuleRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UnlockRuleRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UnlockRuleResult call() throws Exception { UnlockRuleResult result = null; try { result = executeUnlockRule(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 updateRuleAsync(UpdateRuleRequest request) { return updateRuleAsync(request, null); } @Override public java.util.concurrent.Future updateRuleAsync(final UpdateRuleRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateRuleRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateRuleResult call() throws Exception { UpdateRuleResult result = null; try { result = executeUpdateRule(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 - 2025 Weber Informatics LLC | Privacy Policy