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

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

/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.inspector;

import java.util.Collections;
import java.util.List;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
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.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.internal.InspectorServiceClientConfigurationBuilder;
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.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.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 static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
            .serviceProtocol(AwsServiceProtocol.AWS_JSON).build();

    private final SyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

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

    /**
     * 

* 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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(addAttributesToFindingsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createAssessmentTargetRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createAssessmentTemplateRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createExclusionsPreviewRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createResourceGroupRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteAssessmentRunRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteAssessmentTargetRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteAssessmentTemplateRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAssessmentRunsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAssessmentTargetsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAssessmentTemplatesRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeCrossAccountAccessRoleRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeExclusionsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeFindingsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeResourceGroupsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeRulesPackagesRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getAssessmentReportRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getExclusionsPreviewRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getExclusionsPreviewRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetExclusionsPreviewRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* 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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getTelemetryMetadataRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listAssessmentRunAgentsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listAssessmentRunAgentsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListAssessmentRunAgentsRequestMarshaller(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. *

* * @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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listAssessmentRunsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listAssessmentRunsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListAssessmentRunsRequestMarshaller(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. *

* * @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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listAssessmentTargetsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listAssessmentTargetsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListAssessmentTargetsRequestMarshaller(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. *

* * @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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listAssessmentTemplatesRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listAssessmentTemplatesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListAssessmentTemplatesRequestMarshaller(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. *

* * @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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listEventSubscriptionsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listEventSubscriptionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListEventSubscriptionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* 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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listExclusionsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listExclusionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListExclusionsRequestMarshaller(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. *

* * @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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listFindingsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listFindingsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListFindingsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* 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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listRulesPackagesRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listRulesPackagesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListRulesPackagesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* 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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsForResourceRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(previewAgentsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(previewAgentsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new PreviewAgentsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* 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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(registerCrossAccountAccessRoleRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(removeAttributesFromFindingsRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(setTagsForResourceRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startAssessmentRunRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(stopAssessmentRunRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(subscribeToEventRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(unsubscribeFromEventRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).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); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateAssessmentTargetRequest, this.clientConfiguration); 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").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateAssessmentTargetRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateAssessmentTargetRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } @Override public final String serviceName() { return SERVICE_NAME; } 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 SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) { List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList()); SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder(); if (plugins.isEmpty()) { return configuration.build(); } InspectorServiceClientConfigurationBuilder serviceConfigBuilder = new InspectorServiceClientConfigurationBuilder( configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } return configuration.build(); } 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).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("UnsupportedFeatureException") .exceptionBuilderSupplier(UnsupportedFeatureException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("LimitExceededException") .exceptionBuilderSupplier(LimitExceededException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ServiceTemporarilyUnavailableException") .exceptionBuilderSupplier(ServiceTemporarilyUnavailableException::builder).httpStatusCode(400) .build()) .registerModeledException( ExceptionMetadata.builder().errorCode("AccessDeniedException") .exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidInputException") .exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("NoSuchEntityException") .exceptionBuilderSupplier(NoSuchEntityException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("AgentsAlreadyRunningAssessmentException") .exceptionBuilderSupplier(AgentsAlreadyRunningAssessmentException::builder).httpStatusCode(400) .build()) .registerModeledException( ExceptionMetadata.builder().errorCode("PreviewGenerationInProgressException") .exceptionBuilderSupplier(PreviewGenerationInProgressException::builder).httpStatusCode(400) .build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidCrossAccountRoleException") .exceptionBuilderSupplier(InvalidCrossAccountRoleException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalException") .exceptionBuilderSupplier(InternalException::builder).httpStatusCode(500).build()); } @Override public final InspectorServiceClientConfiguration serviceClientConfiguration() { return new InspectorServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy