com.amazonaws.services.taxsettings.AWSTaxSettingsAsyncClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-sdk-taxsettings Show documentation
Show all versions of aws-java-sdk-taxsettings Show documentation
The AWS Java SDK for Tax Settings module holds the client classes that are used for communicating with Tax Settings Service
/*
* 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.taxsettings;
import javax.annotation.Generated;
import com.amazonaws.services.taxsettings.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing Tax Settings 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.
*
*
* You can use the tax setting API to programmatically set, modify, and delete the tax registration number (TRN),
* associated business legal name, and address (Collectively referred to as "TRN information"). You can also
* programmatically view TRN information and tax addresses ("Tax profiles").
*
*
* You can use this API to automate your TRN information settings instead of manually using the console.
*
*
* Service Endpoint
*
*
* -
*
* https://tax.us-east-1.amazonaws.com
*
*
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSTaxSettingsAsyncClient extends AWSTaxSettingsClient implements AWSTaxSettingsAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AWSTaxSettingsAsyncClientBuilder asyncBuilder() {
return AWSTaxSettingsAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on Tax Settings using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSTaxSettingsAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on Tax Settings using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSTaxSettingsAsyncClient(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 batchDeleteTaxRegistrationAsync(BatchDeleteTaxRegistrationRequest request) {
return batchDeleteTaxRegistrationAsync(request, null);
}
@Override
public java.util.concurrent.Future batchDeleteTaxRegistrationAsync(final BatchDeleteTaxRegistrationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final BatchDeleteTaxRegistrationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public BatchDeleteTaxRegistrationResult call() throws Exception {
BatchDeleteTaxRegistrationResult result = null;
try {
result = executeBatchDeleteTaxRegistration(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 batchPutTaxRegistrationAsync(BatchPutTaxRegistrationRequest request) {
return batchPutTaxRegistrationAsync(request, null);
}
@Override
public java.util.concurrent.Future batchPutTaxRegistrationAsync(final BatchPutTaxRegistrationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final BatchPutTaxRegistrationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public BatchPutTaxRegistrationResult call() throws Exception {
BatchPutTaxRegistrationResult result = null;
try {
result = executeBatchPutTaxRegistration(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 deleteTaxRegistrationAsync(DeleteTaxRegistrationRequest request) {
return deleteTaxRegistrationAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteTaxRegistrationAsync(final DeleteTaxRegistrationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteTaxRegistrationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteTaxRegistrationResult call() throws Exception {
DeleteTaxRegistrationResult result = null;
try {
result = executeDeleteTaxRegistration(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 getTaxRegistrationAsync(GetTaxRegistrationRequest request) {
return getTaxRegistrationAsync(request, null);
}
@Override
public java.util.concurrent.Future getTaxRegistrationAsync(final GetTaxRegistrationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetTaxRegistrationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetTaxRegistrationResult call() throws Exception {
GetTaxRegistrationResult result = null;
try {
result = executeGetTaxRegistration(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 getTaxRegistrationDocumentAsync(GetTaxRegistrationDocumentRequest request) {
return getTaxRegistrationDocumentAsync(request, null);
}
@Override
public java.util.concurrent.Future getTaxRegistrationDocumentAsync(final GetTaxRegistrationDocumentRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetTaxRegistrationDocumentRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetTaxRegistrationDocumentResult call() throws Exception {
GetTaxRegistrationDocumentResult result = null;
try {
result = executeGetTaxRegistrationDocument(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 listTaxRegistrationsAsync(ListTaxRegistrationsRequest request) {
return listTaxRegistrationsAsync(request, null);
}
@Override
public java.util.concurrent.Future listTaxRegistrationsAsync(final ListTaxRegistrationsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListTaxRegistrationsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListTaxRegistrationsResult call() throws Exception {
ListTaxRegistrationsResult result = null;
try {
result = executeListTaxRegistrations(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 putTaxRegistrationAsync(PutTaxRegistrationRequest request) {
return putTaxRegistrationAsync(request, null);
}
@Override
public java.util.concurrent.Future putTaxRegistrationAsync(final PutTaxRegistrationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PutTaxRegistrationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PutTaxRegistrationResult call() throws Exception {
PutTaxRegistrationResult result = null;
try {
result = executePutTaxRegistration(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