
software.amazon.awssdk.services.macie2.DefaultMacie2AsyncClient Maven / Gradle / Ivy
/*
* Copyright 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 software.amazon.awssdk.services.macie2;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ScheduledExecutorService;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.AsyncClientHandler;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.util.VersionInfo;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.services.macie2.model.AcceptInvitationRequest;
import software.amazon.awssdk.services.macie2.model.AcceptInvitationResponse;
import software.amazon.awssdk.services.macie2.model.AccessDeniedException;
import software.amazon.awssdk.services.macie2.model.BatchGetCustomDataIdentifiersRequest;
import software.amazon.awssdk.services.macie2.model.BatchGetCustomDataIdentifiersResponse;
import software.amazon.awssdk.services.macie2.model.ConflictException;
import software.amazon.awssdk.services.macie2.model.CreateAllowListRequest;
import software.amazon.awssdk.services.macie2.model.CreateAllowListResponse;
import software.amazon.awssdk.services.macie2.model.CreateClassificationJobRequest;
import software.amazon.awssdk.services.macie2.model.CreateClassificationJobResponse;
import software.amazon.awssdk.services.macie2.model.CreateCustomDataIdentifierRequest;
import software.amazon.awssdk.services.macie2.model.CreateCustomDataIdentifierResponse;
import software.amazon.awssdk.services.macie2.model.CreateFindingsFilterRequest;
import software.amazon.awssdk.services.macie2.model.CreateFindingsFilterResponse;
import software.amazon.awssdk.services.macie2.model.CreateInvitationsRequest;
import software.amazon.awssdk.services.macie2.model.CreateInvitationsResponse;
import software.amazon.awssdk.services.macie2.model.CreateMemberRequest;
import software.amazon.awssdk.services.macie2.model.CreateMemberResponse;
import software.amazon.awssdk.services.macie2.model.CreateSampleFindingsRequest;
import software.amazon.awssdk.services.macie2.model.CreateSampleFindingsResponse;
import software.amazon.awssdk.services.macie2.model.DeclineInvitationsRequest;
import software.amazon.awssdk.services.macie2.model.DeclineInvitationsResponse;
import software.amazon.awssdk.services.macie2.model.DeleteAllowListRequest;
import software.amazon.awssdk.services.macie2.model.DeleteAllowListResponse;
import software.amazon.awssdk.services.macie2.model.DeleteCustomDataIdentifierRequest;
import software.amazon.awssdk.services.macie2.model.DeleteCustomDataIdentifierResponse;
import software.amazon.awssdk.services.macie2.model.DeleteFindingsFilterRequest;
import software.amazon.awssdk.services.macie2.model.DeleteFindingsFilterResponse;
import software.amazon.awssdk.services.macie2.model.DeleteInvitationsRequest;
import software.amazon.awssdk.services.macie2.model.DeleteInvitationsResponse;
import software.amazon.awssdk.services.macie2.model.DeleteMemberRequest;
import software.amazon.awssdk.services.macie2.model.DeleteMemberResponse;
import software.amazon.awssdk.services.macie2.model.DescribeBucketsRequest;
import software.amazon.awssdk.services.macie2.model.DescribeBucketsResponse;
import software.amazon.awssdk.services.macie2.model.DescribeClassificationJobRequest;
import software.amazon.awssdk.services.macie2.model.DescribeClassificationJobResponse;
import software.amazon.awssdk.services.macie2.model.DescribeOrganizationConfigurationRequest;
import software.amazon.awssdk.services.macie2.model.DescribeOrganizationConfigurationResponse;
import software.amazon.awssdk.services.macie2.model.DisableMacieRequest;
import software.amazon.awssdk.services.macie2.model.DisableMacieResponse;
import software.amazon.awssdk.services.macie2.model.DisableOrganizationAdminAccountRequest;
import software.amazon.awssdk.services.macie2.model.DisableOrganizationAdminAccountResponse;
import software.amazon.awssdk.services.macie2.model.DisassociateFromAdministratorAccountRequest;
import software.amazon.awssdk.services.macie2.model.DisassociateFromAdministratorAccountResponse;
import software.amazon.awssdk.services.macie2.model.DisassociateFromMasterAccountRequest;
import software.amazon.awssdk.services.macie2.model.DisassociateFromMasterAccountResponse;
import software.amazon.awssdk.services.macie2.model.DisassociateMemberRequest;
import software.amazon.awssdk.services.macie2.model.DisassociateMemberResponse;
import software.amazon.awssdk.services.macie2.model.EnableMacieRequest;
import software.amazon.awssdk.services.macie2.model.EnableMacieResponse;
import software.amazon.awssdk.services.macie2.model.EnableOrganizationAdminAccountRequest;
import software.amazon.awssdk.services.macie2.model.EnableOrganizationAdminAccountResponse;
import software.amazon.awssdk.services.macie2.model.GetAdministratorAccountRequest;
import software.amazon.awssdk.services.macie2.model.GetAdministratorAccountResponse;
import software.amazon.awssdk.services.macie2.model.GetAllowListRequest;
import software.amazon.awssdk.services.macie2.model.GetAllowListResponse;
import software.amazon.awssdk.services.macie2.model.GetAutomatedDiscoveryConfigurationRequest;
import software.amazon.awssdk.services.macie2.model.GetAutomatedDiscoveryConfigurationResponse;
import software.amazon.awssdk.services.macie2.model.GetBucketStatisticsRequest;
import software.amazon.awssdk.services.macie2.model.GetBucketStatisticsResponse;
import software.amazon.awssdk.services.macie2.model.GetClassificationExportConfigurationRequest;
import software.amazon.awssdk.services.macie2.model.GetClassificationExportConfigurationResponse;
import software.amazon.awssdk.services.macie2.model.GetClassificationScopeRequest;
import software.amazon.awssdk.services.macie2.model.GetClassificationScopeResponse;
import software.amazon.awssdk.services.macie2.model.GetCustomDataIdentifierRequest;
import software.amazon.awssdk.services.macie2.model.GetCustomDataIdentifierResponse;
import software.amazon.awssdk.services.macie2.model.GetFindingStatisticsRequest;
import software.amazon.awssdk.services.macie2.model.GetFindingStatisticsResponse;
import software.amazon.awssdk.services.macie2.model.GetFindingsFilterRequest;
import software.amazon.awssdk.services.macie2.model.GetFindingsFilterResponse;
import software.amazon.awssdk.services.macie2.model.GetFindingsPublicationConfigurationRequest;
import software.amazon.awssdk.services.macie2.model.GetFindingsPublicationConfigurationResponse;
import software.amazon.awssdk.services.macie2.model.GetFindingsRequest;
import software.amazon.awssdk.services.macie2.model.GetFindingsResponse;
import software.amazon.awssdk.services.macie2.model.GetInvitationsCountRequest;
import software.amazon.awssdk.services.macie2.model.GetInvitationsCountResponse;
import software.amazon.awssdk.services.macie2.model.GetMacieSessionRequest;
import software.amazon.awssdk.services.macie2.model.GetMacieSessionResponse;
import software.amazon.awssdk.services.macie2.model.GetMasterAccountRequest;
import software.amazon.awssdk.services.macie2.model.GetMasterAccountResponse;
import software.amazon.awssdk.services.macie2.model.GetMemberRequest;
import software.amazon.awssdk.services.macie2.model.GetMemberResponse;
import software.amazon.awssdk.services.macie2.model.GetResourceProfileRequest;
import software.amazon.awssdk.services.macie2.model.GetResourceProfileResponse;
import software.amazon.awssdk.services.macie2.model.GetRevealConfigurationRequest;
import software.amazon.awssdk.services.macie2.model.GetRevealConfigurationResponse;
import software.amazon.awssdk.services.macie2.model.GetSensitiveDataOccurrencesAvailabilityRequest;
import software.amazon.awssdk.services.macie2.model.GetSensitiveDataOccurrencesAvailabilityResponse;
import software.amazon.awssdk.services.macie2.model.GetSensitiveDataOccurrencesRequest;
import software.amazon.awssdk.services.macie2.model.GetSensitiveDataOccurrencesResponse;
import software.amazon.awssdk.services.macie2.model.GetSensitivityInspectionTemplateRequest;
import software.amazon.awssdk.services.macie2.model.GetSensitivityInspectionTemplateResponse;
import software.amazon.awssdk.services.macie2.model.GetUsageStatisticsRequest;
import software.amazon.awssdk.services.macie2.model.GetUsageStatisticsResponse;
import software.amazon.awssdk.services.macie2.model.GetUsageTotalsRequest;
import software.amazon.awssdk.services.macie2.model.GetUsageTotalsResponse;
import software.amazon.awssdk.services.macie2.model.InternalServerException;
import software.amazon.awssdk.services.macie2.model.ListAllowListsRequest;
import software.amazon.awssdk.services.macie2.model.ListAllowListsResponse;
import software.amazon.awssdk.services.macie2.model.ListClassificationJobsRequest;
import software.amazon.awssdk.services.macie2.model.ListClassificationJobsResponse;
import software.amazon.awssdk.services.macie2.model.ListClassificationScopesRequest;
import software.amazon.awssdk.services.macie2.model.ListClassificationScopesResponse;
import software.amazon.awssdk.services.macie2.model.ListCustomDataIdentifiersRequest;
import software.amazon.awssdk.services.macie2.model.ListCustomDataIdentifiersResponse;
import software.amazon.awssdk.services.macie2.model.ListFindingsFiltersRequest;
import software.amazon.awssdk.services.macie2.model.ListFindingsFiltersResponse;
import software.amazon.awssdk.services.macie2.model.ListFindingsRequest;
import software.amazon.awssdk.services.macie2.model.ListFindingsResponse;
import software.amazon.awssdk.services.macie2.model.ListInvitationsRequest;
import software.amazon.awssdk.services.macie2.model.ListInvitationsResponse;
import software.amazon.awssdk.services.macie2.model.ListManagedDataIdentifiersRequest;
import software.amazon.awssdk.services.macie2.model.ListManagedDataIdentifiersResponse;
import software.amazon.awssdk.services.macie2.model.ListMembersRequest;
import software.amazon.awssdk.services.macie2.model.ListMembersResponse;
import software.amazon.awssdk.services.macie2.model.ListOrganizationAdminAccountsRequest;
import software.amazon.awssdk.services.macie2.model.ListOrganizationAdminAccountsResponse;
import software.amazon.awssdk.services.macie2.model.ListResourceProfileArtifactsRequest;
import software.amazon.awssdk.services.macie2.model.ListResourceProfileArtifactsResponse;
import software.amazon.awssdk.services.macie2.model.ListResourceProfileDetectionsRequest;
import software.amazon.awssdk.services.macie2.model.ListResourceProfileDetectionsResponse;
import software.amazon.awssdk.services.macie2.model.ListSensitivityInspectionTemplatesRequest;
import software.amazon.awssdk.services.macie2.model.ListSensitivityInspectionTemplatesResponse;
import software.amazon.awssdk.services.macie2.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.macie2.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.macie2.model.Macie2Exception;
import software.amazon.awssdk.services.macie2.model.Macie2Request;
import software.amazon.awssdk.services.macie2.model.PutClassificationExportConfigurationRequest;
import software.amazon.awssdk.services.macie2.model.PutClassificationExportConfigurationResponse;
import software.amazon.awssdk.services.macie2.model.PutFindingsPublicationConfigurationRequest;
import software.amazon.awssdk.services.macie2.model.PutFindingsPublicationConfigurationResponse;
import software.amazon.awssdk.services.macie2.model.ResourceNotFoundException;
import software.amazon.awssdk.services.macie2.model.SearchResourcesRequest;
import software.amazon.awssdk.services.macie2.model.SearchResourcesResponse;
import software.amazon.awssdk.services.macie2.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.macie2.model.TagResourceRequest;
import software.amazon.awssdk.services.macie2.model.TagResourceResponse;
import software.amazon.awssdk.services.macie2.model.TestCustomDataIdentifierRequest;
import software.amazon.awssdk.services.macie2.model.TestCustomDataIdentifierResponse;
import software.amazon.awssdk.services.macie2.model.ThrottlingException;
import software.amazon.awssdk.services.macie2.model.UnprocessableEntityException;
import software.amazon.awssdk.services.macie2.model.UntagResourceRequest;
import software.amazon.awssdk.services.macie2.model.UntagResourceResponse;
import software.amazon.awssdk.services.macie2.model.UpdateAllowListRequest;
import software.amazon.awssdk.services.macie2.model.UpdateAllowListResponse;
import software.amazon.awssdk.services.macie2.model.UpdateAutomatedDiscoveryConfigurationRequest;
import software.amazon.awssdk.services.macie2.model.UpdateAutomatedDiscoveryConfigurationResponse;
import software.amazon.awssdk.services.macie2.model.UpdateClassificationJobRequest;
import software.amazon.awssdk.services.macie2.model.UpdateClassificationJobResponse;
import software.amazon.awssdk.services.macie2.model.UpdateClassificationScopeRequest;
import software.amazon.awssdk.services.macie2.model.UpdateClassificationScopeResponse;
import software.amazon.awssdk.services.macie2.model.UpdateFindingsFilterRequest;
import software.amazon.awssdk.services.macie2.model.UpdateFindingsFilterResponse;
import software.amazon.awssdk.services.macie2.model.UpdateMacieSessionRequest;
import software.amazon.awssdk.services.macie2.model.UpdateMacieSessionResponse;
import software.amazon.awssdk.services.macie2.model.UpdateMemberSessionRequest;
import software.amazon.awssdk.services.macie2.model.UpdateMemberSessionResponse;
import software.amazon.awssdk.services.macie2.model.UpdateOrganizationConfigurationRequest;
import software.amazon.awssdk.services.macie2.model.UpdateOrganizationConfigurationResponse;
import software.amazon.awssdk.services.macie2.model.UpdateResourceProfileDetectionsRequest;
import software.amazon.awssdk.services.macie2.model.UpdateResourceProfileDetectionsResponse;
import software.amazon.awssdk.services.macie2.model.UpdateResourceProfileRequest;
import software.amazon.awssdk.services.macie2.model.UpdateResourceProfileResponse;
import software.amazon.awssdk.services.macie2.model.UpdateRevealConfigurationRequest;
import software.amazon.awssdk.services.macie2.model.UpdateRevealConfigurationResponse;
import software.amazon.awssdk.services.macie2.model.UpdateSensitivityInspectionTemplateRequest;
import software.amazon.awssdk.services.macie2.model.UpdateSensitivityInspectionTemplateResponse;
import software.amazon.awssdk.services.macie2.model.ValidationException;
import software.amazon.awssdk.services.macie2.paginators.DescribeBucketsPublisher;
import software.amazon.awssdk.services.macie2.paginators.GetUsageStatisticsPublisher;
import software.amazon.awssdk.services.macie2.paginators.ListAllowListsPublisher;
import software.amazon.awssdk.services.macie2.paginators.ListClassificationJobsPublisher;
import software.amazon.awssdk.services.macie2.paginators.ListClassificationScopesPublisher;
import software.amazon.awssdk.services.macie2.paginators.ListCustomDataIdentifiersPublisher;
import software.amazon.awssdk.services.macie2.paginators.ListFindingsFiltersPublisher;
import software.amazon.awssdk.services.macie2.paginators.ListFindingsPublisher;
import software.amazon.awssdk.services.macie2.paginators.ListInvitationsPublisher;
import software.amazon.awssdk.services.macie2.paginators.ListManagedDataIdentifiersPublisher;
import software.amazon.awssdk.services.macie2.paginators.ListMembersPublisher;
import software.amazon.awssdk.services.macie2.paginators.ListOrganizationAdminAccountsPublisher;
import software.amazon.awssdk.services.macie2.paginators.ListResourceProfileArtifactsPublisher;
import software.amazon.awssdk.services.macie2.paginators.ListResourceProfileDetectionsPublisher;
import software.amazon.awssdk.services.macie2.paginators.ListSensitivityInspectionTemplatesPublisher;
import software.amazon.awssdk.services.macie2.paginators.SearchResourcesPublisher;
import software.amazon.awssdk.services.macie2.transform.AcceptInvitationRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.BatchGetCustomDataIdentifiersRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.CreateAllowListRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.CreateClassificationJobRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.CreateCustomDataIdentifierRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.CreateFindingsFilterRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.CreateInvitationsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.CreateMemberRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.CreateSampleFindingsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DeclineInvitationsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DeleteAllowListRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DeleteCustomDataIdentifierRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DeleteFindingsFilterRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DeleteInvitationsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DeleteMemberRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DescribeBucketsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DescribeClassificationJobRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DescribeOrganizationConfigurationRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DisableMacieRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DisableOrganizationAdminAccountRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DisassociateFromAdministratorAccountRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DisassociateFromMasterAccountRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.DisassociateMemberRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.EnableMacieRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.EnableOrganizationAdminAccountRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetAdministratorAccountRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetAllowListRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetAutomatedDiscoveryConfigurationRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetBucketStatisticsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetClassificationExportConfigurationRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetClassificationScopeRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetCustomDataIdentifierRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetFindingStatisticsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetFindingsFilterRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetFindingsPublicationConfigurationRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetFindingsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetInvitationsCountRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetMacieSessionRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetMasterAccountRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetMemberRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetResourceProfileRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetRevealConfigurationRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetSensitiveDataOccurrencesAvailabilityRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetSensitiveDataOccurrencesRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetSensitivityInspectionTemplateRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetUsageStatisticsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.GetUsageTotalsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListAllowListsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListClassificationJobsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListClassificationScopesRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListCustomDataIdentifiersRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListFindingsFiltersRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListFindingsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListInvitationsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListManagedDataIdentifiersRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListMembersRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListOrganizationAdminAccountsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListResourceProfileArtifactsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListResourceProfileDetectionsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListSensitivityInspectionTemplatesRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.PutClassificationExportConfigurationRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.PutFindingsPublicationConfigurationRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.SearchResourcesRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.TestCustomDataIdentifierRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.UpdateAllowListRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.UpdateAutomatedDiscoveryConfigurationRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.UpdateClassificationJobRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.UpdateClassificationScopeRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.UpdateFindingsFilterRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.UpdateMacieSessionRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.UpdateMemberSessionRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.UpdateOrganizationConfigurationRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.UpdateResourceProfileDetectionsRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.UpdateResourceProfileRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.UpdateRevealConfigurationRequestMarshaller;
import software.amazon.awssdk.services.macie2.transform.UpdateSensitivityInspectionTemplateRequestMarshaller;
import software.amazon.awssdk.services.macie2.waiters.Macie2AsyncWaiter;
import software.amazon.awssdk.utils.CompletableFutureUtils;
/**
* Internal implementation of {@link Macie2AsyncClient}.
*
* @see Macie2AsyncClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultMacie2AsyncClient implements Macie2AsyncClient {
private static final Logger log = LoggerFactory.getLogger(DefaultMacie2AsyncClient.class);
private final AsyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
private final ScheduledExecutorService executorService;
protected DefaultMacie2AsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
this.executorService = clientConfiguration.option(SdkClientOption.SCHEDULED_EXECUTOR_SERVICE);
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
* Accepts an Amazon Macie membership invitation that was received from a specific account.
*
*
* @param acceptInvitationRequest
* @return A Java Future containing the result of the AcceptInvitation operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.AcceptInvitation
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture acceptInvitation(AcceptInvitationRequest acceptInvitationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, acceptInvitationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AcceptInvitation");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AcceptInvitationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AcceptInvitation")
.withMarshaller(new AcceptInvitationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(acceptInvitationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about one or more custom data identifiers.
*
*
* @param batchGetCustomDataIdentifiersRequest
* @return A Java Future containing the result of the BatchGetCustomDataIdentifiers operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.BatchGetCustomDataIdentifiers
* @see AWS API Documentation
*/
@Override
public CompletableFuture batchGetCustomDataIdentifiers(
BatchGetCustomDataIdentifiersRequest batchGetCustomDataIdentifiersRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
batchGetCustomDataIdentifiersRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BatchGetCustomDataIdentifiers");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, BatchGetCustomDataIdentifiersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("BatchGetCustomDataIdentifiers")
.withMarshaller(new BatchGetCustomDataIdentifiersRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(batchGetCustomDataIdentifiersRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates and defines the settings for an allow list.
*
*
* @param createAllowListRequest
* @return A Java Future containing the result of the CreateAllowList operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.CreateAllowList
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createAllowList(CreateAllowListRequest createAllowListRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createAllowListRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateAllowList");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateAllowListResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateAllowList")
.withMarshaller(new CreateAllowListRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createAllowListRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates and defines the settings for a classification job.
*
*
* @param createClassificationJobRequest
* @return A Java Future containing the result of the CreateClassificationJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.CreateClassificationJob
* @see AWS API Documentation
*/
@Override
public CompletableFuture createClassificationJob(
CreateClassificationJobRequest createClassificationJobRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createClassificationJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateClassificationJob");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateClassificationJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateClassificationJob")
.withMarshaller(new CreateClassificationJobRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createClassificationJobRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates and defines the criteria and other settings for a custom data identifier.
*
*
* @param createCustomDataIdentifierRequest
* @return A Java Future containing the result of the CreateCustomDataIdentifier operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.CreateCustomDataIdentifier
* @see AWS API Documentation
*/
@Override
public CompletableFuture createCustomDataIdentifier(
CreateCustomDataIdentifierRequest createCustomDataIdentifierRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createCustomDataIdentifierRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateCustomDataIdentifier");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateCustomDataIdentifierResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateCustomDataIdentifier")
.withMarshaller(new CreateCustomDataIdentifierRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createCustomDataIdentifierRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates and defines the criteria and other settings for a findings filter.
*
*
* @param createFindingsFilterRequest
* @return A Java Future containing the result of the CreateFindingsFilter operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.CreateFindingsFilter
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture createFindingsFilter(
CreateFindingsFilterRequest createFindingsFilterRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createFindingsFilterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateFindingsFilter");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateFindingsFilterResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateFindingsFilter")
.withMarshaller(new CreateFindingsFilterRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createFindingsFilterRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Sends an Amazon Macie membership invitation to one or more accounts.
*
*
* @param createInvitationsRequest
* @return A Java Future containing the result of the CreateInvitations operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.CreateInvitations
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createInvitations(CreateInvitationsRequest createInvitationsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createInvitationsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateInvitations");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateInvitationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateInvitations")
.withMarshaller(new CreateInvitationsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createInvitationsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Associates an account with an Amazon Macie administrator account.
*
*
* @param createMemberRequest
* @return A Java Future containing the result of the CreateMember operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.CreateMember
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createMember(CreateMemberRequest createMemberRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createMemberRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateMember");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateMemberResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateMember").withMarshaller(new CreateMemberRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createMemberRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates sample findings.
*
*
* @param createSampleFindingsRequest
* @return A Java Future containing the result of the CreateSampleFindings operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.CreateSampleFindings
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture createSampleFindings(
CreateSampleFindingsRequest createSampleFindingsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createSampleFindingsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateSampleFindings");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateSampleFindingsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateSampleFindings")
.withMarshaller(new CreateSampleFindingsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createSampleFindingsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Declines Amazon Macie membership invitations that were received from specific accounts.
*
*
* @param declineInvitationsRequest
* @return A Java Future containing the result of the DeclineInvitations operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DeclineInvitations
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture declineInvitations(DeclineInvitationsRequest declineInvitationsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, declineInvitationsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeclineInvitations");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeclineInvitationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeclineInvitations")
.withMarshaller(new DeclineInvitationsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(declineInvitationsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes an allow list.
*
*
* @param deleteAllowListRequest
* @return A Java Future containing the result of the DeleteAllowList operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DeleteAllowList
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteAllowList(DeleteAllowListRequest deleteAllowListRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAllowListRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAllowList");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteAllowListResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteAllowList")
.withMarshaller(new DeleteAllowListRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteAllowListRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Soft deletes a custom data identifier.
*
*
* @param deleteCustomDataIdentifierRequest
* @return A Java Future containing the result of the DeleteCustomDataIdentifier operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DeleteCustomDataIdentifier
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteCustomDataIdentifier(
DeleteCustomDataIdentifierRequest deleteCustomDataIdentifierRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteCustomDataIdentifierRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteCustomDataIdentifier");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteCustomDataIdentifierResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteCustomDataIdentifier")
.withMarshaller(new DeleteCustomDataIdentifierRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteCustomDataIdentifierRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes a findings filter.
*
*
* @param deleteFindingsFilterRequest
* @return A Java Future containing the result of the DeleteFindingsFilter operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DeleteFindingsFilter
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteFindingsFilter(
DeleteFindingsFilterRequest deleteFindingsFilterRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteFindingsFilterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteFindingsFilter");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteFindingsFilterResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteFindingsFilter")
.withMarshaller(new DeleteFindingsFilterRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteFindingsFilterRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes Amazon Macie membership invitations that were received from specific accounts.
*
*
* @param deleteInvitationsRequest
* @return A Java Future containing the result of the DeleteInvitations operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DeleteInvitations
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteInvitations(DeleteInvitationsRequest deleteInvitationsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteInvitationsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteInvitations");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteInvitationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteInvitations")
.withMarshaller(new DeleteInvitationsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteInvitationsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes the association between an Amazon Macie administrator account and an account.
*
*
* @param deleteMemberRequest
* @return A Java Future containing the result of the DeleteMember operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DeleteMember
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteMember(DeleteMemberRequest deleteMemberRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteMemberRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteMember");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteMemberResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteMember").withMarshaller(new DeleteMemberRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteMemberRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves (queries) statistical data and other information about one or more S3 buckets that Amazon Macie
* monitors and analyzes for an account.
*
*
* @param describeBucketsRequest
* @return A Java Future containing the result of the DescribeBuckets operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DescribeBuckets
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture describeBuckets(DescribeBucketsRequest describeBucketsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeBucketsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeBuckets");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeBucketsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeBuckets")
.withMarshaller(new DescribeBucketsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeBucketsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves (queries) statistical data and other information about one or more S3 buckets that Amazon Macie
* monitors and analyzes for an account.
*
*
*
* This is a variant of
* {@link #describeBuckets(software.amazon.awssdk.services.macie2.model.DescribeBucketsRequest)} operation. The
* return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will
* internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.macie2.paginators.DescribeBucketsPublisher publisher = client.describeBucketsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.macie2.paginators.DescribeBucketsPublisher publisher = client.describeBucketsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.macie2.model.DescribeBucketsResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #describeBuckets(software.amazon.awssdk.services.macie2.model.DescribeBucketsRequest)} operation.
*
*
* @param describeBucketsRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DescribeBuckets
* @see AWS API
* Documentation
*/
public DescribeBucketsPublisher describeBucketsPaginator(DescribeBucketsRequest describeBucketsRequest) {
return new DescribeBucketsPublisher(this, applyPaginatorUserAgent(describeBucketsRequest));
}
/**
*
* Retrieves the status and settings for a classification job.
*
*
* @param describeClassificationJobRequest
* @return A Java Future containing the result of the DescribeClassificationJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DescribeClassificationJob
* @see AWS API Documentation
*/
@Override
public CompletableFuture describeClassificationJob(
DescribeClassificationJobRequest describeClassificationJobRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeClassificationJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeClassificationJob");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeClassificationJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeClassificationJob")
.withMarshaller(new DescribeClassificationJobRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeClassificationJobRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the Amazon Macie configuration settings for an organization in Organizations.
*
*
* @param describeOrganizationConfigurationRequest
* @return A Java Future containing the result of the DescribeOrganizationConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DescribeOrganizationConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture describeOrganizationConfiguration(
DescribeOrganizationConfigurationRequest describeOrganizationConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
describeOrganizationConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeOrganizationConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, DescribeOrganizationConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeOrganizationConfiguration")
.withMarshaller(new DescribeOrganizationConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeOrganizationConfigurationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Disables Amazon Macie and deletes all settings and resources for a Macie account.
*
*
* @param disableMacieRequest
* @return A Java Future containing the result of the DisableMacie operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DisableMacie
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture disableMacie(DisableMacieRequest disableMacieRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, disableMacieRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisableMacie");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DisableMacieResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DisableMacie").withMarshaller(new DisableMacieRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(disableMacieRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Disables an account as the delegated Amazon Macie administrator account for an organization in Organizations.
*
*
* @param disableOrganizationAdminAccountRequest
* @return A Java Future containing the result of the DisableOrganizationAdminAccount operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DisableOrganizationAdminAccount
* @see AWS API Documentation
*/
@Override
public CompletableFuture disableOrganizationAdminAccount(
DisableOrganizationAdminAccountRequest disableOrganizationAdminAccountRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
disableOrganizationAdminAccountRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisableOrganizationAdminAccount");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DisableOrganizationAdminAccountResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DisableOrganizationAdminAccount")
.withMarshaller(new DisableOrganizationAdminAccountRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(disableOrganizationAdminAccountRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Disassociates a member account from its Amazon Macie administrator account.
*
*
* @param disassociateFromAdministratorAccountRequest
* @return A Java Future containing the result of the DisassociateFromAdministratorAccount operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DisassociateFromAdministratorAccount
* @see AWS API Documentation
*/
@Override
public CompletableFuture disassociateFromAdministratorAccount(
DisassociateFromAdministratorAccountRequest disassociateFromAdministratorAccountRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
disassociateFromAdministratorAccountRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateFromAdministratorAccount");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, DisassociateFromAdministratorAccountResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DisassociateFromAdministratorAccount")
.withMarshaller(new DisassociateFromAdministratorAccountRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(disassociateFromAdministratorAccountRequest));
CompletableFuture whenCompleted = executeFuture
.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* (Deprecated) Disassociates a member account from its Amazon Macie administrator account. This operation has been
* replaced by the DisassociateFromAdministratorAccount
* operation.
*
*
* @param disassociateFromMasterAccountRequest
* @return A Java Future containing the result of the DisassociateFromMasterAccount operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DisassociateFromMasterAccount
* @see AWS API Documentation
*/
@Override
public CompletableFuture disassociateFromMasterAccount(
DisassociateFromMasterAccountRequest disassociateFromMasterAccountRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
disassociateFromMasterAccountRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateFromMasterAccount");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DisassociateFromMasterAccountResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DisassociateFromMasterAccount")
.withMarshaller(new DisassociateFromMasterAccountRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(disassociateFromMasterAccountRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Disassociates an Amazon Macie administrator account from a member account.
*
*
* @param disassociateMemberRequest
* @return A Java Future containing the result of the DisassociateMember operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.DisassociateMember
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture disassociateMember(DisassociateMemberRequest disassociateMemberRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, disassociateMemberRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateMember");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DisassociateMemberResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DisassociateMember")
.withMarshaller(new DisassociateMemberRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(disassociateMemberRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Enables Amazon Macie and specifies the configuration settings for a Macie account.
*
*
* @param enableMacieRequest
* @return A Java Future containing the result of the EnableMacie operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.EnableMacie
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture enableMacie(EnableMacieRequest enableMacieRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, enableMacieRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EnableMacie");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
EnableMacieResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("EnableMacie").withMarshaller(new EnableMacieRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(enableMacieRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Designates an account as the delegated Amazon Macie administrator account for an organization in Organizations.
*
*
* @param enableOrganizationAdminAccountRequest
* @return A Java Future containing the result of the EnableOrganizationAdminAccount operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.EnableOrganizationAdminAccount
* @see AWS API Documentation
*/
@Override
public CompletableFuture enableOrganizationAdminAccount(
EnableOrganizationAdminAccountRequest enableOrganizationAdminAccountRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
enableOrganizationAdminAccountRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EnableOrganizationAdminAccount");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, EnableOrganizationAdminAccountResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("EnableOrganizationAdminAccount")
.withMarshaller(new EnableOrganizationAdminAccountRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(enableOrganizationAdminAccountRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves information about the Amazon Macie administrator account for an account.
*
*
* @param getAdministratorAccountRequest
* @return A Java Future containing the result of the GetAdministratorAccount operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.GetAdministratorAccount
* @see AWS API Documentation
*/
@Override
public CompletableFuture getAdministratorAccount(
GetAdministratorAccountRequest getAdministratorAccountRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getAdministratorAccountRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAdministratorAccount");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetAdministratorAccountResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetAdministratorAccount")
.withMarshaller(new GetAdministratorAccountRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getAdministratorAccountRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the settings and status of an allow list.
*
*
* @param getAllowListRequest
* @return A Java Future containing the result of the GetAllowList operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.GetAllowList
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getAllowList(GetAllowListRequest getAllowListRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getAllowListRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAllowList");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetAllowListResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetAllowList").withMarshaller(new GetAllowListRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getAllowListRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the configuration settings and status of automated sensitive data discovery for an account.
*
*
* @param getAutomatedDiscoveryConfigurationRequest
* @return A Java Future containing the result of the GetAutomatedDiscoveryConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.GetAutomatedDiscoveryConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture getAutomatedDiscoveryConfiguration(
GetAutomatedDiscoveryConfigurationRequest getAutomatedDiscoveryConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getAutomatedDiscoveryConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAutomatedDiscoveryConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, GetAutomatedDiscoveryConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetAutomatedDiscoveryConfiguration")
.withMarshaller(new GetAutomatedDiscoveryConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getAutomatedDiscoveryConfigurationRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves (queries) aggregated statistical data about all the S3 buckets that Amazon Macie monitors and analyzes
* for an account.
*
*
* @param getBucketStatisticsRequest
* @return A Java Future containing the result of the GetBucketStatistics operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.GetBucketStatistics
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getBucketStatistics(
GetBucketStatisticsRequest getBucketStatisticsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getBucketStatisticsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetBucketStatistics");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetBucketStatisticsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetBucketStatistics")
.withMarshaller(new GetBucketStatisticsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getBucketStatisticsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the configuration settings for storing data classification results.
*
*
* @param getClassificationExportConfigurationRequest
* @return A Java Future containing the result of the GetClassificationExportConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.GetClassificationExportConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture getClassificationExportConfiguration(
GetClassificationExportConfigurationRequest getClassificationExportConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getClassificationExportConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetClassificationExportConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, GetClassificationExportConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetClassificationExportConfiguration")
.withMarshaller(new GetClassificationExportConfigurationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getClassificationExportConfigurationRequest));
CompletableFuture whenCompleted = executeFuture
.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the classification scope settings for an account.
*
*
* @param getClassificationScopeRequest
* @return A Java Future containing the result of the GetClassificationScope operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.GetClassificationScope
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getClassificationScope(
GetClassificationScopeRequest getClassificationScopeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getClassificationScopeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetClassificationScope");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetClassificationScopeResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetClassificationScope")
.withMarshaller(new GetClassificationScopeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getClassificationScopeRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the criteria and other settings for a custom data identifier.
*
*
* @param getCustomDataIdentifierRequest
* @return A Java Future containing the result of the GetCustomDataIdentifier operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.GetCustomDataIdentifier
* @see AWS API Documentation
*/
@Override
public CompletableFuture getCustomDataIdentifier(
GetCustomDataIdentifierRequest getCustomDataIdentifierRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getCustomDataIdentifierRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetCustomDataIdentifier");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetCustomDataIdentifierResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetCustomDataIdentifier")
.withMarshaller(new GetCustomDataIdentifierRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getCustomDataIdentifierRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves (queries) aggregated statistical data about findings.
*
*
* @param getFindingStatisticsRequest
* @return A Java Future containing the result of the GetFindingStatistics operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.GetFindingStatistics
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture getFindingStatistics(
GetFindingStatisticsRequest getFindingStatisticsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getFindingStatisticsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetFindingStatistics");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetFindingStatisticsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetFindingStatistics")
.withMarshaller(new GetFindingStatisticsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getFindingStatisticsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the details of one or more findings.
*
*
* @param getFindingsRequest
* @return A Java Future containing the result of the GetFindings operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.GetFindings
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getFindings(GetFindingsRequest getFindingsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getFindingsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetFindings");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetFindingsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetFindings").withMarshaller(new GetFindingsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getFindingsRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the criteria and other settings for a findings filter.
*
*
* @param getFindingsFilterRequest
* @return A Java Future containing the result of the GetFindingsFilter operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.GetFindingsFilter
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture getFindingsFilter(GetFindingsFilterRequest getFindingsFilterRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, getFindingsFilterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetFindingsFilter");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetFindingsFilterResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetFindingsFilter")
.withMarshaller(new GetFindingsFilterRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(getFindingsFilterRequest));
CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
return executeFuture;
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Retrieves the configuration settings for publishing findings to Security Hub.
*
*
* @param getFindingsPublicationConfigurationRequest
* @return A Java Future containing the result of the GetFindingsPublicationConfiguration operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ValidationException The request failed because the input doesn't satisfy the constraints specified by
* the service.
* - InternalServerException The request failed due to an unknown internal server error, exception, or
* failure.
* - ServiceQuotaExceededException The request failed because fulfilling the request would exceed one or
* more service quotas for your account.
* - AccessDeniedException The request was denied because you don't have sufficient access to the
* specified resource.
* - ResourceNotFoundException The request failed because the specified resource wasn't found.
* - ThrottlingException The request failed because you sent too many requests during a certain amount of
* time.
* - ConflictException The request failed because it conflicts with the current state of the specified
* resource.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - Macie2Exception Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample Macie2AsyncClient.GetFindingsPublicationConfiguration
* @see AWS API Documentation
*/
@Override
public CompletableFuture getFindingsPublicationConfiguration(
GetFindingsPublicationConfigurationRequest getFindingsPublicationConfigurationRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getFindingsPublicationConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Macie2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetFindingsPublicationConfiguration");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(operationMetadata, GetFindingsPublicationConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams