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

com.amazonaws.services.codegurusecurity.AmazonCodeGuruSecurityAsyncClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon CodeGuru Security module holds the client classes that are used for communicating with Amazon CodeGuru Security 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.codegurusecurity;

import javax.annotation.Generated;

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

import java.util.concurrent.ExecutorService;

/**
 * Client for accessing Amazon CodeGuru Security 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 CodeGuru Security is in preview release and is subject to change. *

* *

* This section provides documentation for the Amazon CodeGuru Security API operations. CodeGuru Security is a service * that uses program analysis and machine learning to detect security policy violations and vulnerabilities, and * recommends ways to address these security risks. *

*

* By proactively detecting and providing recommendations for addressing security risks, CodeGuru Security improves the * overall security of your application code. For more information about CodeGuru Security, see the Amazon CodeGuru * Security User Guide. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AmazonCodeGuruSecurityAsyncClient extends AmazonCodeGuruSecurityClient implements AmazonCodeGuruSecurityAsync { private static final int DEFAULT_THREAD_POOL_SIZE = 50; private final java.util.concurrent.ExecutorService executorService; public static AmazonCodeGuruSecurityAsyncClientBuilder asyncBuilder() { return AmazonCodeGuruSecurityAsyncClientBuilder.standard(); } /** * Constructs a new asynchronous client to invoke service methods on Amazon CodeGuru Security using the specified * parameters. * * @param asyncClientParams * Object providing client parameters. */ AmazonCodeGuruSecurityAsyncClient(AwsAsyncClientParams asyncClientParams) { this(asyncClientParams, false); } /** * Constructs a new asynchronous client to invoke service methods on Amazon CodeGuru Security using the specified * parameters. * * @param asyncClientParams * Object providing client parameters. * @param endpointDiscoveryEnabled * true will enable endpoint discovery if the service supports it. */ AmazonCodeGuruSecurityAsyncClient(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 batchGetFindingsAsync(BatchGetFindingsRequest request) { return batchGetFindingsAsync(request, null); } @Override public java.util.concurrent.Future batchGetFindingsAsync(final BatchGetFindingsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final BatchGetFindingsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public BatchGetFindingsResult call() throws Exception { BatchGetFindingsResult result = null; try { result = executeBatchGetFindings(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 createScanAsync(CreateScanRequest request) { return createScanAsync(request, null); } @Override public java.util.concurrent.Future createScanAsync(final CreateScanRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateScanRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateScanResult call() throws Exception { CreateScanResult result = null; try { result = executeCreateScan(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 createUploadUrlAsync(CreateUploadUrlRequest request) { return createUploadUrlAsync(request, null); } @Override public java.util.concurrent.Future createUploadUrlAsync(final CreateUploadUrlRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateUploadUrlRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateUploadUrlResult call() throws Exception { CreateUploadUrlResult result = null; try { result = executeCreateUploadUrl(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 getAccountConfigurationAsync(GetAccountConfigurationRequest request) { return getAccountConfigurationAsync(request, null); } @Override public java.util.concurrent.Future getAccountConfigurationAsync(final GetAccountConfigurationRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetAccountConfigurationRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetAccountConfigurationResult call() throws Exception { GetAccountConfigurationResult result = null; try { result = executeGetAccountConfiguration(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 getFindingsAsync(GetFindingsRequest request) { return getFindingsAsync(request, null); } @Override public java.util.concurrent.Future getFindingsAsync(final GetFindingsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetFindingsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetFindingsResult call() throws Exception { GetFindingsResult result = null; try { result = executeGetFindings(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 getMetricsSummaryAsync(GetMetricsSummaryRequest request) { return getMetricsSummaryAsync(request, null); } @Override public java.util.concurrent.Future getMetricsSummaryAsync(final GetMetricsSummaryRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetMetricsSummaryRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetMetricsSummaryResult call() throws Exception { GetMetricsSummaryResult result = null; try { result = executeGetMetricsSummary(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 getScanAsync(GetScanRequest request) { return getScanAsync(request, null); } @Override public java.util.concurrent.Future getScanAsync(final GetScanRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetScanRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetScanResult call() throws Exception { GetScanResult result = null; try { result = executeGetScan(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 listFindingsMetricsAsync(ListFindingsMetricsRequest request) { return listFindingsMetricsAsync(request, null); } @Override public java.util.concurrent.Future listFindingsMetricsAsync(final ListFindingsMetricsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListFindingsMetricsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListFindingsMetricsResult call() throws Exception { ListFindingsMetricsResult result = null; try { result = executeListFindingsMetrics(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 listScansAsync(ListScansRequest request) { return listScansAsync(request, null); } @Override public java.util.concurrent.Future listScansAsync(final ListScansRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListScansRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListScansResult call() throws Exception { ListScansResult result = null; try { result = executeListScans(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 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 updateAccountConfigurationAsync(UpdateAccountConfigurationRequest request) { return updateAccountConfigurationAsync(request, null); } @Override public java.util.concurrent.Future updateAccountConfigurationAsync(final UpdateAccountConfigurationRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateAccountConfigurationRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateAccountConfigurationResult call() throws Exception { UpdateAccountConfigurationResult result = null; try { result = executeUpdateAccountConfiguration(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