com.amazonaws.services.signer.AWSsignerAsyncClient Maven / Gradle / Ivy
/*
* Copyright 2015-2020 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.signer;
import javax.annotation.Generated;
import com.amazonaws.services.signer.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing signer 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.
*
*
* With code signing for IoT, you can sign code that you create for any IoT device that is supported by Amazon Web
* Services (AWS). Code signing is available through Amazon FreeRTOS and AWS IoT Device Management, and integrated with AWS Certificate Manager (ACM). In order to sign code, you
* import a third-party code signing certificate with ACM that is used to sign updates in Amazon FreeRTOS and AWS IoT
* Device Management. For general information about using code signing, see the Code Signing for IoT Developer Guide.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSsignerAsyncClient extends AWSsignerClient implements AWSsignerAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AWSsignerAsyncClientBuilder asyncBuilder() {
return AWSsignerAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on signer using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSsignerAsyncClient(AwsAsyncClientParams asyncClientParams) {
super(asyncClientParams);
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 cancelSigningProfileAsync(CancelSigningProfileRequest request) {
return cancelSigningProfileAsync(request, null);
}
@Override
public java.util.concurrent.Future cancelSigningProfileAsync(final CancelSigningProfileRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CancelSigningProfileRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CancelSigningProfileResult call() throws Exception {
CancelSigningProfileResult result = null;
try {
result = executeCancelSigningProfile(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 describeSigningJobAsync(DescribeSigningJobRequest request) {
return describeSigningJobAsync(request, null);
}
@Override
public java.util.concurrent.Future describeSigningJobAsync(final DescribeSigningJobRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeSigningJobRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeSigningJobResult call() throws Exception {
DescribeSigningJobResult result = null;
try {
result = executeDescribeSigningJob(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 getSigningPlatformAsync(GetSigningPlatformRequest request) {
return getSigningPlatformAsync(request, null);
}
@Override
public java.util.concurrent.Future getSigningPlatformAsync(final GetSigningPlatformRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetSigningPlatformRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetSigningPlatformResult call() throws Exception {
GetSigningPlatformResult result = null;
try {
result = executeGetSigningPlatform(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 getSigningProfileAsync(GetSigningProfileRequest request) {
return getSigningProfileAsync(request, null);
}
@Override
public java.util.concurrent.Future getSigningProfileAsync(final GetSigningProfileRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetSigningProfileRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetSigningProfileResult call() throws Exception {
GetSigningProfileResult result = null;
try {
result = executeGetSigningProfile(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 listSigningJobsAsync(ListSigningJobsRequest request) {
return listSigningJobsAsync(request, null);
}
@Override
public java.util.concurrent.Future listSigningJobsAsync(final ListSigningJobsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListSigningJobsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListSigningJobsResult call() throws Exception {
ListSigningJobsResult result = null;
try {
result = executeListSigningJobs(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 listSigningPlatformsAsync(ListSigningPlatformsRequest request) {
return listSigningPlatformsAsync(request, null);
}
@Override
public java.util.concurrent.Future listSigningPlatformsAsync(final ListSigningPlatformsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListSigningPlatformsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListSigningPlatformsResult call() throws Exception {
ListSigningPlatformsResult result = null;
try {
result = executeListSigningPlatforms(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 listSigningProfilesAsync(ListSigningProfilesRequest request) {
return listSigningProfilesAsync(request, null);
}
@Override
public java.util.concurrent.Future listSigningProfilesAsync(final ListSigningProfilesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListSigningProfilesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListSigningProfilesResult call() throws Exception {
ListSigningProfilesResult result = null;
try {
result = executeListSigningProfiles(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 putSigningProfileAsync(PutSigningProfileRequest request) {
return putSigningProfileAsync(request, null);
}
@Override
public java.util.concurrent.Future putSigningProfileAsync(final PutSigningProfileRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PutSigningProfileRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PutSigningProfileResult call() throws Exception {
PutSigningProfileResult result = null;
try {
result = executePutSigningProfile(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 startSigningJobAsync(StartSigningJobRequest request) {
return startSigningJobAsync(request, null);
}
@Override
public java.util.concurrent.Future startSigningJobAsync(final StartSigningJobRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StartSigningJobRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StartSigningJobResult call() throws Exception {
StartSigningJobResult result = null;
try {
result = executeStartSigningJob(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;
}
});
}
/**
* 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