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

software.amazon.awssdk.services.guardduty.DefaultGuardDutyClient 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.guardduty;

import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
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.AwsSyncClientHandler;
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.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
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.guardduty.model.AcceptAdministratorInvitationRequest;
import software.amazon.awssdk.services.guardduty.model.AcceptAdministratorInvitationResponse;
import software.amazon.awssdk.services.guardduty.model.AcceptInvitationRequest;
import software.amazon.awssdk.services.guardduty.model.AcceptInvitationResponse;
import software.amazon.awssdk.services.guardduty.model.ArchiveFindingsRequest;
import software.amazon.awssdk.services.guardduty.model.ArchiveFindingsResponse;
import software.amazon.awssdk.services.guardduty.model.BadRequestException;
import software.amazon.awssdk.services.guardduty.model.CreateDetectorRequest;
import software.amazon.awssdk.services.guardduty.model.CreateDetectorResponse;
import software.amazon.awssdk.services.guardduty.model.CreateFilterRequest;
import software.amazon.awssdk.services.guardduty.model.CreateFilterResponse;
import software.amazon.awssdk.services.guardduty.model.CreateIpSetRequest;
import software.amazon.awssdk.services.guardduty.model.CreateIpSetResponse;
import software.amazon.awssdk.services.guardduty.model.CreateMembersRequest;
import software.amazon.awssdk.services.guardduty.model.CreateMembersResponse;
import software.amazon.awssdk.services.guardduty.model.CreatePublishingDestinationRequest;
import software.amazon.awssdk.services.guardduty.model.CreatePublishingDestinationResponse;
import software.amazon.awssdk.services.guardduty.model.CreateSampleFindingsRequest;
import software.amazon.awssdk.services.guardduty.model.CreateSampleFindingsResponse;
import software.amazon.awssdk.services.guardduty.model.CreateThreatIntelSetRequest;
import software.amazon.awssdk.services.guardduty.model.CreateThreatIntelSetResponse;
import software.amazon.awssdk.services.guardduty.model.DeclineInvitationsRequest;
import software.amazon.awssdk.services.guardduty.model.DeclineInvitationsResponse;
import software.amazon.awssdk.services.guardduty.model.DeleteDetectorRequest;
import software.amazon.awssdk.services.guardduty.model.DeleteDetectorResponse;
import software.amazon.awssdk.services.guardduty.model.DeleteFilterRequest;
import software.amazon.awssdk.services.guardduty.model.DeleteFilterResponse;
import software.amazon.awssdk.services.guardduty.model.DeleteInvitationsRequest;
import software.amazon.awssdk.services.guardduty.model.DeleteInvitationsResponse;
import software.amazon.awssdk.services.guardduty.model.DeleteIpSetRequest;
import software.amazon.awssdk.services.guardduty.model.DeleteIpSetResponse;
import software.amazon.awssdk.services.guardduty.model.DeleteMembersRequest;
import software.amazon.awssdk.services.guardduty.model.DeleteMembersResponse;
import software.amazon.awssdk.services.guardduty.model.DeletePublishingDestinationRequest;
import software.amazon.awssdk.services.guardduty.model.DeletePublishingDestinationResponse;
import software.amazon.awssdk.services.guardduty.model.DeleteThreatIntelSetRequest;
import software.amazon.awssdk.services.guardduty.model.DeleteThreatIntelSetResponse;
import software.amazon.awssdk.services.guardduty.model.DescribeMalwareScansRequest;
import software.amazon.awssdk.services.guardduty.model.DescribeMalwareScansResponse;
import software.amazon.awssdk.services.guardduty.model.DescribeOrganizationConfigurationRequest;
import software.amazon.awssdk.services.guardduty.model.DescribeOrganizationConfigurationResponse;
import software.amazon.awssdk.services.guardduty.model.DescribePublishingDestinationRequest;
import software.amazon.awssdk.services.guardduty.model.DescribePublishingDestinationResponse;
import software.amazon.awssdk.services.guardduty.model.DisableOrganizationAdminAccountRequest;
import software.amazon.awssdk.services.guardduty.model.DisableOrganizationAdminAccountResponse;
import software.amazon.awssdk.services.guardduty.model.DisassociateFromAdministratorAccountRequest;
import software.amazon.awssdk.services.guardduty.model.DisassociateFromAdministratorAccountResponse;
import software.amazon.awssdk.services.guardduty.model.DisassociateFromMasterAccountRequest;
import software.amazon.awssdk.services.guardduty.model.DisassociateFromMasterAccountResponse;
import software.amazon.awssdk.services.guardduty.model.DisassociateMembersRequest;
import software.amazon.awssdk.services.guardduty.model.DisassociateMembersResponse;
import software.amazon.awssdk.services.guardduty.model.EnableOrganizationAdminAccountRequest;
import software.amazon.awssdk.services.guardduty.model.EnableOrganizationAdminAccountResponse;
import software.amazon.awssdk.services.guardduty.model.GetAdministratorAccountRequest;
import software.amazon.awssdk.services.guardduty.model.GetAdministratorAccountResponse;
import software.amazon.awssdk.services.guardduty.model.GetDetectorRequest;
import software.amazon.awssdk.services.guardduty.model.GetDetectorResponse;
import software.amazon.awssdk.services.guardduty.model.GetFilterRequest;
import software.amazon.awssdk.services.guardduty.model.GetFilterResponse;
import software.amazon.awssdk.services.guardduty.model.GetFindingsRequest;
import software.amazon.awssdk.services.guardduty.model.GetFindingsResponse;
import software.amazon.awssdk.services.guardduty.model.GetFindingsStatisticsRequest;
import software.amazon.awssdk.services.guardduty.model.GetFindingsStatisticsResponse;
import software.amazon.awssdk.services.guardduty.model.GetInvitationsCountRequest;
import software.amazon.awssdk.services.guardduty.model.GetInvitationsCountResponse;
import software.amazon.awssdk.services.guardduty.model.GetIpSetRequest;
import software.amazon.awssdk.services.guardduty.model.GetIpSetResponse;
import software.amazon.awssdk.services.guardduty.model.GetMalwareScanSettingsRequest;
import software.amazon.awssdk.services.guardduty.model.GetMalwareScanSettingsResponse;
import software.amazon.awssdk.services.guardduty.model.GetMasterAccountRequest;
import software.amazon.awssdk.services.guardduty.model.GetMasterAccountResponse;
import software.amazon.awssdk.services.guardduty.model.GetMemberDetectorsRequest;
import software.amazon.awssdk.services.guardduty.model.GetMemberDetectorsResponse;
import software.amazon.awssdk.services.guardduty.model.GetMembersRequest;
import software.amazon.awssdk.services.guardduty.model.GetMembersResponse;
import software.amazon.awssdk.services.guardduty.model.GetRemainingFreeTrialDaysRequest;
import software.amazon.awssdk.services.guardduty.model.GetRemainingFreeTrialDaysResponse;
import software.amazon.awssdk.services.guardduty.model.GetThreatIntelSetRequest;
import software.amazon.awssdk.services.guardduty.model.GetThreatIntelSetResponse;
import software.amazon.awssdk.services.guardduty.model.GetUsageStatisticsRequest;
import software.amazon.awssdk.services.guardduty.model.GetUsageStatisticsResponse;
import software.amazon.awssdk.services.guardduty.model.GuardDutyException;
import software.amazon.awssdk.services.guardduty.model.GuardDutyRequest;
import software.amazon.awssdk.services.guardduty.model.InternalServerErrorException;
import software.amazon.awssdk.services.guardduty.model.InviteMembersRequest;
import software.amazon.awssdk.services.guardduty.model.InviteMembersResponse;
import software.amazon.awssdk.services.guardduty.model.ListDetectorsRequest;
import software.amazon.awssdk.services.guardduty.model.ListDetectorsResponse;
import software.amazon.awssdk.services.guardduty.model.ListFiltersRequest;
import software.amazon.awssdk.services.guardduty.model.ListFiltersResponse;
import software.amazon.awssdk.services.guardduty.model.ListFindingsRequest;
import software.amazon.awssdk.services.guardduty.model.ListFindingsResponse;
import software.amazon.awssdk.services.guardduty.model.ListInvitationsRequest;
import software.amazon.awssdk.services.guardduty.model.ListInvitationsResponse;
import software.amazon.awssdk.services.guardduty.model.ListIpSetsRequest;
import software.amazon.awssdk.services.guardduty.model.ListIpSetsResponse;
import software.amazon.awssdk.services.guardduty.model.ListMembersRequest;
import software.amazon.awssdk.services.guardduty.model.ListMembersResponse;
import software.amazon.awssdk.services.guardduty.model.ListOrganizationAdminAccountsRequest;
import software.amazon.awssdk.services.guardduty.model.ListOrganizationAdminAccountsResponse;
import software.amazon.awssdk.services.guardduty.model.ListPublishingDestinationsRequest;
import software.amazon.awssdk.services.guardduty.model.ListPublishingDestinationsResponse;
import software.amazon.awssdk.services.guardduty.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.guardduty.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.guardduty.model.ListThreatIntelSetsRequest;
import software.amazon.awssdk.services.guardduty.model.ListThreatIntelSetsResponse;
import software.amazon.awssdk.services.guardduty.model.StartMonitoringMembersRequest;
import software.amazon.awssdk.services.guardduty.model.StartMonitoringMembersResponse;
import software.amazon.awssdk.services.guardduty.model.StopMonitoringMembersRequest;
import software.amazon.awssdk.services.guardduty.model.StopMonitoringMembersResponse;
import software.amazon.awssdk.services.guardduty.model.TagResourceRequest;
import software.amazon.awssdk.services.guardduty.model.TagResourceResponse;
import software.amazon.awssdk.services.guardduty.model.UnarchiveFindingsRequest;
import software.amazon.awssdk.services.guardduty.model.UnarchiveFindingsResponse;
import software.amazon.awssdk.services.guardduty.model.UntagResourceRequest;
import software.amazon.awssdk.services.guardduty.model.UntagResourceResponse;
import software.amazon.awssdk.services.guardduty.model.UpdateDetectorRequest;
import software.amazon.awssdk.services.guardduty.model.UpdateDetectorResponse;
import software.amazon.awssdk.services.guardduty.model.UpdateFilterRequest;
import software.amazon.awssdk.services.guardduty.model.UpdateFilterResponse;
import software.amazon.awssdk.services.guardduty.model.UpdateFindingsFeedbackRequest;
import software.amazon.awssdk.services.guardduty.model.UpdateFindingsFeedbackResponse;
import software.amazon.awssdk.services.guardduty.model.UpdateIpSetRequest;
import software.amazon.awssdk.services.guardduty.model.UpdateIpSetResponse;
import software.amazon.awssdk.services.guardduty.model.UpdateMalwareScanSettingsRequest;
import software.amazon.awssdk.services.guardduty.model.UpdateMalwareScanSettingsResponse;
import software.amazon.awssdk.services.guardduty.model.UpdateMemberDetectorsRequest;
import software.amazon.awssdk.services.guardduty.model.UpdateMemberDetectorsResponse;
import software.amazon.awssdk.services.guardduty.model.UpdateOrganizationConfigurationRequest;
import software.amazon.awssdk.services.guardduty.model.UpdateOrganizationConfigurationResponse;
import software.amazon.awssdk.services.guardduty.model.UpdatePublishingDestinationRequest;
import software.amazon.awssdk.services.guardduty.model.UpdatePublishingDestinationResponse;
import software.amazon.awssdk.services.guardduty.model.UpdateThreatIntelSetRequest;
import software.amazon.awssdk.services.guardduty.model.UpdateThreatIntelSetResponse;
import software.amazon.awssdk.services.guardduty.paginators.DescribeMalwareScansIterable;
import software.amazon.awssdk.services.guardduty.paginators.GetUsageStatisticsIterable;
import software.amazon.awssdk.services.guardduty.paginators.ListDetectorsIterable;
import software.amazon.awssdk.services.guardduty.paginators.ListFiltersIterable;
import software.amazon.awssdk.services.guardduty.paginators.ListFindingsIterable;
import software.amazon.awssdk.services.guardduty.paginators.ListIPSetsIterable;
import software.amazon.awssdk.services.guardduty.paginators.ListInvitationsIterable;
import software.amazon.awssdk.services.guardduty.paginators.ListMembersIterable;
import software.amazon.awssdk.services.guardduty.paginators.ListOrganizationAdminAccountsIterable;
import software.amazon.awssdk.services.guardduty.paginators.ListPublishingDestinationsIterable;
import software.amazon.awssdk.services.guardduty.paginators.ListThreatIntelSetsIterable;
import software.amazon.awssdk.services.guardduty.transform.AcceptAdministratorInvitationRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.AcceptInvitationRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.ArchiveFindingsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.CreateDetectorRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.CreateFilterRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.CreateIpSetRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.CreateMembersRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.CreatePublishingDestinationRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.CreateSampleFindingsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.CreateThreatIntelSetRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DeclineInvitationsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DeleteDetectorRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DeleteFilterRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DeleteInvitationsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DeleteIpSetRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DeleteMembersRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DeletePublishingDestinationRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DeleteThreatIntelSetRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DescribeMalwareScansRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DescribeOrganizationConfigurationRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DescribePublishingDestinationRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DisableOrganizationAdminAccountRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DisassociateFromAdministratorAccountRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DisassociateFromMasterAccountRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.DisassociateMembersRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.EnableOrganizationAdminAccountRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetAdministratorAccountRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetDetectorRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetFilterRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetFindingsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetFindingsStatisticsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetInvitationsCountRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetIpSetRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetMalwareScanSettingsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetMasterAccountRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetMemberDetectorsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetMembersRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetRemainingFreeTrialDaysRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetThreatIntelSetRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.GetUsageStatisticsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.InviteMembersRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.ListDetectorsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.ListFiltersRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.ListFindingsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.ListInvitationsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.ListIpSetsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.ListMembersRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.ListOrganizationAdminAccountsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.ListPublishingDestinationsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.ListThreatIntelSetsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.StartMonitoringMembersRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.StopMonitoringMembersRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.UnarchiveFindingsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.UpdateDetectorRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.UpdateFilterRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.UpdateFindingsFeedbackRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.UpdateIpSetRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.UpdateMalwareScanSettingsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.UpdateMemberDetectorsRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.UpdateOrganizationConfigurationRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.UpdatePublishingDestinationRequestMarshaller;
import software.amazon.awssdk.services.guardduty.transform.UpdateThreatIntelSetRequestMarshaller;
import software.amazon.awssdk.utils.Logger;

/**
 * Internal implementation of {@link GuardDutyClient}.
 *
 * @see GuardDutyClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultGuardDutyClient implements GuardDutyClient {
    private static final Logger log = Logger.loggerFor(DefaultGuardDutyClient.class);

    private final SyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    protected DefaultGuardDutyClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration;
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    @Override
    public final String serviceName() {
        return SERVICE_NAME;
    }

    /**
     * 

* Accepts the invitation to be a member account and get monitored by a GuardDuty administrator account that sent * the invitation. *

* * @param acceptAdministratorInvitationRequest * @return Result of the AcceptAdministratorInvitation operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.AcceptAdministratorInvitation * @see AWS API Documentation */ @Override public AcceptAdministratorInvitationResponse acceptAdministratorInvitation( AcceptAdministratorInvitationRequest acceptAdministratorInvitationRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, AcceptAdministratorInvitationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, acceptAdministratorInvitationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AcceptAdministratorInvitation"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("AcceptAdministratorInvitation").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(acceptAdministratorInvitationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new AcceptAdministratorInvitationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Accepts the invitation to be monitored by a GuardDuty administrator account. *

* * @param acceptInvitationRequest * @return Result of the AcceptInvitation operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.AcceptInvitation * @see AWS * API Documentation */ @Override public AcceptInvitationResponse acceptInvitation(AcceptInvitationRequest acceptInvitationRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, AcceptInvitationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, acceptInvitationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AcceptInvitation"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("AcceptInvitation").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(acceptInvitationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new AcceptInvitationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Archives GuardDuty findings that are specified by the list of finding IDs. *

* *

* Only the administrator account can archive findings. Member accounts don't have permission to archive findings * from their accounts. *

*
* * @param archiveFindingsRequest * @return Result of the ArchiveFindings operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ArchiveFindings * @see AWS API * Documentation */ @Override public ArchiveFindingsResponse archiveFindings(ArchiveFindingsRequest archiveFindingsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ArchiveFindingsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, archiveFindingsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ArchiveFindings"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ArchiveFindings").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(archiveFindingsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ArchiveFindingsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a single Amazon GuardDuty detector. A detector is a resource that represents the GuardDuty service. To * start using GuardDuty, you must create a detector in each Region where you enable the service. You can have only * one detector per account per Region. All data sources are enabled in a new detector by default. *

* * @param createDetectorRequest * @return Result of the CreateDetector operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.CreateDetector * @see AWS API * Documentation */ @Override public CreateDetectorResponse createDetector(CreateDetectorRequest createDetectorRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateDetectorResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createDetectorRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDetector"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateDetector").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createDetectorRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateDetectorRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a filter using the specified finding criteria. *

* * @param createFilterRequest * @return Result of the CreateFilter operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.CreateFilter * @see AWS API * Documentation */ @Override public CreateFilterResponse createFilter(CreateFilterRequest createFilterRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateFilterResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createFilterRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateFilter"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateFilter").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createFilterRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateFilterRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a new IPSet, which is called a trusted IP list in the console user interface. An IPSet is a list of IP * addresses that are trusted for secure communication with Amazon Web Services infrastructure and applications. * GuardDuty doesn't generate findings for IP addresses that are included in IPSets. Only users from the * administrator account can use this operation. *

* * @param createIpSetRequest * @return Result of the CreateIPSet operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.CreateIPSet * @see AWS API * Documentation */ @Override public CreateIpSetResponse createIPSet(CreateIpSetRequest createIpSetRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateIpSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createIpSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateIPSet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateIPSet").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createIpSetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateIpSetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates member accounts of the current Amazon Web Services account by specifying a list of Amazon Web Services * account IDs. This step is a prerequisite for managing the associated member accounts either by invitation or * through an organization. *

*

* When using Create Members as an organizations delegated administrator this action will enable * GuardDuty in the added member accounts, with the exception of the organization delegated administrator account, * which must enable GuardDuty prior to being added as a member. *

*

* If you are adding accounts by invitation use this action after GuardDuty has been enabled in potential member * accounts and before using * Invite Members . *

* * @param createMembersRequest * @return Result of the CreateMembers operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.CreateMembers * @see AWS API * Documentation */ @Override public CreateMembersResponse createMembers(CreateMembersRequest createMembersRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateMembersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createMembersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateMembers"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateMembers").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createMembersRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateMembersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a publishing destination to export findings to. The resource to export findings to must exist before you * use this operation. *

* * @param createPublishingDestinationRequest * @return Result of the CreatePublishingDestination operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.CreatePublishingDestination * @see AWS API Documentation */ @Override public CreatePublishingDestinationResponse createPublishingDestination( CreatePublishingDestinationRequest createPublishingDestinationRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreatePublishingDestinationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createPublishingDestinationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreatePublishingDestination"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("CreatePublishingDestination").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createPublishingDestinationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreatePublishingDestinationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Generates example findings of types specified by the list of finding types. If 'NULL' is specified for * findingTypes, the API generates example findings of all supported finding types. *

* * @param createSampleFindingsRequest * @return Result of the CreateSampleFindings operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.CreateSampleFindings * @see AWS API Documentation */ @Override public CreateSampleFindingsResponse createSampleFindings(CreateSampleFindingsRequest createSampleFindingsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateSampleFindingsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createSampleFindingsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateSampleFindings"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateSampleFindings").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createSampleFindingsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateSampleFindingsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a new ThreatIntelSet. ThreatIntelSets consist of known malicious IP addresses. GuardDuty generates * findings based on ThreatIntelSets. Only users of the administrator account can use this operation. *

* * @param createThreatIntelSetRequest * @return Result of the CreateThreatIntelSet operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.CreateThreatIntelSet * @see AWS API Documentation */ @Override public CreateThreatIntelSetResponse createThreatIntelSet(CreateThreatIntelSetRequest createThreatIntelSetRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateThreatIntelSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createThreatIntelSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateThreatIntelSet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateThreatIntelSet").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createThreatIntelSetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateThreatIntelSetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Declines invitations sent to the current member account by Amazon Web Services accounts specified by their * account IDs. *

* * @param declineInvitationsRequest * @return Result of the DeclineInvitations operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DeclineInvitations * @see AWS * API Documentation */ @Override public DeclineInvitationsResponse declineInvitations(DeclineInvitationsRequest declineInvitationsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeclineInvitationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, declineInvitationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeclineInvitations"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeclineInvitations").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(declineInvitationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeclineInvitationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes an Amazon GuardDuty detector that is specified by the detector ID. *

* * @param deleteDetectorRequest * @return Result of the DeleteDetector operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DeleteDetector * @see AWS API * Documentation */ @Override public DeleteDetectorResponse deleteDetector(DeleteDetectorRequest deleteDetectorRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteDetectorResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteDetectorRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDetector"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteDetector").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteDetectorRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteDetectorRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes the filter specified by the filter name. *

* * @param deleteFilterRequest * @return Result of the DeleteFilter operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DeleteFilter * @see AWS API * Documentation */ @Override public DeleteFilterResponse deleteFilter(DeleteFilterRequest deleteFilterRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteFilterResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteFilterRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteFilter"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteFilter").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteFilterRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteFilterRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes the IPSet specified by the ipSetId. IPSets are called trusted IP lists in the console user * interface. *

* * @param deleteIpSetRequest * @return Result of the DeleteIPSet operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DeleteIPSet * @see AWS API * Documentation */ @Override public DeleteIpSetResponse deleteIPSet(DeleteIpSetRequest deleteIpSetRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteIpSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteIpSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteIPSet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteIPSet").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteIpSetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteIpSetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes invitations sent to the current member account by Amazon Web Services accounts specified by their account * IDs. *

* * @param deleteInvitationsRequest * @return Result of the DeleteInvitations operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DeleteInvitations * @see AWS * API Documentation */ @Override public DeleteInvitationsResponse deleteInvitations(DeleteInvitationsRequest deleteInvitationsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteInvitationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteInvitationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteInvitations"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteInvitations").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteInvitationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteInvitationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes GuardDuty member accounts (to the current GuardDuty administrator account) specified by the account IDs. *

* * @param deleteMembersRequest * @return Result of the DeleteMembers operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DeleteMembers * @see AWS API * Documentation */ @Override public DeleteMembersResponse deleteMembers(DeleteMembersRequest deleteMembersRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteMembersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteMembersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteMembers"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteMembers").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteMembersRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteMembersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes the publishing definition with the specified destinationId. *

* * @param deletePublishingDestinationRequest * @return Result of the DeletePublishingDestination operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DeletePublishingDestination * @see AWS API Documentation */ @Override public DeletePublishingDestinationResponse deletePublishingDestination( DeletePublishingDestinationRequest deletePublishingDestinationRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeletePublishingDestinationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deletePublishingDestinationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeletePublishingDestination"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DeletePublishingDestination").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deletePublishingDestinationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeletePublishingDestinationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes the ThreatIntelSet specified by the ThreatIntelSet ID. *

* * @param deleteThreatIntelSetRequest * @return Result of the DeleteThreatIntelSet operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DeleteThreatIntelSet * @see AWS API Documentation */ @Override public DeleteThreatIntelSetResponse deleteThreatIntelSet(DeleteThreatIntelSetRequest deleteThreatIntelSetRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteThreatIntelSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteThreatIntelSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteThreatIntelSet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteThreatIntelSet").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteThreatIntelSetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteThreatIntelSetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns a list of malware scans. *

* * @param describeMalwareScansRequest * @return Result of the DescribeMalwareScans operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DescribeMalwareScans * @see AWS API Documentation */ @Override public DescribeMalwareScansResponse describeMalwareScans(DescribeMalwareScansRequest describeMalwareScansRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeMalwareScansResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeMalwareScansRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeMalwareScans"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeMalwareScans").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeMalwareScansRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeMalwareScansRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns a list of malware scans. *

*
*

* This is a variant of * {@link #describeMalwareScans(software.amazon.awssdk.services.guardduty.model.DescribeMalwareScansRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.DescribeMalwareScansIterable responses = client.describeMalwareScansPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.guardduty.paginators.DescribeMalwareScansIterable responses = client
     *             .describeMalwareScansPaginator(request);
     *     for (software.amazon.awssdk.services.guardduty.model.DescribeMalwareScansResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.DescribeMalwareScansIterable responses = client.describeMalwareScansPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* 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 #describeMalwareScans(software.amazon.awssdk.services.guardduty.model.DescribeMalwareScansRequest)} * operation. *

* * @param describeMalwareScansRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DescribeMalwareScans * @see AWS API Documentation */ @Override public DescribeMalwareScansIterable describeMalwareScansPaginator(DescribeMalwareScansRequest describeMalwareScansRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { return new DescribeMalwareScansIterable(this, applyPaginatorUserAgent(describeMalwareScansRequest)); } /** *

* Returns information about the account selected as the delegated administrator for GuardDuty. *

* * @param describeOrganizationConfigurationRequest * @return Result of the DescribeOrganizationConfiguration operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DescribeOrganizationConfiguration * @see AWS API Documentation */ @Override public DescribeOrganizationConfigurationResponse describeOrganizationConfiguration( DescribeOrganizationConfigurationRequest describeOrganizationConfigurationRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeOrganizationConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeOrganizationConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeOrganizationConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeOrganizationConfiguration").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeOrganizationConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeOrganizationConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns information about the publishing destination specified by the provided destinationId. *

* * @param describePublishingDestinationRequest * @return Result of the DescribePublishingDestination operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DescribePublishingDestination * @see AWS API Documentation */ @Override public DescribePublishingDestinationResponse describePublishingDestination( DescribePublishingDestinationRequest describePublishingDestinationRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribePublishingDestinationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describePublishingDestinationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribePublishingDestination"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribePublishingDestination").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describePublishingDestinationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribePublishingDestinationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Disables an Amazon Web Services account within the Organization as the GuardDuty delegated administrator. *

* * @param disableOrganizationAdminAccountRequest * @return Result of the DisableOrganizationAdminAccount operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DisableOrganizationAdminAccount * @see AWS API Documentation */ @Override public DisableOrganizationAdminAccountResponse disableOrganizationAdminAccount( DisableOrganizationAdminAccountRequest disableOrganizationAdminAccountRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DisableOrganizationAdminAccountResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, disableOrganizationAdminAccountRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisableOrganizationAdminAccount"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DisableOrganizationAdminAccount").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(disableOrganizationAdminAccountRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DisableOrganizationAdminAccountRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Disassociates the current GuardDuty member account from its administrator account. *

* * @param disassociateFromAdministratorAccountRequest * @return Result of the DisassociateFromAdministratorAccount operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DisassociateFromAdministratorAccount * @see AWS API Documentation */ @Override public DisassociateFromAdministratorAccountResponse disassociateFromAdministratorAccount( DisassociateFromAdministratorAccountRequest disassociateFromAdministratorAccountRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, DisassociateFromAdministratorAccountResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, disassociateFromAdministratorAccountRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateFromAdministratorAccount"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DisassociateFromAdministratorAccount").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler) .withInput(disassociateFromAdministratorAccountRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new DisassociateFromAdministratorAccountRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Disassociates the current GuardDuty member account from its administrator account. *

* * @param disassociateFromMasterAccountRequest * @return Result of the DisassociateFromMasterAccount operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DisassociateFromMasterAccount * @see AWS API Documentation */ @Override public DisassociateFromMasterAccountResponse disassociateFromMasterAccount( DisassociateFromMasterAccountRequest disassociateFromMasterAccountRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DisassociateFromMasterAccountResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, disassociateFromMasterAccountRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateFromMasterAccount"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DisassociateFromMasterAccount").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(disassociateFromMasterAccountRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DisassociateFromMasterAccountRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Disassociates GuardDuty member accounts (to the current GuardDuty administrator account) specified by the account * IDs. *

* * @param disassociateMembersRequest * @return Result of the DisassociateMembers operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.DisassociateMembers * @see AWS * API Documentation */ @Override public DisassociateMembersResponse disassociateMembers(DisassociateMembersRequest disassociateMembersRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DisassociateMembersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, disassociateMembersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateMembers"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DisassociateMembers").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(disassociateMembersRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DisassociateMembersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Enables an Amazon Web Services account within the organization as the GuardDuty delegated administrator. *

* * @param enableOrganizationAdminAccountRequest * @return Result of the EnableOrganizationAdminAccount operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.EnableOrganizationAdminAccount * @see AWS API Documentation */ @Override public EnableOrganizationAdminAccountResponse enableOrganizationAdminAccount( EnableOrganizationAdminAccountRequest enableOrganizationAdminAccountRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, EnableOrganizationAdminAccountResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, enableOrganizationAdminAccountRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EnableOrganizationAdminAccount"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("EnableOrganizationAdminAccount").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(enableOrganizationAdminAccountRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new EnableOrganizationAdminAccountRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Provides the details for the GuardDuty administrator account associated with the current GuardDuty member * account. *

* * @param getAdministratorAccountRequest * @return Result of the GetAdministratorAccount operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetAdministratorAccount * @see AWS API Documentation */ @Override public GetAdministratorAccountResponse getAdministratorAccount(GetAdministratorAccountRequest getAdministratorAccountRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetAdministratorAccountResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getAdministratorAccountRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAdministratorAccount"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetAdministratorAccount").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getAdministratorAccountRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetAdministratorAccountRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Retrieves an Amazon GuardDuty detector specified by the detectorId. *

* * @param getDetectorRequest * @return Result of the GetDetector operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetDetector * @see AWS API * Documentation */ @Override public GetDetectorResponse getDetector(GetDetectorRequest getDetectorRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetDetectorResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getDetectorRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDetector"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetDetector").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getDetectorRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetDetectorRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns the details of the filter specified by the filter name. *

* * @param getFilterRequest * @return Result of the GetFilter operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetFilter * @see AWS API * Documentation */ @Override public GetFilterResponse getFilter(GetFilterRequest getFilterRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetFilterResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getFilterRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetFilter"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetFilter").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getFilterRequest) .withMetricCollector(apiCallMetricCollector).withMarshaller(new GetFilterRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes Amazon GuardDuty findings specified by finding IDs. *

* * @param getFindingsRequest * @return Result of the GetFindings operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetFindings * @see AWS API * Documentation */ @Override public GetFindingsResponse getFindings(GetFindingsRequest getFindingsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetFindingsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getFindingsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetFindings"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetFindings").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getFindingsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetFindingsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists Amazon GuardDuty findings statistics for the specified detector ID. *

* * @param getFindingsStatisticsRequest * @return Result of the GetFindingsStatistics operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetFindingsStatistics * @see AWS API Documentation */ @Override public GetFindingsStatisticsResponse getFindingsStatistics(GetFindingsStatisticsRequest getFindingsStatisticsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetFindingsStatisticsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getFindingsStatisticsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetFindingsStatistics"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetFindingsStatistics").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getFindingsStatisticsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetFindingsStatisticsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Retrieves the IPSet specified by the ipSetId. *

* * @param getIpSetRequest * @return Result of the GetIPSet operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetIPSet * @see AWS API * Documentation */ @Override public GetIpSetResponse getIPSet(GetIpSetRequest getIpSetRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetIpSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getIpSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetIPSet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetIPSet").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getIpSetRequest) .withMetricCollector(apiCallMetricCollector).withMarshaller(new GetIpSetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns the count of all GuardDuty membership invitations that were sent to the current member account except the * currently accepted invitation. *

* * @param getInvitationsCountRequest * @return Result of the GetInvitationsCount operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetInvitationsCount * @see AWS * API Documentation */ @Override public GetInvitationsCountResponse getInvitationsCount(GetInvitationsCountRequest getInvitationsCountRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetInvitationsCountResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getInvitationsCountRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetInvitationsCount"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetInvitationsCount").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getInvitationsCountRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetInvitationsCountRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns the details of the malware scan settings. *

* * @param getMalwareScanSettingsRequest * @return Result of the GetMalwareScanSettings operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetMalwareScanSettings * @see AWS API Documentation */ @Override public GetMalwareScanSettingsResponse getMalwareScanSettings(GetMalwareScanSettingsRequest getMalwareScanSettingsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetMalwareScanSettingsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getMalwareScanSettingsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetMalwareScanSettings"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetMalwareScanSettings").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getMalwareScanSettingsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetMalwareScanSettingsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Provides the details for the GuardDuty administrator account associated with the current GuardDuty member * account. *

* * @param getMasterAccountRequest * @return Result of the GetMasterAccount operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetMasterAccount * @see AWS * API Documentation */ @Override public GetMasterAccountResponse getMasterAccount(GetMasterAccountRequest getMasterAccountRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetMasterAccountResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getMasterAccountRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetMasterAccount"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetMasterAccount").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getMasterAccountRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetMasterAccountRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes which data sources are enabled for the member account's detector. *

* * @param getMemberDetectorsRequest * @return Result of the GetMemberDetectors operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetMemberDetectors * @see AWS * API Documentation */ @Override public GetMemberDetectorsResponse getMemberDetectors(GetMemberDetectorsRequest getMemberDetectorsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetMemberDetectorsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getMemberDetectorsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetMemberDetectors"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetMemberDetectors").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getMemberDetectorsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetMemberDetectorsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Retrieves GuardDuty member accounts (of the current GuardDuty administrator account) specified by the account * IDs. *

* * @param getMembersRequest * @return Result of the GetMembers operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetMembers * @see AWS API * Documentation */ @Override public GetMembersResponse getMembers(GetMembersRequest getMembersRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetMembersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getMembersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetMembers"); return clientHandler .execute(new ClientExecutionParams().withOperationName("GetMembers") .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withInput(getMembersRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetMembersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Provides the number of days left for each data source used in the free trial period. *

* * @param getRemainingFreeTrialDaysRequest * @return Result of the GetRemainingFreeTrialDays operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetRemainingFreeTrialDays * @see AWS API Documentation */ @Override public GetRemainingFreeTrialDaysResponse getRemainingFreeTrialDays( GetRemainingFreeTrialDaysRequest getRemainingFreeTrialDaysRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetRemainingFreeTrialDaysResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getRemainingFreeTrialDaysRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRemainingFreeTrialDays"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetRemainingFreeTrialDays").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getRemainingFreeTrialDaysRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetRemainingFreeTrialDaysRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Retrieves the ThreatIntelSet that is specified by the ThreatIntelSet ID. *

* * @param getThreatIntelSetRequest * @return Result of the GetThreatIntelSet operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetThreatIntelSet * @see AWS * API Documentation */ @Override public GetThreatIntelSetResponse getThreatIntelSet(GetThreatIntelSetRequest getThreatIntelSetRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetThreatIntelSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getThreatIntelSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetThreatIntelSet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetThreatIntelSet").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getThreatIntelSetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetThreatIntelSetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists Amazon GuardDuty usage statistics over the last 30 days for the specified detector ID. For newly enabled * detectors or data sources, the cost returned will include only the usage so far under 30 days. This may differ * from the cost metrics in the console, which project usage over 30 days to provide a monthly cost estimate. For * more information, see Understanding How * Usage Costs are Calculated. *

* * @param getUsageStatisticsRequest * @return Result of the GetUsageStatistics operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetUsageStatistics * @see AWS * API Documentation */ @Override public GetUsageStatisticsResponse getUsageStatistics(GetUsageStatisticsRequest getUsageStatisticsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetUsageStatisticsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getUsageStatisticsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetUsageStatistics"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetUsageStatistics").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getUsageStatisticsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetUsageStatisticsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists Amazon GuardDuty usage statistics over the last 30 days for the specified detector ID. For newly enabled * detectors or data sources, the cost returned will include only the usage so far under 30 days. This may differ * from the cost metrics in the console, which project usage over 30 days to provide a monthly cost estimate. For * more information, see Understanding How * Usage Costs are Calculated. *

*
*

* This is a variant of * {@link #getUsageStatistics(software.amazon.awssdk.services.guardduty.model.GetUsageStatisticsRequest)} operation. * The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally * handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.GetUsageStatisticsIterable responses = client.getUsageStatisticsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.guardduty.paginators.GetUsageStatisticsIterable responses = client
     *             .getUsageStatisticsPaginator(request);
     *     for (software.amazon.awssdk.services.guardduty.model.GetUsageStatisticsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.GetUsageStatisticsIterable responses = client.getUsageStatisticsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* 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 #getUsageStatistics(software.amazon.awssdk.services.guardduty.model.GetUsageStatisticsRequest)} * operation. *

* * @param getUsageStatisticsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.GetUsageStatistics * @see AWS * API Documentation */ @Override public GetUsageStatisticsIterable getUsageStatisticsPaginator(GetUsageStatisticsRequest getUsageStatisticsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { return new GetUsageStatisticsIterable(this, applyPaginatorUserAgent(getUsageStatisticsRequest)); } /** *

* Invites other Amazon Web Services accounts (created as members of the current Amazon Web Services account by * CreateMembers) to enable GuardDuty, and allow the current Amazon Web Services account to view and manage these * accounts' findings on their behalf as the GuardDuty administrator account. *

* * @param inviteMembersRequest * @return Result of the InviteMembers operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.InviteMembers * @see AWS API * Documentation */ @Override public InviteMembersResponse inviteMembers(InviteMembersRequest inviteMembersRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, InviteMembersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, inviteMembersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "InviteMembers"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("InviteMembers").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(inviteMembersRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new InviteMembersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists detectorIds of all the existing Amazon GuardDuty detector resources. *

* * @param listDetectorsRequest * @return Result of the ListDetectors operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListDetectors * @see AWS API * Documentation */ @Override public ListDetectorsResponse listDetectors(ListDetectorsRequest listDetectorsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListDetectorsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listDetectorsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDetectors"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListDetectors").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listDetectorsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListDetectorsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists detectorIds of all the existing Amazon GuardDuty detector resources. *

*
*

* This is a variant of {@link #listDetectors(software.amazon.awssdk.services.guardduty.model.ListDetectorsRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListDetectorsIterable responses = client.listDetectorsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.guardduty.paginators.ListDetectorsIterable responses = client.listDetectorsPaginator(request);
     *     for (software.amazon.awssdk.services.guardduty.model.ListDetectorsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListDetectorsIterable responses = client.listDetectorsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* 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 #listDetectors(software.amazon.awssdk.services.guardduty.model.ListDetectorsRequest)} operation. *

* * @param listDetectorsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListDetectors * @see AWS API * Documentation */ @Override public ListDetectorsIterable listDetectorsPaginator(ListDetectorsRequest listDetectorsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { return new ListDetectorsIterable(this, applyPaginatorUserAgent(listDetectorsRequest)); } /** *

* Returns a paginated list of the current filters. *

* * @param listFiltersRequest * @return Result of the ListFilters operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListFilters * @see AWS API * Documentation */ @Override public ListFiltersResponse listFilters(ListFiltersRequest listFiltersRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListFiltersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listFiltersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListFilters"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListFilters").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listFiltersRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListFiltersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns a paginated list of the current filters. *

*
*

* This is a variant of {@link #listFilters(software.amazon.awssdk.services.guardduty.model.ListFiltersRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListFiltersIterable responses = client.listFiltersPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.guardduty.paginators.ListFiltersIterable responses = client.listFiltersPaginator(request);
     *     for (software.amazon.awssdk.services.guardduty.model.ListFiltersResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListFiltersIterable responses = client.listFiltersPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* 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 #listFilters(software.amazon.awssdk.services.guardduty.model.ListFiltersRequest)} operation. *

* * @param listFiltersRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListFilters * @see AWS API * Documentation */ @Override public ListFiltersIterable listFiltersPaginator(ListFiltersRequest listFiltersRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { return new ListFiltersIterable(this, applyPaginatorUserAgent(listFiltersRequest)); } /** *

* Lists Amazon GuardDuty findings for the specified detector ID. *

* * @param listFindingsRequest * @return Result of the ListFindings operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListFindings * @see AWS API * Documentation */ @Override public ListFindingsResponse listFindings(ListFindingsRequest listFindingsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListFindingsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listFindingsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListFindings"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListFindings").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listFindingsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListFindingsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists Amazon GuardDuty findings for the specified detector ID. *

*
*

* This is a variant of {@link #listFindings(software.amazon.awssdk.services.guardduty.model.ListFindingsRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListFindingsIterable responses = client.listFindingsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.guardduty.paginators.ListFindingsIterable responses = client.listFindingsPaginator(request);
     *     for (software.amazon.awssdk.services.guardduty.model.ListFindingsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListFindingsIterable responses = client.listFindingsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* 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 #listFindings(software.amazon.awssdk.services.guardduty.model.ListFindingsRequest)} operation. *

* * @param listFindingsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListFindings * @see AWS API * Documentation */ @Override public ListFindingsIterable listFindingsPaginator(ListFindingsRequest listFindingsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { return new ListFindingsIterable(this, applyPaginatorUserAgent(listFindingsRequest)); } /** *

* Lists the IPSets of the GuardDuty service specified by the detector ID. If you use this operation from a member * account, the IPSets returned are the IPSets from the associated administrator account. *

* * @param listIpSetsRequest * @return Result of the ListIPSets operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListIPSets * @see AWS API * Documentation */ @Override public ListIpSetsResponse listIPSets(ListIpSetsRequest listIpSetsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListIpSetsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listIpSetsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListIPSets"); return clientHandler .execute(new ClientExecutionParams().withOperationName("ListIPSets") .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withInput(listIpSetsRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListIpSetsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the IPSets of the GuardDuty service specified by the detector ID. If you use this operation from a member * account, the IPSets returned are the IPSets from the associated administrator account. *

*
*

* This is a variant of {@link #listIPSets(software.amazon.awssdk.services.guardduty.model.ListIpSetsRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListIPSetsIterable responses = client.listIPSetsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.guardduty.paginators.ListIPSetsIterable responses = client.listIPSetsPaginator(request);
     *     for (software.amazon.awssdk.services.guardduty.model.ListIpSetsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListIPSetsIterable responses = client.listIPSetsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* 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 #listIPSets(software.amazon.awssdk.services.guardduty.model.ListIpSetsRequest)} operation. *

* * @param listIpSetsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListIPSets * @see AWS API * Documentation */ @Override public ListIPSetsIterable listIPSetsPaginator(ListIpSetsRequest listIpSetsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { return new ListIPSetsIterable(this, applyPaginatorUserAgent(listIpSetsRequest)); } /** *

* Lists all GuardDuty membership invitations that were sent to the current Amazon Web Services account. *

* * @param listInvitationsRequest * @return Result of the ListInvitations operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListInvitations * @see AWS API * Documentation */ @Override public ListInvitationsResponse listInvitations(ListInvitationsRequest listInvitationsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListInvitationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listInvitationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListInvitations"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListInvitations").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listInvitationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListInvitationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists all GuardDuty membership invitations that were sent to the current Amazon Web Services account. *

*
*

* This is a variant of * {@link #listInvitations(software.amazon.awssdk.services.guardduty.model.ListInvitationsRequest)} operation. The * return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle * making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListInvitationsIterable responses = client.listInvitationsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.guardduty.paginators.ListInvitationsIterable responses = client
     *             .listInvitationsPaginator(request);
     *     for (software.amazon.awssdk.services.guardduty.model.ListInvitationsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListInvitationsIterable responses = client.listInvitationsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* 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 #listInvitations(software.amazon.awssdk.services.guardduty.model.ListInvitationsRequest)} operation. *

* * @param listInvitationsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListInvitations * @see AWS API * Documentation */ @Override public ListInvitationsIterable listInvitationsPaginator(ListInvitationsRequest listInvitationsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { return new ListInvitationsIterable(this, applyPaginatorUserAgent(listInvitationsRequest)); } /** *

* Lists details about all member accounts for the current GuardDuty administrator account. *

* * @param listMembersRequest * @return Result of the ListMembers operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListMembers * @see AWS API * Documentation */ @Override public ListMembersResponse listMembers(ListMembersRequest listMembersRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListMembersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listMembersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListMembers"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListMembers").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listMembersRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListMembersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists details about all member accounts for the current GuardDuty administrator account. *

*
*

* This is a variant of {@link #listMembers(software.amazon.awssdk.services.guardduty.model.ListMembersRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListMembersIterable responses = client.listMembersPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.guardduty.paginators.ListMembersIterable responses = client.listMembersPaginator(request);
     *     for (software.amazon.awssdk.services.guardduty.model.ListMembersResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListMembersIterable responses = client.listMembersPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* 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 #listMembers(software.amazon.awssdk.services.guardduty.model.ListMembersRequest)} operation. *

* * @param listMembersRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListMembers * @see AWS API * Documentation */ @Override public ListMembersIterable listMembersPaginator(ListMembersRequest listMembersRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { return new ListMembersIterable(this, applyPaginatorUserAgent(listMembersRequest)); } /** *

* Lists the accounts configured as GuardDuty delegated administrators. *

* * @param listOrganizationAdminAccountsRequest * @return Result of the ListOrganizationAdminAccounts operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListOrganizationAdminAccounts * @see AWS API Documentation */ @Override public ListOrganizationAdminAccountsResponse listOrganizationAdminAccounts( ListOrganizationAdminAccountsRequest listOrganizationAdminAccountsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListOrganizationAdminAccountsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listOrganizationAdminAccountsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListOrganizationAdminAccounts"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListOrganizationAdminAccounts").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listOrganizationAdminAccountsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListOrganizationAdminAccountsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the accounts configured as GuardDuty delegated administrators. *

*
*

* This is a variant of * {@link #listOrganizationAdminAccounts(software.amazon.awssdk.services.guardduty.model.ListOrganizationAdminAccountsRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListOrganizationAdminAccountsIterable responses = client.listOrganizationAdminAccountsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.guardduty.paginators.ListOrganizationAdminAccountsIterable responses = client
     *             .listOrganizationAdminAccountsPaginator(request);
     *     for (software.amazon.awssdk.services.guardduty.model.ListOrganizationAdminAccountsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListOrganizationAdminAccountsIterable responses = client.listOrganizationAdminAccountsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* 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 #listOrganizationAdminAccounts(software.amazon.awssdk.services.guardduty.model.ListOrganizationAdminAccountsRequest)} * operation. *

* * @param listOrganizationAdminAccountsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListOrganizationAdminAccounts * @see AWS API Documentation */ @Override public ListOrganizationAdminAccountsIterable listOrganizationAdminAccountsPaginator( ListOrganizationAdminAccountsRequest listOrganizationAdminAccountsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { return new ListOrganizationAdminAccountsIterable(this, applyPaginatorUserAgent(listOrganizationAdminAccountsRequest)); } /** *

* Returns a list of publishing destinations associated with the specified detectorId. *

* * @param listPublishingDestinationsRequest * @return Result of the ListPublishingDestinations operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListPublishingDestinations * @see AWS API Documentation */ @Override public ListPublishingDestinationsResponse listPublishingDestinations( ListPublishingDestinationsRequest listPublishingDestinationsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListPublishingDestinationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listPublishingDestinationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListPublishingDestinations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListPublishingDestinations").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listPublishingDestinationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListPublishingDestinationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns a list of publishing destinations associated with the specified detectorId. *

*
*

* This is a variant of * {@link #listPublishingDestinations(software.amazon.awssdk.services.guardduty.model.ListPublishingDestinationsRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListPublishingDestinationsIterable responses = client.listPublishingDestinationsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.guardduty.paginators.ListPublishingDestinationsIterable responses = client
     *             .listPublishingDestinationsPaginator(request);
     *     for (software.amazon.awssdk.services.guardduty.model.ListPublishingDestinationsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListPublishingDestinationsIterable responses = client.listPublishingDestinationsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* 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 #listPublishingDestinations(software.amazon.awssdk.services.guardduty.model.ListPublishingDestinationsRequest)} * operation. *

* * @param listPublishingDestinationsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListPublishingDestinations * @see AWS API Documentation */ @Override public ListPublishingDestinationsIterable listPublishingDestinationsPaginator( ListPublishingDestinationsRequest listPublishingDestinationsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { return new ListPublishingDestinationsIterable(this, applyPaginatorUserAgent(listPublishingDestinationsRequest)); } /** *

* Lists tags for a resource. Tagging is currently supported for detectors, finding filters, IP sets, and threat * intel sets, with a limit of 50 tags per resource. When invoked, this operation returns all assigned tags for a * given resource. *

* * @param listTagsForResourceRequest * @return Result of the ListTagsForResource operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListTagsForResource * @see AWS * API Documentation */ @Override public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListTagsForResource").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listTagsForResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the ThreatIntelSets of the GuardDuty service specified by the detector ID. If you use this operation from a * member account, the ThreatIntelSets associated with the administrator account are returned. *

* * @param listThreatIntelSetsRequest * @return Result of the ListThreatIntelSets operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListThreatIntelSets * @see AWS * API Documentation */ @Override public ListThreatIntelSetsResponse listThreatIntelSets(ListThreatIntelSetsRequest listThreatIntelSetsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListThreatIntelSetsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listThreatIntelSetsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListThreatIntelSets"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListThreatIntelSets").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listThreatIntelSetsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListThreatIntelSetsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the ThreatIntelSets of the GuardDuty service specified by the detector ID. If you use this operation from a * member account, the ThreatIntelSets associated with the administrator account are returned. *

*
*

* This is a variant of * {@link #listThreatIntelSets(software.amazon.awssdk.services.guardduty.model.ListThreatIntelSetsRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListThreatIntelSetsIterable responses = client.listThreatIntelSetsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.guardduty.paginators.ListThreatIntelSetsIterable responses = client
     *             .listThreatIntelSetsPaginator(request);
     *     for (software.amazon.awssdk.services.guardduty.model.ListThreatIntelSetsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.guardduty.paginators.ListThreatIntelSetsIterable responses = client.listThreatIntelSetsPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* 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 #listThreatIntelSets(software.amazon.awssdk.services.guardduty.model.ListThreatIntelSetsRequest)} * operation. *

* * @param listThreatIntelSetsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.ListThreatIntelSets * @see AWS * API Documentation */ @Override public ListThreatIntelSetsIterable listThreatIntelSetsPaginator(ListThreatIntelSetsRequest listThreatIntelSetsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { return new ListThreatIntelSetsIterable(this, applyPaginatorUserAgent(listThreatIntelSetsRequest)); } /** *

* Turns on GuardDuty monitoring of the specified member accounts. Use this operation to restart monitoring of * accounts that you stopped monitoring with the StopMonitoringMembers operation. *

* * @param startMonitoringMembersRequest * @return Result of the StartMonitoringMembers operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.StartMonitoringMembers * @see AWS API Documentation */ @Override public StartMonitoringMembersResponse startMonitoringMembers(StartMonitoringMembersRequest startMonitoringMembersRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StartMonitoringMembersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, startMonitoringMembersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartMonitoringMembers"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("StartMonitoringMembers").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(startMonitoringMembersRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new StartMonitoringMembersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Stops GuardDuty monitoring for the specified member accounts. Use the StartMonitoringMembers * operation to restart monitoring for those accounts. *

* * @param stopMonitoringMembersRequest * @return Result of the StopMonitoringMembers operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.StopMonitoringMembers * @see AWS API Documentation */ @Override public StopMonitoringMembersResponse stopMonitoringMembers(StopMonitoringMembersRequest stopMonitoringMembersRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StopMonitoringMembersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, stopMonitoringMembersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StopMonitoringMembers"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("StopMonitoringMembers").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(stopMonitoringMembersRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new StopMonitoringMembersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Adds tags to a resource. *

* * @param tagResourceRequest * @return Result of the TagResource operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.TagResource * @see AWS API * Documentation */ @Override public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("TagResource").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(tagResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new TagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Unarchives GuardDuty findings specified by the findingIds. *

* * @param unarchiveFindingsRequest * @return Result of the UnarchiveFindings operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.UnarchiveFindings * @see AWS * API Documentation */ @Override public UnarchiveFindingsResponse unarchiveFindings(UnarchiveFindingsRequest unarchiveFindingsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UnarchiveFindingsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, unarchiveFindingsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UnarchiveFindings"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UnarchiveFindings").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(unarchiveFindingsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UnarchiveFindingsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes tags from a resource. *

* * @param untagResourceRequest * @return Result of the UntagResource operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.UntagResource * @see AWS API * Documentation */ @Override public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UntagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UntagResource").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(untagResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UntagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the Amazon GuardDuty detector specified by the detectorId. *

* * @param updateDetectorRequest * @return Result of the UpdateDetector operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.UpdateDetector * @see AWS API * Documentation */ @Override public UpdateDetectorResponse updateDetector(UpdateDetectorRequest updateDetectorRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateDetectorResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateDetectorRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateDetector"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateDetector").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(updateDetectorRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateDetectorRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the filter specified by the filter name. *

* * @param updateFilterRequest * @return Result of the UpdateFilter operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.UpdateFilter * @see AWS API * Documentation */ @Override public UpdateFilterResponse updateFilter(UpdateFilterRequest updateFilterRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateFilterResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateFilterRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateFilter"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateFilter").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(updateFilterRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateFilterRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Marks the specified GuardDuty findings as useful or not useful. *

* * @param updateFindingsFeedbackRequest * @return Result of the UpdateFindingsFeedback operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.UpdateFindingsFeedback * @see AWS API Documentation */ @Override public UpdateFindingsFeedbackResponse updateFindingsFeedback(UpdateFindingsFeedbackRequest updateFindingsFeedbackRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateFindingsFeedbackResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateFindingsFeedbackRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateFindingsFeedback"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateFindingsFeedback").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(updateFindingsFeedbackRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateFindingsFeedbackRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the IPSet specified by the IPSet ID. *

* * @param updateIpSetRequest * @return Result of the UpdateIPSet operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.UpdateIPSet * @see AWS API * Documentation */ @Override public UpdateIpSetResponse updateIPSet(UpdateIpSetRequest updateIpSetRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateIpSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateIpSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateIPSet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateIPSet").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(updateIpSetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateIpSetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the malware scan settings. *

* * @param updateMalwareScanSettingsRequest * @return Result of the UpdateMalwareScanSettings operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.UpdateMalwareScanSettings * @see AWS API Documentation */ @Override public UpdateMalwareScanSettingsResponse updateMalwareScanSettings( UpdateMalwareScanSettingsRequest updateMalwareScanSettingsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateMalwareScanSettingsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateMalwareScanSettingsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateMalwareScanSettings"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateMalwareScanSettings").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(updateMalwareScanSettingsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateMalwareScanSettingsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Contains information on member accounts to be updated. *

* * @param updateMemberDetectorsRequest * @return Result of the UpdateMemberDetectors operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.UpdateMemberDetectors * @see AWS API Documentation */ @Override public UpdateMemberDetectorsResponse updateMemberDetectors(UpdateMemberDetectorsRequest updateMemberDetectorsRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateMemberDetectorsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateMemberDetectorsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateMemberDetectors"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateMemberDetectors").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(updateMemberDetectorsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateMemberDetectorsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the delegated administrator account with the values provided. *

* * @param updateOrganizationConfigurationRequest * @return Result of the UpdateOrganizationConfiguration operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.UpdateOrganizationConfiguration * @see AWS API Documentation */ @Override public UpdateOrganizationConfigurationResponse updateOrganizationConfiguration( UpdateOrganizationConfigurationRequest updateOrganizationConfigurationRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateOrganizationConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateOrganizationConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateOrganizationConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateOrganizationConfiguration").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(updateOrganizationConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateOrganizationConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates information about the publishing destination specified by the destinationId. *

* * @param updatePublishingDestinationRequest * @return Result of the UpdatePublishingDestination operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.UpdatePublishingDestination * @see AWS API Documentation */ @Override public UpdatePublishingDestinationResponse updatePublishingDestination( UpdatePublishingDestinationRequest updatePublishingDestinationRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdatePublishingDestinationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, updatePublishingDestinationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdatePublishingDestination"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdatePublishingDestination").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(updatePublishingDestinationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdatePublishingDestinationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the ThreatIntelSet specified by the ThreatIntelSet ID. *

* * @param updateThreatIntelSetRequest * @return Result of the UpdateThreatIntelSet operation returned by the service. * @throws BadRequestException * A bad request exception object. * @throws InternalServerErrorException * An internal server error exception object. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GuardDutyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GuardDutyClient.UpdateThreatIntelSet * @see AWS API Documentation */ @Override public UpdateThreatIntelSetResponse updateThreatIntelSet(UpdateThreatIntelSetRequest updateThreatIntelSetRequest) throws BadRequestException, InternalServerErrorException, AwsServiceException, SdkClientException, GuardDutyException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateThreatIntelSetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateThreatIntelSetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "GuardDuty"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateThreatIntelSet"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateThreatIntelSet").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(updateThreatIntelSetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateThreatIntelSetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); } if (publishers == null || publishers.isEmpty()) { publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS); } if (publishers == null) { publishers = Collections.emptyList(); } return publishers; } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(GuardDutyException::builder) .protocol(AwsJsonProtocol.REST_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("BadRequestException") .exceptionBuilderSupplier(BadRequestException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServerErrorException") .exceptionBuilderSupplier(InternalServerErrorException::builder).httpStatusCode(500).build()); } @Override public void close() { clientHandler.close(); } private T applyPaginatorUserAgent(T request) { Consumer userAgentApplier = b -> b.addApiName(ApiName.builder() .version(VersionInfo.SDK_VERSION).name("PAGINATED").build()); AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration() .map(c -> c.toBuilder().applyMutation(userAgentApplier).build()) .orElse((AwsRequestOverrideConfiguration.builder().applyMutation(userAgentApplier).build())); return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy