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

software.amazon.awssdk.services.inspector.DefaultInspectorClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Inspector Service module holds the client classes that are used for communicating with Amazon Inspector Service

There is a newer version: 2.29.39
Show newest version
/*
 * 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.inspector;

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.inspector.model.AccessDeniedException;
import software.amazon.awssdk.services.inspector.model.AddAttributesToFindingsRequest;
import software.amazon.awssdk.services.inspector.model.AddAttributesToFindingsResponse;
import software.amazon.awssdk.services.inspector.model.AgentsAlreadyRunningAssessmentException;
import software.amazon.awssdk.services.inspector.model.AssessmentRunInProgressException;
import software.amazon.awssdk.services.inspector.model.CreateAssessmentTargetRequest;
import software.amazon.awssdk.services.inspector.model.CreateAssessmentTargetResponse;
import software.amazon.awssdk.services.inspector.model.CreateAssessmentTemplateRequest;
import software.amazon.awssdk.services.inspector.model.CreateAssessmentTemplateResponse;
import software.amazon.awssdk.services.inspector.model.CreateExclusionsPreviewRequest;
import software.amazon.awssdk.services.inspector.model.CreateExclusionsPreviewResponse;
import software.amazon.awssdk.services.inspector.model.CreateResourceGroupRequest;
import software.amazon.awssdk.services.inspector.model.CreateResourceGroupResponse;
import software.amazon.awssdk.services.inspector.model.DeleteAssessmentRunRequest;
import software.amazon.awssdk.services.inspector.model.DeleteAssessmentRunResponse;
import software.amazon.awssdk.services.inspector.model.DeleteAssessmentTargetRequest;
import software.amazon.awssdk.services.inspector.model.DeleteAssessmentTargetResponse;
import software.amazon.awssdk.services.inspector.model.DeleteAssessmentTemplateRequest;
import software.amazon.awssdk.services.inspector.model.DeleteAssessmentTemplateResponse;
import software.amazon.awssdk.services.inspector.model.DescribeAssessmentRunsRequest;
import software.amazon.awssdk.services.inspector.model.DescribeAssessmentRunsResponse;
import software.amazon.awssdk.services.inspector.model.DescribeAssessmentTargetsRequest;
import software.amazon.awssdk.services.inspector.model.DescribeAssessmentTargetsResponse;
import software.amazon.awssdk.services.inspector.model.DescribeAssessmentTemplatesRequest;
import software.amazon.awssdk.services.inspector.model.DescribeAssessmentTemplatesResponse;
import software.amazon.awssdk.services.inspector.model.DescribeCrossAccountAccessRoleRequest;
import software.amazon.awssdk.services.inspector.model.DescribeCrossAccountAccessRoleResponse;
import software.amazon.awssdk.services.inspector.model.DescribeExclusionsRequest;
import software.amazon.awssdk.services.inspector.model.DescribeExclusionsResponse;
import software.amazon.awssdk.services.inspector.model.DescribeFindingsRequest;
import software.amazon.awssdk.services.inspector.model.DescribeFindingsResponse;
import software.amazon.awssdk.services.inspector.model.DescribeResourceGroupsRequest;
import software.amazon.awssdk.services.inspector.model.DescribeResourceGroupsResponse;
import software.amazon.awssdk.services.inspector.model.DescribeRulesPackagesRequest;
import software.amazon.awssdk.services.inspector.model.DescribeRulesPackagesResponse;
import software.amazon.awssdk.services.inspector.model.GetAssessmentReportRequest;
import software.amazon.awssdk.services.inspector.model.GetAssessmentReportResponse;
import software.amazon.awssdk.services.inspector.model.GetExclusionsPreviewRequest;
import software.amazon.awssdk.services.inspector.model.GetExclusionsPreviewResponse;
import software.amazon.awssdk.services.inspector.model.GetTelemetryMetadataRequest;
import software.amazon.awssdk.services.inspector.model.GetTelemetryMetadataResponse;
import software.amazon.awssdk.services.inspector.model.InspectorException;
import software.amazon.awssdk.services.inspector.model.InspectorRequest;
import software.amazon.awssdk.services.inspector.model.InternalException;
import software.amazon.awssdk.services.inspector.model.InvalidCrossAccountRoleException;
import software.amazon.awssdk.services.inspector.model.InvalidInputException;
import software.amazon.awssdk.services.inspector.model.LimitExceededException;
import software.amazon.awssdk.services.inspector.model.ListAssessmentRunAgentsRequest;
import software.amazon.awssdk.services.inspector.model.ListAssessmentRunAgentsResponse;
import software.amazon.awssdk.services.inspector.model.ListAssessmentRunsRequest;
import software.amazon.awssdk.services.inspector.model.ListAssessmentRunsResponse;
import software.amazon.awssdk.services.inspector.model.ListAssessmentTargetsRequest;
import software.amazon.awssdk.services.inspector.model.ListAssessmentTargetsResponse;
import software.amazon.awssdk.services.inspector.model.ListAssessmentTemplatesRequest;
import software.amazon.awssdk.services.inspector.model.ListAssessmentTemplatesResponse;
import software.amazon.awssdk.services.inspector.model.ListEventSubscriptionsRequest;
import software.amazon.awssdk.services.inspector.model.ListEventSubscriptionsResponse;
import software.amazon.awssdk.services.inspector.model.ListExclusionsRequest;
import software.amazon.awssdk.services.inspector.model.ListExclusionsResponse;
import software.amazon.awssdk.services.inspector.model.ListFindingsRequest;
import software.amazon.awssdk.services.inspector.model.ListFindingsResponse;
import software.amazon.awssdk.services.inspector.model.ListRulesPackagesRequest;
import software.amazon.awssdk.services.inspector.model.ListRulesPackagesResponse;
import software.amazon.awssdk.services.inspector.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.inspector.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.inspector.model.NoSuchEntityException;
import software.amazon.awssdk.services.inspector.model.PreviewAgentsRequest;
import software.amazon.awssdk.services.inspector.model.PreviewAgentsResponse;
import software.amazon.awssdk.services.inspector.model.PreviewGenerationInProgressException;
import software.amazon.awssdk.services.inspector.model.RegisterCrossAccountAccessRoleRequest;
import software.amazon.awssdk.services.inspector.model.RegisterCrossAccountAccessRoleResponse;
import software.amazon.awssdk.services.inspector.model.RemoveAttributesFromFindingsRequest;
import software.amazon.awssdk.services.inspector.model.RemoveAttributesFromFindingsResponse;
import software.amazon.awssdk.services.inspector.model.ServiceTemporarilyUnavailableException;
import software.amazon.awssdk.services.inspector.model.SetTagsForResourceRequest;
import software.amazon.awssdk.services.inspector.model.SetTagsForResourceResponse;
import software.amazon.awssdk.services.inspector.model.StartAssessmentRunRequest;
import software.amazon.awssdk.services.inspector.model.StartAssessmentRunResponse;
import software.amazon.awssdk.services.inspector.model.StopAssessmentRunRequest;
import software.amazon.awssdk.services.inspector.model.StopAssessmentRunResponse;
import software.amazon.awssdk.services.inspector.model.SubscribeToEventRequest;
import software.amazon.awssdk.services.inspector.model.SubscribeToEventResponse;
import software.amazon.awssdk.services.inspector.model.UnsubscribeFromEventRequest;
import software.amazon.awssdk.services.inspector.model.UnsubscribeFromEventResponse;
import software.amazon.awssdk.services.inspector.model.UnsupportedFeatureException;
import software.amazon.awssdk.services.inspector.model.UpdateAssessmentTargetRequest;
import software.amazon.awssdk.services.inspector.model.UpdateAssessmentTargetResponse;
import software.amazon.awssdk.services.inspector.paginators.GetExclusionsPreviewIterable;
import software.amazon.awssdk.services.inspector.paginators.ListAssessmentRunAgentsIterable;
import software.amazon.awssdk.services.inspector.paginators.ListAssessmentRunsIterable;
import software.amazon.awssdk.services.inspector.paginators.ListAssessmentTargetsIterable;
import software.amazon.awssdk.services.inspector.paginators.ListAssessmentTemplatesIterable;
import software.amazon.awssdk.services.inspector.paginators.ListEventSubscriptionsIterable;
import software.amazon.awssdk.services.inspector.paginators.ListExclusionsIterable;
import software.amazon.awssdk.services.inspector.paginators.ListFindingsIterable;
import software.amazon.awssdk.services.inspector.paginators.ListRulesPackagesIterable;
import software.amazon.awssdk.services.inspector.paginators.PreviewAgentsIterable;
import software.amazon.awssdk.services.inspector.transform.AddAttributesToFindingsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.CreateAssessmentTargetRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.CreateAssessmentTemplateRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.CreateExclusionsPreviewRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.CreateResourceGroupRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.DeleteAssessmentRunRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.DeleteAssessmentTargetRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.DeleteAssessmentTemplateRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.DescribeAssessmentRunsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.DescribeAssessmentTargetsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.DescribeAssessmentTemplatesRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.DescribeCrossAccountAccessRoleRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.DescribeExclusionsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.DescribeFindingsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.DescribeResourceGroupsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.DescribeRulesPackagesRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.GetAssessmentReportRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.GetExclusionsPreviewRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.GetTelemetryMetadataRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.ListAssessmentRunAgentsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.ListAssessmentRunsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.ListAssessmentTargetsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.ListAssessmentTemplatesRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.ListEventSubscriptionsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.ListExclusionsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.ListFindingsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.ListRulesPackagesRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.PreviewAgentsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.RegisterCrossAccountAccessRoleRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.RemoveAttributesFromFindingsRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.SetTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.StartAssessmentRunRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.StopAssessmentRunRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.SubscribeToEventRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.UnsubscribeFromEventRequestMarshaller;
import software.amazon.awssdk.services.inspector.transform.UpdateAssessmentTargetRequestMarshaller;
import software.amazon.awssdk.utils.Logger;

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

    private final SyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

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

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

    /**
     * 

* Assigns attributes (key and value pairs) to the findings that are specified by the ARNs of the findings. *

* * @param addAttributesToFindingsRequest * @return Result of the AddAttributesToFindings operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.AddAttributesToFindings * @see AWS API Documentation */ @Override public AddAttributesToFindingsResponse addAttributesToFindings(AddAttributesToFindingsRequest addAttributesToFindingsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, AddAttributesToFindingsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, addAttributesToFindingsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AddAttributesToFindings"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("AddAttributesToFindings").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(addAttributesToFindingsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new AddAttributesToFindingsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a new assessment target using the ARN of the resource group that is generated by * CreateResourceGroup. If resourceGroupArn is not specified, all EC2 instances in the current AWS account * and region are included in the assessment target. If the service-linked role isn’t * already registered, this action also creates and registers a service-linked role to grant Amazon Inspector access * to AWS Services needed to perform security assessments. You can create up to 50 assessment targets per AWS * account. You can run up to 500 concurrent agents per AWS account. For more information, see Amazon Inspector * Assessment Targets. *

* * @param createAssessmentTargetRequest * @return Result of the CreateAssessmentTarget operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws LimitExceededException * The request was rejected because it attempted to create resources beyond the current AWS account limits. * The error code describes the limit exceeded. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws InvalidCrossAccountRoleException * Amazon Inspector cannot assume the cross-account role that it needs to list your EC2 instances during the * assessment run. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.CreateAssessmentTarget * @see AWS API Documentation */ @Override public CreateAssessmentTargetResponse createAssessmentTarget(CreateAssessmentTargetRequest createAssessmentTargetRequest) throws InternalException, InvalidInputException, LimitExceededException, AccessDeniedException, NoSuchEntityException, InvalidCrossAccountRoleException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateAssessmentTargetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createAssessmentTargetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateAssessmentTarget"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateAssessmentTarget").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createAssessmentTargetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateAssessmentTargetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates an assessment template for the assessment target that is specified by the ARN of the assessment target. * If the service-linked * role isn’t already registered, this action also creates and registers a service-linked role to grant Amazon * Inspector access to AWS Services needed to perform security assessments. *

* * @param createAssessmentTemplateRequest * @return Result of the CreateAssessmentTemplate operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws LimitExceededException * The request was rejected because it attempted to create resources beyond the current AWS account limits. * The error code describes the limit exceeded. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.CreateAssessmentTemplate * @see AWS API Documentation */ @Override public CreateAssessmentTemplateResponse createAssessmentTemplate( CreateAssessmentTemplateRequest createAssessmentTemplateRequest) throws InternalException, InvalidInputException, LimitExceededException, AccessDeniedException, NoSuchEntityException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateAssessmentTemplateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createAssessmentTemplateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateAssessmentTemplate"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateAssessmentTemplate").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createAssessmentTemplateRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateAssessmentTemplateRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Starts the generation of an exclusions preview for the specified assessment template. The exclusions preview * lists the potential exclusions (ExclusionPreview) that Inspector can detect before it runs the assessment. *

* * @param createExclusionsPreviewRequest * @return Result of the CreateExclusionsPreview operation returned by the service. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws PreviewGenerationInProgressException * The request is rejected. The specified assessment template is currently generating an exclusions preview. * @throws InternalException * Internal server error. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.CreateExclusionsPreview * @see AWS API Documentation */ @Override public CreateExclusionsPreviewResponse createExclusionsPreview(CreateExclusionsPreviewRequest createExclusionsPreviewRequest) throws InvalidInputException, PreviewGenerationInProgressException, InternalException, AccessDeniedException, NoSuchEntityException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateExclusionsPreviewResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createExclusionsPreviewRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateExclusionsPreview"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateExclusionsPreview").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createExclusionsPreviewRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateExclusionsPreviewRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a resource group using the specified set of tags (key and value pairs) that are used to select the EC2 * instances to be included in an Amazon Inspector assessment target. The created resource group is then used to * create an Amazon Inspector assessment target. For more information, see CreateAssessmentTarget. *

* * @param createResourceGroupRequest * @return Result of the CreateResourceGroup operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws LimitExceededException * The request was rejected because it attempted to create resources beyond the current AWS account limits. * The error code describes the limit exceeded. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.CreateResourceGroup * @see AWS * API Documentation */ @Override public CreateResourceGroupResponse createResourceGroup(CreateResourceGroupRequest createResourceGroupRequest) throws InternalException, InvalidInputException, LimitExceededException, AccessDeniedException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateResourceGroupResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, createResourceGroupRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateResourceGroup"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateResourceGroup").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(createResourceGroupRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateResourceGroupRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes the assessment run that is specified by the ARN of the assessment run. *

* * @param deleteAssessmentRunRequest * @return Result of the DeleteAssessmentRun operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AssessmentRunInProgressException * You cannot perform a specified action if an assessment run is currently in progress. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.DeleteAssessmentRun * @see AWS * API Documentation */ @Override public DeleteAssessmentRunResponse deleteAssessmentRun(DeleteAssessmentRunRequest deleteAssessmentRunRequest) throws InternalException, InvalidInputException, AssessmentRunInProgressException, AccessDeniedException, NoSuchEntityException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteAssessmentRunResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAssessmentRunRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAssessmentRun"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteAssessmentRun").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteAssessmentRunRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteAssessmentRunRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes the assessment target that is specified by the ARN of the assessment target. *

* * @param deleteAssessmentTargetRequest * @return Result of the DeleteAssessmentTarget operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AssessmentRunInProgressException * You cannot perform a specified action if an assessment run is currently in progress. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.DeleteAssessmentTarget * @see AWS API Documentation */ @Override public DeleteAssessmentTargetResponse deleteAssessmentTarget(DeleteAssessmentTargetRequest deleteAssessmentTargetRequest) throws InternalException, InvalidInputException, AssessmentRunInProgressException, AccessDeniedException, NoSuchEntityException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteAssessmentTargetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAssessmentTargetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAssessmentTarget"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteAssessmentTarget").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteAssessmentTargetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteAssessmentTargetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes the assessment template that is specified by the ARN of the assessment template. *

* * @param deleteAssessmentTemplateRequest * @return Result of the DeleteAssessmentTemplate operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AssessmentRunInProgressException * You cannot perform a specified action if an assessment run is currently in progress. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.DeleteAssessmentTemplate * @see AWS API Documentation */ @Override public DeleteAssessmentTemplateResponse deleteAssessmentTemplate( DeleteAssessmentTemplateRequest deleteAssessmentTemplateRequest) throws InternalException, InvalidInputException, AssessmentRunInProgressException, AccessDeniedException, NoSuchEntityException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteAssessmentTemplateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAssessmentTemplateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAssessmentTemplate"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteAssessmentTemplate").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(deleteAssessmentTemplateRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteAssessmentTemplateRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes the assessment runs that are specified by the ARNs of the assessment runs. *

* * @param describeAssessmentRunsRequest * @return Result of the DescribeAssessmentRuns operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.DescribeAssessmentRuns * @see AWS API Documentation */ @Override public DescribeAssessmentRunsResponse describeAssessmentRuns(DescribeAssessmentRunsRequest describeAssessmentRunsRequest) throws InternalException, InvalidInputException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeAssessmentRunsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAssessmentRunsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAssessmentRuns"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeAssessmentRuns").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeAssessmentRunsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeAssessmentRunsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes the assessment targets that are specified by the ARNs of the assessment targets. *

* * @param describeAssessmentTargetsRequest * @return Result of the DescribeAssessmentTargets operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.DescribeAssessmentTargets * @see AWS API Documentation */ @Override public DescribeAssessmentTargetsResponse describeAssessmentTargets( DescribeAssessmentTargetsRequest describeAssessmentTargetsRequest) throws InternalException, InvalidInputException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeAssessmentTargetsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAssessmentTargetsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAssessmentTargets"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeAssessmentTargets").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeAssessmentTargetsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeAssessmentTargetsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes the assessment templates that are specified by the ARNs of the assessment templates. *

* * @param describeAssessmentTemplatesRequest * @return Result of the DescribeAssessmentTemplates operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.DescribeAssessmentTemplates * @see AWS API Documentation */ @Override public DescribeAssessmentTemplatesResponse describeAssessmentTemplates( DescribeAssessmentTemplatesRequest describeAssessmentTemplatesRequest) throws InternalException, InvalidInputException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeAssessmentTemplatesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAssessmentTemplatesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAssessmentTemplates"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeAssessmentTemplates").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeAssessmentTemplatesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeAssessmentTemplatesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes the IAM role that enables Amazon Inspector to access your AWS account. *

* * @param describeCrossAccountAccessRoleRequest * @return Result of the DescribeCrossAccountAccessRole operation returned by the service. * @throws InternalException * Internal server error. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.DescribeCrossAccountAccessRole * @see AWS API Documentation */ @Override public DescribeCrossAccountAccessRoleResponse describeCrossAccountAccessRole( DescribeCrossAccountAccessRoleRequest describeCrossAccountAccessRoleRequest) throws InternalException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeCrossAccountAccessRoleResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeCrossAccountAccessRoleRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeCrossAccountAccessRole"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeCrossAccountAccessRole").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeCrossAccountAccessRoleRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeCrossAccountAccessRoleRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes the exclusions that are specified by the exclusions' ARNs. *

* * @param describeExclusionsRequest * @return Result of the DescribeExclusions operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.DescribeExclusions * @see AWS * API Documentation */ @Override public DescribeExclusionsResponse describeExclusions(DescribeExclusionsRequest describeExclusionsRequest) throws InternalException, InvalidInputException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeExclusionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeExclusionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeExclusions"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeExclusions").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeExclusionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeExclusionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes the findings that are specified by the ARNs of the findings. *

* * @param describeFindingsRequest * @return Result of the DescribeFindings operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.DescribeFindings * @see AWS * API Documentation */ @Override public DescribeFindingsResponse describeFindings(DescribeFindingsRequest describeFindingsRequest) throws InternalException, InvalidInputException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DescribeFindingsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeFindingsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeFindings"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeFindings").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeFindingsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeFindingsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes the resource groups that are specified by the ARNs of the resource groups. *

* * @param describeResourceGroupsRequest * @return Result of the DescribeResourceGroups operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.DescribeResourceGroups * @see AWS API Documentation */ @Override public DescribeResourceGroupsResponse describeResourceGroups(DescribeResourceGroupsRequest describeResourceGroupsRequest) throws InternalException, InvalidInputException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeResourceGroupsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeResourceGroupsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeResourceGroups"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeResourceGroups").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeResourceGroupsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeResourceGroupsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes the rules packages that are specified by the ARNs of the rules packages. *

* * @param describeRulesPackagesRequest * @return Result of the DescribeRulesPackages operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.DescribeRulesPackages * @see AWS API Documentation */ @Override public DescribeRulesPackagesResponse describeRulesPackages(DescribeRulesPackagesRequest describeRulesPackagesRequest) throws InternalException, InvalidInputException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeRulesPackagesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeRulesPackagesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeRulesPackages"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeRulesPackages").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(describeRulesPackagesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeRulesPackagesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Produces an assessment report that includes detailed and comprehensive results of a specified assessment run. *

* * @param getAssessmentReportRequest * @return Result of the GetAssessmentReport operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws AssessmentRunInProgressException * You cannot perform a specified action if an assessment run is currently in progress. * @throws UnsupportedFeatureException * Used by the GetAssessmentReport API. The request was rejected because you tried to generate a * report for an assessment run that existed before reporting was supported in Amazon Inspector. You can * only generate reports for assessment runs that took place or will take place after generating reports in * Amazon Inspector became available. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.GetAssessmentReport * @see AWS * API Documentation */ @Override public GetAssessmentReportResponse getAssessmentReport(GetAssessmentReportRequest getAssessmentReportRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AssessmentRunInProgressException, UnsupportedFeatureException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetAssessmentReportResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getAssessmentReportRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAssessmentReport"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetAssessmentReport").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getAssessmentReportRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetAssessmentReportRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Retrieves the exclusions preview (a list of ExclusionPreview objects) specified by the preview token. You can * obtain the preview token by running the CreateExclusionsPreview API. *

* * @param getExclusionsPreviewRequest * @return Result of the GetExclusionsPreview operation returned by the service. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws InternalException * Internal server error. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.GetExclusionsPreview * @see AWS API Documentation */ @Override public GetExclusionsPreviewResponse getExclusionsPreview(GetExclusionsPreviewRequest getExclusionsPreviewRequest) throws InvalidInputException, InternalException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetExclusionsPreviewResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getExclusionsPreviewRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetExclusionsPreview"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetExclusionsPreview").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getExclusionsPreviewRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetExclusionsPreviewRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Retrieves the exclusions preview (a list of ExclusionPreview objects) specified by the preview token. You can * obtain the preview token by running the CreateExclusionsPreview API. *

*
*

* This is a variant of * {@link #getExclusionsPreview(software.amazon.awssdk.services.inspector.model.GetExclusionsPreviewRequest)} * 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.inspector.paginators.GetExclusionsPreviewIterable responses = client.getExclusionsPreviewPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.inspector.paginators.GetExclusionsPreviewIterable responses = client
     *             .getExclusionsPreviewPaginator(request);
     *     for (software.amazon.awssdk.services.inspector.model.GetExclusionsPreviewResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.inspector.paginators.GetExclusionsPreviewIterable responses = client.getExclusionsPreviewPaginator(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 #getExclusionsPreview(software.amazon.awssdk.services.inspector.model.GetExclusionsPreviewRequest)} * operation. *

* * @param getExclusionsPreviewRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws InternalException * Internal server error. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.GetExclusionsPreview * @see AWS API Documentation */ @Override public GetExclusionsPreviewIterable getExclusionsPreviewPaginator(GetExclusionsPreviewRequest getExclusionsPreviewRequest) throws InvalidInputException, InternalException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { return new GetExclusionsPreviewIterable(this, applyPaginatorUserAgent(getExclusionsPreviewRequest)); } /** *

* Information about the data that is collected for the specified assessment run. *

* * @param getTelemetryMetadataRequest * @return Result of the GetTelemetryMetadata operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.GetTelemetryMetadata * @see AWS API Documentation */ @Override public GetTelemetryMetadataResponse getTelemetryMetadata(GetTelemetryMetadataRequest getTelemetryMetadataRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetTelemetryMetadataResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, getTelemetryMetadataRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetTelemetryMetadata"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetTelemetryMetadata").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(getTelemetryMetadataRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetTelemetryMetadataRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the agents of the assessment runs that are specified by the ARNs of the assessment runs. *

* * @param listAssessmentRunAgentsRequest * @return Result of the ListAssessmentRunAgents operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListAssessmentRunAgents * @see AWS API Documentation */ @Override public ListAssessmentRunAgentsResponse listAssessmentRunAgents(ListAssessmentRunAgentsRequest listAssessmentRunAgentsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListAssessmentRunAgentsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listAssessmentRunAgentsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListAssessmentRunAgents"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListAssessmentRunAgents").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listAssessmentRunAgentsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListAssessmentRunAgentsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the agents of the assessment runs that are specified by the ARNs of the assessment runs. *

*
*

* This is a variant of * {@link #listAssessmentRunAgents(software.amazon.awssdk.services.inspector.model.ListAssessmentRunAgentsRequest)} * 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.inspector.paginators.ListAssessmentRunAgentsIterable responses = client.listAssessmentRunAgentsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.inspector.paginators.ListAssessmentRunAgentsIterable responses = client
     *             .listAssessmentRunAgentsPaginator(request);
     *     for (software.amazon.awssdk.services.inspector.model.ListAssessmentRunAgentsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.inspector.paginators.ListAssessmentRunAgentsIterable responses = client.listAssessmentRunAgentsPaginator(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 #listAssessmentRunAgents(software.amazon.awssdk.services.inspector.model.ListAssessmentRunAgentsRequest)} * operation. *

* * @param listAssessmentRunAgentsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListAssessmentRunAgents * @see AWS API Documentation */ @Override public ListAssessmentRunAgentsIterable listAssessmentRunAgentsPaginator( ListAssessmentRunAgentsRequest listAssessmentRunAgentsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { return new ListAssessmentRunAgentsIterable(this, applyPaginatorUserAgent(listAssessmentRunAgentsRequest)); } /** *

* Lists the assessment runs that correspond to the assessment templates that are specified by the ARNs of the * assessment templates. *

* * @param listAssessmentRunsRequest * @return Result of the ListAssessmentRuns operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListAssessmentRuns * @see AWS * API Documentation */ @Override public ListAssessmentRunsResponse listAssessmentRuns(ListAssessmentRunsRequest listAssessmentRunsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListAssessmentRunsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listAssessmentRunsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListAssessmentRuns"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListAssessmentRuns").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listAssessmentRunsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListAssessmentRunsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the assessment runs that correspond to the assessment templates that are specified by the ARNs of the * assessment templates. *

*
*

* This is a variant of * {@link #listAssessmentRuns(software.amazon.awssdk.services.inspector.model.ListAssessmentRunsRequest)} 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.inspector.paginators.ListAssessmentRunsIterable responses = client.listAssessmentRunsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.inspector.paginators.ListAssessmentRunsIterable responses = client
     *             .listAssessmentRunsPaginator(request);
     *     for (software.amazon.awssdk.services.inspector.model.ListAssessmentRunsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.inspector.paginators.ListAssessmentRunsIterable responses = client.listAssessmentRunsPaginator(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 #listAssessmentRuns(software.amazon.awssdk.services.inspector.model.ListAssessmentRunsRequest)} * operation. *

* * @param listAssessmentRunsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListAssessmentRuns * @see AWS * API Documentation */ @Override public ListAssessmentRunsIterable listAssessmentRunsPaginator(ListAssessmentRunsRequest listAssessmentRunsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { return new ListAssessmentRunsIterable(this, applyPaginatorUserAgent(listAssessmentRunsRequest)); } /** *

* Lists the ARNs of the assessment targets within this AWS account. For more information about assessment targets, * see Amazon Inspector * Assessment Targets. *

* * @param listAssessmentTargetsRequest * @return Result of the ListAssessmentTargets operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListAssessmentTargets * @see AWS API Documentation */ @Override public ListAssessmentTargetsResponse listAssessmentTargets(ListAssessmentTargetsRequest listAssessmentTargetsRequest) throws InternalException, InvalidInputException, AccessDeniedException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListAssessmentTargetsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listAssessmentTargetsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListAssessmentTargets"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListAssessmentTargets").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listAssessmentTargetsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListAssessmentTargetsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the ARNs of the assessment targets within this AWS account. For more information about assessment targets, * see Amazon Inspector * Assessment Targets. *

*
*

* This is a variant of * {@link #listAssessmentTargets(software.amazon.awssdk.services.inspector.model.ListAssessmentTargetsRequest)} * 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.inspector.paginators.ListAssessmentTargetsIterable responses = client.listAssessmentTargetsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.inspector.paginators.ListAssessmentTargetsIterable responses = client
     *             .listAssessmentTargetsPaginator(request);
     *     for (software.amazon.awssdk.services.inspector.model.ListAssessmentTargetsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.inspector.paginators.ListAssessmentTargetsIterable responses = client.listAssessmentTargetsPaginator(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 #listAssessmentTargets(software.amazon.awssdk.services.inspector.model.ListAssessmentTargetsRequest)} * operation. *

* * @param listAssessmentTargetsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListAssessmentTargets * @see AWS API Documentation */ @Override public ListAssessmentTargetsIterable listAssessmentTargetsPaginator(ListAssessmentTargetsRequest listAssessmentTargetsRequest) throws InternalException, InvalidInputException, AccessDeniedException, AwsServiceException, SdkClientException, InspectorException { return new ListAssessmentTargetsIterable(this, applyPaginatorUserAgent(listAssessmentTargetsRequest)); } /** *

* Lists the assessment templates that correspond to the assessment targets that are specified by the ARNs of the * assessment targets. *

* * @param listAssessmentTemplatesRequest * @return Result of the ListAssessmentTemplates operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListAssessmentTemplates * @see AWS API Documentation */ @Override public ListAssessmentTemplatesResponse listAssessmentTemplates(ListAssessmentTemplatesRequest listAssessmentTemplatesRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListAssessmentTemplatesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listAssessmentTemplatesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListAssessmentTemplates"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListAssessmentTemplates").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listAssessmentTemplatesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListAssessmentTemplatesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the assessment templates that correspond to the assessment targets that are specified by the ARNs of the * assessment targets. *

*
*

* This is a variant of * {@link #listAssessmentTemplates(software.amazon.awssdk.services.inspector.model.ListAssessmentTemplatesRequest)} * 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.inspector.paginators.ListAssessmentTemplatesIterable responses = client.listAssessmentTemplatesPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.inspector.paginators.ListAssessmentTemplatesIterable responses = client
     *             .listAssessmentTemplatesPaginator(request);
     *     for (software.amazon.awssdk.services.inspector.model.ListAssessmentTemplatesResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.inspector.paginators.ListAssessmentTemplatesIterable responses = client.listAssessmentTemplatesPaginator(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 #listAssessmentTemplates(software.amazon.awssdk.services.inspector.model.ListAssessmentTemplatesRequest)} * operation. *

* * @param listAssessmentTemplatesRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListAssessmentTemplates * @see AWS API Documentation */ @Override public ListAssessmentTemplatesIterable listAssessmentTemplatesPaginator( ListAssessmentTemplatesRequest listAssessmentTemplatesRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { return new ListAssessmentTemplatesIterable(this, applyPaginatorUserAgent(listAssessmentTemplatesRequest)); } /** *

* Lists all the event subscriptions for the assessment template that is specified by the ARN of the assessment * template. For more information, see SubscribeToEvent and UnsubscribeFromEvent. *

* * @param listEventSubscriptionsRequest * @return Result of the ListEventSubscriptions operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListEventSubscriptions * @see AWS API Documentation */ @Override public ListEventSubscriptionsResponse listEventSubscriptions(ListEventSubscriptionsRequest listEventSubscriptionsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListEventSubscriptionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listEventSubscriptionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListEventSubscriptions"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListEventSubscriptions").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listEventSubscriptionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListEventSubscriptionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists all the event subscriptions for the assessment template that is specified by the ARN of the assessment * template. For more information, see SubscribeToEvent and UnsubscribeFromEvent. *

*
*

* This is a variant of * {@link #listEventSubscriptions(software.amazon.awssdk.services.inspector.model.ListEventSubscriptionsRequest)} * 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.inspector.paginators.ListEventSubscriptionsIterable responses = client.listEventSubscriptionsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.inspector.paginators.ListEventSubscriptionsIterable responses = client
     *             .listEventSubscriptionsPaginator(request);
     *     for (software.amazon.awssdk.services.inspector.model.ListEventSubscriptionsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.inspector.paginators.ListEventSubscriptionsIterable responses = client.listEventSubscriptionsPaginator(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 #listEventSubscriptions(software.amazon.awssdk.services.inspector.model.ListEventSubscriptionsRequest)} * operation. *

* * @param listEventSubscriptionsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListEventSubscriptions * @see AWS API Documentation */ @Override public ListEventSubscriptionsIterable listEventSubscriptionsPaginator( ListEventSubscriptionsRequest listEventSubscriptionsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { return new ListEventSubscriptionsIterable(this, applyPaginatorUserAgent(listEventSubscriptionsRequest)); } /** *

* List exclusions that are generated by the assessment run. *

* * @param listExclusionsRequest * @return Result of the ListExclusions operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListExclusions * @see AWS API * Documentation */ @Override public ListExclusionsResponse listExclusions(ListExclusionsRequest listExclusionsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListExclusionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listExclusionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListExclusions"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListExclusions").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listExclusionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListExclusionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* List exclusions that are generated by the assessment run. *

*
*

* This is a variant of * {@link #listExclusions(software.amazon.awssdk.services.inspector.model.ListExclusionsRequest)} 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.inspector.paginators.ListExclusionsIterable responses = client.listExclusionsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.inspector.paginators.ListExclusionsIterable responses = client
     *             .listExclusionsPaginator(request);
     *     for (software.amazon.awssdk.services.inspector.model.ListExclusionsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.inspector.paginators.ListExclusionsIterable responses = client.listExclusionsPaginator(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 #listExclusions(software.amazon.awssdk.services.inspector.model.ListExclusionsRequest)} operation. *

* * @param listExclusionsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListExclusions * @see AWS API * Documentation */ @Override public ListExclusionsIterable listExclusionsPaginator(ListExclusionsRequest listExclusionsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { return new ListExclusionsIterable(this, applyPaginatorUserAgent(listExclusionsRequest)); } /** *

* Lists findings that are generated by the assessment runs that are specified by the ARNs of the assessment runs. *

* * @param listFindingsRequest * @return Result of the ListFindings operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListFindings * @see AWS API * Documentation */ @Override public ListFindingsResponse listFindings(ListFindingsRequest listFindingsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { 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, "Inspector"); 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 findings that are generated by the assessment runs that are specified by the ARNs of the assessment runs. *

*
*

* This is a variant of {@link #listFindings(software.amazon.awssdk.services.inspector.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.inspector.paginators.ListFindingsIterable responses = client.listFindingsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.inspector.paginators.ListFindingsIterable responses = client.listFindingsPaginator(request);
     *     for (software.amazon.awssdk.services.inspector.model.ListFindingsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.inspector.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.inspector.model.ListFindingsRequest)} operation. *

* * @param listFindingsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListFindings * @see AWS API * Documentation */ @Override public ListFindingsIterable listFindingsPaginator(ListFindingsRequest listFindingsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { return new ListFindingsIterable(this, applyPaginatorUserAgent(listFindingsRequest)); } /** *

* Lists all available Amazon Inspector rules packages. *

* * @param listRulesPackagesRequest * @return Result of the ListRulesPackages operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListRulesPackages * @see AWS * API Documentation */ @Override public ListRulesPackagesResponse listRulesPackages(ListRulesPackagesRequest listRulesPackagesRequest) throws InternalException, InvalidInputException, AccessDeniedException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListRulesPackagesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, listRulesPackagesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListRulesPackages"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListRulesPackages").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(listRulesPackagesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListRulesPackagesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists all available Amazon Inspector rules packages. *

*
*

* This is a variant of * {@link #listRulesPackages(software.amazon.awssdk.services.inspector.model.ListRulesPackagesRequest)} 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.inspector.paginators.ListRulesPackagesIterable responses = client.listRulesPackagesPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.inspector.paginators.ListRulesPackagesIterable responses = client
     *             .listRulesPackagesPaginator(request);
     *     for (software.amazon.awssdk.services.inspector.model.ListRulesPackagesResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.inspector.paginators.ListRulesPackagesIterable responses = client.listRulesPackagesPaginator(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 #listRulesPackages(software.amazon.awssdk.services.inspector.model.ListRulesPackagesRequest)} * operation. *

* * @param listRulesPackagesRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListRulesPackages * @see AWS * API Documentation */ @Override public ListRulesPackagesIterable listRulesPackagesPaginator(ListRulesPackagesRequest listRulesPackagesRequest) throws InternalException, InvalidInputException, AccessDeniedException, AwsServiceException, SdkClientException, InspectorException { return new ListRulesPackagesIterable(this, applyPaginatorUserAgent(listRulesPackagesRequest)); } /** *

* Lists all tags associated with an assessment template. *

* * @param listTagsForResourceRequest * @return Result of the ListTagsForResource operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.ListTagsForResource * @see AWS * API Documentation */ @Override public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, AwsServiceException, SdkClientException, InspectorException { 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, "Inspector"); 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())); } } /** *

* Previews the agents installed on the EC2 instances that are part of the specified assessment target. *

* * @param previewAgentsRequest * @return Result of the PreviewAgents operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws InvalidCrossAccountRoleException * Amazon Inspector cannot assume the cross-account role that it needs to list your EC2 instances during the * assessment run. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.PreviewAgents * @see AWS API * Documentation */ @Override public PreviewAgentsResponse previewAgents(PreviewAgentsRequest previewAgentsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, InvalidCrossAccountRoleException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, PreviewAgentsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, previewAgentsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PreviewAgents"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("PreviewAgents").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(previewAgentsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new PreviewAgentsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Previews the agents installed on the EC2 instances that are part of the specified assessment target. *

*
*

* This is a variant of {@link #previewAgents(software.amazon.awssdk.services.inspector.model.PreviewAgentsRequest)} * 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.inspector.paginators.PreviewAgentsIterable responses = client.previewAgentsPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.inspector.paginators.PreviewAgentsIterable responses = client.previewAgentsPaginator(request);
     *     for (software.amazon.awssdk.services.inspector.model.PreviewAgentsResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.inspector.paginators.PreviewAgentsIterable responses = client.previewAgentsPaginator(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 #previewAgents(software.amazon.awssdk.services.inspector.model.PreviewAgentsRequest)} operation. *

* * @param previewAgentsRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws InvalidCrossAccountRoleException * Amazon Inspector cannot assume the cross-account role that it needs to list your EC2 instances during the * assessment run. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.PreviewAgents * @see AWS API * Documentation */ @Override public PreviewAgentsIterable previewAgentsPaginator(PreviewAgentsRequest previewAgentsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, InvalidCrossAccountRoleException, AwsServiceException, SdkClientException, InspectorException { return new PreviewAgentsIterable(this, applyPaginatorUserAgent(previewAgentsRequest)); } /** *

* Registers the IAM role that grants Amazon Inspector access to AWS Services needed to perform security * assessments. *

* * @param registerCrossAccountAccessRoleRequest * @return Result of the RegisterCrossAccountAccessRole operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws InvalidCrossAccountRoleException * Amazon Inspector cannot assume the cross-account role that it needs to list your EC2 instances during the * assessment run. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.RegisterCrossAccountAccessRole * @see AWS API Documentation */ @Override public RegisterCrossAccountAccessRoleResponse registerCrossAccountAccessRole( RegisterCrossAccountAccessRoleRequest registerCrossAccountAccessRoleRequest) throws InternalException, InvalidInputException, AccessDeniedException, InvalidCrossAccountRoleException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RegisterCrossAccountAccessRoleResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, registerCrossAccountAccessRoleRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RegisterCrossAccountAccessRole"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("RegisterCrossAccountAccessRole").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(registerCrossAccountAccessRoleRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new RegisterCrossAccountAccessRoleRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes entire attributes (key and value pairs) from the findings that are specified by the ARNs of the findings * where an attribute with the specified key exists. *

* * @param removeAttributesFromFindingsRequest * @return Result of the RemoveAttributesFromFindings operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.RemoveAttributesFromFindings * @see AWS API Documentation */ @Override public RemoveAttributesFromFindingsResponse removeAttributesFromFindings( RemoveAttributesFromFindingsRequest removeAttributesFromFindingsRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RemoveAttributesFromFindingsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, removeAttributesFromFindingsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RemoveAttributesFromFindings"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("RemoveAttributesFromFindings").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(removeAttributesFromFindingsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new RemoveAttributesFromFindingsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Sets tags (key and value pairs) to the assessment template that is specified by the ARN of the assessment * template. *

* * @param setTagsForResourceRequest * @return Result of the SetTagsForResource operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.SetTagsForResource * @see AWS * API Documentation */ @Override public SetTagsForResourceResponse setTagsForResource(SetTagsForResourceRequest setTagsForResourceRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, SetTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, setTagsForResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SetTagsForResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("SetTagsForResource").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(setTagsForResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new SetTagsForResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Starts the assessment run specified by the ARN of the assessment template. For this API to function properly, you * must not exceed the limit of running up to 500 concurrent agents per AWS account. *

* * @param startAssessmentRunRequest * @return Result of the StartAssessmentRun operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws LimitExceededException * The request was rejected because it attempted to create resources beyond the current AWS account limits. * The error code describes the limit exceeded. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws InvalidCrossAccountRoleException * Amazon Inspector cannot assume the cross-account role that it needs to list your EC2 instances during the * assessment run. * @throws AgentsAlreadyRunningAssessmentException * You started an assessment run, but one of the instances is already participating in another assessment * run. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.StartAssessmentRun * @see AWS * API Documentation */ @Override public StartAssessmentRunResponse startAssessmentRun(StartAssessmentRunRequest startAssessmentRunRequest) throws InternalException, InvalidInputException, LimitExceededException, AccessDeniedException, NoSuchEntityException, InvalidCrossAccountRoleException, AgentsAlreadyRunningAssessmentException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StartAssessmentRunResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, startAssessmentRunRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartAssessmentRun"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("StartAssessmentRun").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(startAssessmentRunRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new StartAssessmentRunRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Stops the assessment run that is specified by the ARN of the assessment run. *

* * @param stopAssessmentRunRequest * @return Result of the StopAssessmentRun operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.StopAssessmentRun * @see AWS * API Documentation */ @Override public StopAssessmentRunResponse stopAssessmentRun(StopAssessmentRunRequest stopAssessmentRunRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, StopAssessmentRunResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, stopAssessmentRunRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StopAssessmentRun"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("StopAssessmentRun").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(stopAssessmentRunRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new StopAssessmentRunRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Enables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to * a specified SNS topic. *

* * @param subscribeToEventRequest * @return Result of the SubscribeToEvent operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws LimitExceededException * The request was rejected because it attempted to create resources beyond the current AWS account limits. * The error code describes the limit exceeded. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.SubscribeToEvent * @see AWS * API Documentation */ @Override public SubscribeToEventResponse subscribeToEvent(SubscribeToEventRequest subscribeToEventRequest) throws InternalException, InvalidInputException, LimitExceededException, AccessDeniedException, NoSuchEntityException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, SubscribeToEventResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, subscribeToEventRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SubscribeToEvent"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("SubscribeToEvent").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(subscribeToEventRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new SubscribeToEventRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Disables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to * a specified SNS topic. *

* * @param unsubscribeFromEventRequest * @return Result of the UnsubscribeFromEvent operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.UnsubscribeFromEvent * @see AWS API Documentation */ @Override public UnsubscribeFromEventResponse unsubscribeFromEvent(UnsubscribeFromEventRequest unsubscribeFromEventRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UnsubscribeFromEventResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, unsubscribeFromEventRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UnsubscribeFromEvent"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UnsubscribeFromEvent").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(unsubscribeFromEventRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UnsubscribeFromEventRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the assessment target that is specified by the ARN of the assessment target. *

*

* If resourceGroupArn is not specified, all EC2 instances in the current AWS account and region are included in the * assessment target. *

* * @param updateAssessmentTargetRequest * @return Result of the UpdateAssessmentTarget operation returned by the service. * @throws InternalException * Internal server error. * @throws InvalidInputException * The request was rejected because an invalid or out-of-range value was supplied for an input parameter. * @throws AccessDeniedException * You do not have required permissions to access the requested resource. * @throws NoSuchEntityException * The request was rejected because it referenced an entity that does not exist. The error code describes * the entity. * @throws ServiceTemporarilyUnavailableException * The serice is temporary unavailable. * @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 InspectorException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample InspectorClient.UpdateAssessmentTarget * @see AWS API Documentation */ @Override public UpdateAssessmentTargetResponse updateAssessmentTarget(UpdateAssessmentTargetRequest updateAssessmentTargetRequest) throws InternalException, InvalidInputException, AccessDeniedException, NoSuchEntityException, ServiceTemporarilyUnavailableException, AwsServiceException, SdkClientException, InspectorException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateAssessmentTargetResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateAssessmentTargetRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Inspector"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateAssessmentTarget"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateAssessmentTarget").withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withInput(updateAssessmentTargetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateAssessmentTargetRequestMarshaller(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(InspectorException::builder) .protocol(AwsJsonProtocol.AWS_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("AssessmentRunInProgressException") .exceptionBuilderSupplier(AssessmentRunInProgressException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("UnsupportedFeatureException") .exceptionBuilderSupplier(UnsupportedFeatureException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("LimitExceededException") .exceptionBuilderSupplier(LimitExceededException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ServiceTemporarilyUnavailableException") .exceptionBuilderSupplier(ServiceTemporarilyUnavailableException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("AccessDeniedException") .exceptionBuilderSupplier(AccessDeniedException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidInputException") .exceptionBuilderSupplier(InvalidInputException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("NoSuchEntityException") .exceptionBuilderSupplier(NoSuchEntityException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("AgentsAlreadyRunningAssessmentException") .exceptionBuilderSupplier(AgentsAlreadyRunningAssessmentException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("PreviewGenerationInProgressException") .exceptionBuilderSupplier(PreviewGenerationInProgressException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidCrossAccountRoleException") .exceptionBuilderSupplier(InvalidCrossAccountRoleException::builder).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalException") .exceptionBuilderSupplier(InternalException::builder).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