
com.amazonaws.services.inspector.AmazonInspectorClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-inspector Show documentation
/*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights
* Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.inspector;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import java.util.Map.Entry;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.services.inspector.model.*;
import com.amazonaws.services.inspector.model.transform.*;
/**
* Client for accessing Amazon Inspector. All service calls made using this
* client are blocking, and will not return until the service call completes.
*
* Amazon Inspector
*
* Amazon Inspector enables you to analyze the behavior of your AWS resources
* and to identify potential security issues. For more information, see Amazon Inspector User Guide.
*
*/
@ThreadSafe
public class AmazonInspectorClient extends AmazonWebServiceClient implements
AmazonInspector {
/** Provider for AWS credentials. */
private AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory.getLog(AmazonInspector.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "inspector";
/** The region metadata service name for computing region endpoints. */
private static final String DEFAULT_ENDPOINT_PREFIX = "inspector";
/**
* Client configuration factory providing ClientConfigurations tailored to
* this client
*/
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
private final SdkJsonProtocolFactory protocolFactory = new SdkJsonProtocolFactory(
new JsonClientMetadata()
.withProtocolVersion("1.1")
.withSupportsCbor(false)
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode("NoSuchEntityException")
.withModeledClass(
com.amazonaws.services.inspector.model.NoSuchEntityException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode("LimitExceededException")
.withModeledClass(
com.amazonaws.services.inspector.model.LimitExceededException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode("InvalidInputException")
.withModeledClass(
com.amazonaws.services.inspector.model.InvalidInputException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode("InternalException")
.withModeledClass(
com.amazonaws.services.inspector.model.InternalException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode("AccessDeniedException")
.withModeledClass(
com.amazonaws.services.inspector.model.AccessDeniedException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode(
"AgentsAlreadyRunningAssessmentException")
.withModeledClass(
com.amazonaws.services.inspector.model.AgentsAlreadyRunningAssessmentException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode(
"AssessmentRunInProgressException")
.withModeledClass(
com.amazonaws.services.inspector.model.AssessmentRunInProgressException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata()
.withErrorCode(
"InvalidCrossAccountRoleException")
.withModeledClass(
com.amazonaws.services.inspector.model.InvalidCrossAccountRoleException.class)));
/**
* Constructs a new client to invoke service methods on Amazon Inspector. A
* credentials provider chain will be used that searches for credentials in
* this order:
*
* - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
* - Java System Properties - aws.accessKeyId and aws.secretKey
* - Instance profile credentials delivered through the Amazon EC2
* metadata service
*
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @see DefaultAWSCredentialsProviderChain
*/
public AmazonInspectorClient() {
this(new DefaultAWSCredentialsProviderChain(), configFactory
.getConfig());
}
/**
* Constructs a new client to invoke service methods on Amazon Inspector. A
* credentials provider chain will be used that searches for credentials in
* this order:
*
* - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
* - Java System Properties - aws.accessKeyId and aws.secretKey
* - Instance profile credentials delivered through the Amazon EC2
* metadata service
*
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param clientConfiguration
* The client configuration options controlling how this client
* connects to Amazon Inspector (ex: proxy settings, retry counts,
* etc.).
*
* @see DefaultAWSCredentialsProviderChain
*/
public AmazonInspectorClient(ClientConfiguration clientConfiguration) {
this(new DefaultAWSCredentialsProviderChain(), clientConfiguration);
}
/**
* Constructs a new client to invoke service methods on Amazon Inspector
* using the specified AWS account credentials.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when
* authenticating with AWS services.
*/
public AmazonInspectorClient(AWSCredentials awsCredentials) {
this(awsCredentials, configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on Amazon Inspector
* using the specified AWS account credentials and client configuration
* options.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when
* authenticating with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client
* connects to Amazon Inspector (ex: proxy settings, retry counts,
* etc.).
*/
public AmazonInspectorClient(AWSCredentials awsCredentials,
ClientConfiguration clientConfiguration) {
super(clientConfiguration);
this.awsCredentialsProvider = new StaticCredentialsProvider(
awsCredentials);
init();
}
/**
* Constructs a new client to invoke service methods on Amazon Inspector
* using the specified AWS account credentials provider.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to
* authenticate requests with AWS services.
*/
public AmazonInspectorClient(AWSCredentialsProvider awsCredentialsProvider) {
this(awsCredentialsProvider, configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on Amazon Inspector
* using the specified AWS account credentials provider and client
* configuration options.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to
* authenticate requests with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client
* connects to Amazon Inspector (ex: proxy settings, retry counts,
* etc.).
*/
public AmazonInspectorClient(AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration) {
this(awsCredentialsProvider, clientConfiguration, null);
}
/**
* Constructs a new client to invoke service methods on Amazon Inspector
* using the specified AWS account credentials provider, client
* configuration options, and request metric collector.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to
* authenticate requests with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client
* connects to Amazon Inspector (ex: proxy settings, retry counts,
* etc.).
* @param requestMetricCollector
* optional request metric collector
*/
public AmazonInspectorClient(AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration,
RequestMetricCollector requestMetricCollector) {
super(clientConfiguration, requestMetricCollector);
this.awsCredentialsProvider = awsCredentialsProvider;
init();
}
private void init() {
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(DEFAULT_ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
setEndpoint("https://inspector.us-east-1.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s
.addAll(chainFactory
.newRequestHandlerChain("/com/amazonaws/services/inspector/request.handlers"));
requestHandler2s
.addAll(chainFactory
.newRequestHandler2Chain("/com/amazonaws/services/inspector/request.handler2s"));
}
/**
*
* 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.
* @sample AmazonInspector.AddAttributesToFindings
*/
@Override
public AddAttributesToFindingsResult addAttributesToFindings(
AddAttributesToFindingsRequest addAttributesToFindingsRequest) {
ExecutionContext executionContext = createExecutionContext(addAttributesToFindingsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new AddAttributesToFindingsRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(addAttributesToFindingsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new AddAttributesToFindingsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a new assessment target using the ARN of the resource group that
* is generated by CreateResourceGroup. 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.
* @sample AmazonInspector.CreateAssessmentTarget
*/
@Override
public CreateAssessmentTargetResult createAssessmentTarget(
CreateAssessmentTargetRequest createAssessmentTargetRequest) {
ExecutionContext executionContext = createExecutionContext(createAssessmentTargetRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateAssessmentTargetRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(createAssessmentTargetRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new CreateAssessmentTargetResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates an assessment template for the assessment target that is
* specified by the ARN of the assessment target.
*
*
* @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.
* @sample AmazonInspector.CreateAssessmentTemplate
*/
@Override
public CreateAssessmentTemplateResult createAssessmentTemplate(
CreateAssessmentTemplateRequest createAssessmentTemplateRequest) {
ExecutionContext executionContext = createExecutionContext(createAssessmentTemplateRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateAssessmentTemplateRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(createAssessmentTemplateRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new CreateAssessmentTemplateResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.CreateResourceGroup
*/
@Override
public CreateResourceGroupResult createResourceGroup(
CreateResourceGroupRequest createResourceGroupRequest) {
ExecutionContext executionContext = createExecutionContext(createResourceGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateResourceGroupRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(createResourceGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new CreateResourceGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.DeleteAssessmentRun
*/
@Override
public DeleteAssessmentRunResult deleteAssessmentRun(
DeleteAssessmentRunRequest deleteAssessmentRunRequest) {
ExecutionContext executionContext = createExecutionContext(deleteAssessmentRunRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteAssessmentRunRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(deleteAssessmentRunRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DeleteAssessmentRunResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.DeleteAssessmentTarget
*/
@Override
public DeleteAssessmentTargetResult deleteAssessmentTarget(
DeleteAssessmentTargetRequest deleteAssessmentTargetRequest) {
ExecutionContext executionContext = createExecutionContext(deleteAssessmentTargetRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteAssessmentTargetRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(deleteAssessmentTargetRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DeleteAssessmentTargetResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.DeleteAssessmentTemplate
*/
@Override
public DeleteAssessmentTemplateResult deleteAssessmentTemplate(
DeleteAssessmentTemplateRequest deleteAssessmentTemplateRequest) {
ExecutionContext executionContext = createExecutionContext(deleteAssessmentTemplateRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteAssessmentTemplateRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(deleteAssessmentTemplateRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DeleteAssessmentTemplateResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.DescribeAssessmentRuns
*/
@Override
public DescribeAssessmentRunsResult describeAssessmentRuns(
DescribeAssessmentRunsRequest describeAssessmentRunsRequest) {
ExecutionContext executionContext = createExecutionContext(describeAssessmentRunsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeAssessmentRunsRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(describeAssessmentRunsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DescribeAssessmentRunsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.DescribeAssessmentTargets
*/
@Override
public DescribeAssessmentTargetsResult describeAssessmentTargets(
DescribeAssessmentTargetsRequest describeAssessmentTargetsRequest) {
ExecutionContext executionContext = createExecutionContext(describeAssessmentTargetsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeAssessmentTargetsRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(describeAssessmentTargetsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DescribeAssessmentTargetsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.DescribeAssessmentTemplates
*/
@Override
public DescribeAssessmentTemplatesResult describeAssessmentTemplates(
DescribeAssessmentTemplatesRequest describeAssessmentTemplatesRequest) {
ExecutionContext executionContext = createExecutionContext(describeAssessmentTemplatesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeAssessmentTemplatesRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(describeAssessmentTemplatesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DescribeAssessmentTemplatesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.DescribeCrossAccountAccessRole
*/
@Override
public DescribeCrossAccountAccessRoleResult describeCrossAccountAccessRole(
DescribeCrossAccountAccessRoleRequest describeCrossAccountAccessRoleRequest) {
ExecutionContext executionContext = createExecutionContext(describeCrossAccountAccessRoleRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeCrossAccountAccessRoleRequestMarshaller(
protocolFactory)
.marshall(super
.beforeMarshalling(describeCrossAccountAccessRoleRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DescribeCrossAccountAccessRoleResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.DescribeFindings
*/
@Override
public DescribeFindingsResult describeFindings(
DescribeFindingsRequest describeFindingsRequest) {
ExecutionContext executionContext = createExecutionContext(describeFindingsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeFindingsRequestMarshaller(protocolFactory)
.marshall(super
.beforeMarshalling(describeFindingsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DescribeFindingsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.DescribeResourceGroups
*/
@Override
public DescribeResourceGroupsResult describeResourceGroups(
DescribeResourceGroupsRequest describeResourceGroupsRequest) {
ExecutionContext executionContext = createExecutionContext(describeResourceGroupsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeResourceGroupsRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(describeResourceGroupsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DescribeResourceGroupsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.DescribeRulesPackages
*/
@Override
public DescribeRulesPackagesResult describeRulesPackages(
DescribeRulesPackagesRequest describeRulesPackagesRequest) {
ExecutionContext executionContext = createExecutionContext(describeRulesPackagesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeRulesPackagesRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(describeRulesPackagesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new DescribeRulesPackagesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.GetTelemetryMetadata
*/
@Override
public GetTelemetryMetadataResult getTelemetryMetadata(
GetTelemetryMetadataRequest getTelemetryMetadataRequest) {
ExecutionContext executionContext = createExecutionContext(getTelemetryMetadataRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetTelemetryMetadataRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(getTelemetryMetadataRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new GetTelemetryMetadataResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.ListAssessmentRunAgents
*/
@Override
public ListAssessmentRunAgentsResult listAssessmentRunAgents(
ListAssessmentRunAgentsRequest listAssessmentRunAgentsRequest) {
ExecutionContext executionContext = createExecutionContext(listAssessmentRunAgentsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListAssessmentRunAgentsRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(listAssessmentRunAgentsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new ListAssessmentRunAgentsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.ListAssessmentRuns
*/
@Override
public ListAssessmentRunsResult listAssessmentRuns(
ListAssessmentRunsRequest listAssessmentRunsRequest) {
ExecutionContext executionContext = createExecutionContext(listAssessmentRunsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListAssessmentRunsRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(listAssessmentRunsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new ListAssessmentRunsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.ListAssessmentTargets
*/
@Override
public ListAssessmentTargetsResult listAssessmentTargets(
ListAssessmentTargetsRequest listAssessmentTargetsRequest) {
ExecutionContext executionContext = createExecutionContext(listAssessmentTargetsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListAssessmentTargetsRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(listAssessmentTargetsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new ListAssessmentTargetsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.ListAssessmentTemplates
*/
@Override
public ListAssessmentTemplatesResult listAssessmentTemplates(
ListAssessmentTemplatesRequest listAssessmentTemplatesRequest) {
ExecutionContext executionContext = createExecutionContext(listAssessmentTemplatesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListAssessmentTemplatesRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(listAssessmentTemplatesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new ListAssessmentTemplatesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.ListEventSubscriptions
*/
@Override
public ListEventSubscriptionsResult listEventSubscriptions(
ListEventSubscriptionsRequest listEventSubscriptionsRequest) {
ExecutionContext executionContext = createExecutionContext(listEventSubscriptionsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListEventSubscriptionsRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(listEventSubscriptionsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new ListEventSubscriptionsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.ListFindings
*/
@Override
public ListFindingsResult listFindings(
ListFindingsRequest listFindingsRequest) {
ExecutionContext executionContext = createExecutionContext(listFindingsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListFindingsRequestMarshaller(protocolFactory)
.marshall(super.beforeMarshalling(listFindingsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new ListFindingsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.ListRulesPackages
*/
@Override
public ListRulesPackagesResult listRulesPackages(
ListRulesPackagesRequest listRulesPackagesRequest) {
ExecutionContext executionContext = createExecutionContext(listRulesPackagesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListRulesPackagesRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(listRulesPackagesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new ListRulesPackagesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.ListTagsForResource
*/
@Override
public ListTagsForResourceResult listTagsForResource(
ListTagsForResourceRequest listTagsForResourceRequest) {
ExecutionContext executionContext = createExecutionContext(listTagsForResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTagsForResourceRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(listTagsForResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new ListTagsForResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.PreviewAgents
*/
@Override
public PreviewAgentsResult previewAgents(
PreviewAgentsRequest previewAgentsRequest) {
ExecutionContext executionContext = createExecutionContext(previewAgentsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new PreviewAgentsRequestMarshaller(protocolFactory)
.marshall(super.beforeMarshalling(previewAgentsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new PreviewAgentsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Registers the IAM role that Amazon Inspector uses to list your EC2
* instances at the start of the assessment run or when you call the
* PreviewAgents action.
*
*
* @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.
* @sample AmazonInspector.RegisterCrossAccountAccessRole
*/
@Override
public RegisterCrossAccountAccessRoleResult registerCrossAccountAccessRole(
RegisterCrossAccountAccessRoleRequest registerCrossAccountAccessRoleRequest) {
ExecutionContext executionContext = createExecutionContext(registerCrossAccountAccessRoleRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new RegisterCrossAccountAccessRoleRequestMarshaller(
protocolFactory)
.marshall(super
.beforeMarshalling(registerCrossAccountAccessRoleRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new RegisterCrossAccountAccessRoleResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.RemoveAttributesFromFindings
*/
@Override
public RemoveAttributesFromFindingsResult removeAttributesFromFindings(
RemoveAttributesFromFindingsRequest removeAttributesFromFindingsRequest) {
ExecutionContext executionContext = createExecutionContext(removeAttributesFromFindingsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new RemoveAttributesFromFindingsRequestMarshaller(
protocolFactory)
.marshall(super
.beforeMarshalling(removeAttributesFromFindingsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new RemoveAttributesFromFindingsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.SetTagsForResource
*/
@Override
public SetTagsForResourceResult setTagsForResource(
SetTagsForResourceRequest setTagsForResourceRequest) {
ExecutionContext executionContext = createExecutionContext(setTagsForResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new SetTagsForResourceRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(setTagsForResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new SetTagsForResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.StartAssessmentRun
*/
@Override
public StartAssessmentRunResult startAssessmentRun(
StartAssessmentRunRequest startAssessmentRunRequest) {
ExecutionContext executionContext = createExecutionContext(startAssessmentRunRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartAssessmentRunRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(startAssessmentRunRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new StartAssessmentRunResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.StopAssessmentRun
*/
@Override
public StopAssessmentRunResult stopAssessmentRun(
StopAssessmentRunRequest stopAssessmentRunRequest) {
ExecutionContext executionContext = createExecutionContext(stopAssessmentRunRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StopAssessmentRunRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(stopAssessmentRunRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new StopAssessmentRunResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.SubscribeToEvent
*/
@Override
public SubscribeToEventResult subscribeToEvent(
SubscribeToEventRequest subscribeToEventRequest) {
ExecutionContext executionContext = createExecutionContext(subscribeToEventRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new SubscribeToEventRequestMarshaller(protocolFactory)
.marshall(super
.beforeMarshalling(subscribeToEventRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new SubscribeToEventResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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.
* @sample AmazonInspector.UnsubscribeFromEvent
*/
@Override
public UnsubscribeFromEventResult unsubscribeFromEvent(
UnsubscribeFromEventRequest unsubscribeFromEventRequest) {
ExecutionContext executionContext = createExecutionContext(unsubscribeFromEventRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UnsubscribeFromEventRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(unsubscribeFromEventRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new UnsubscribeFromEventResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Updates the assessment target that is specified by the ARN of 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.
* @sample AmazonInspector.UpdateAssessmentTarget
*/
@Override
public UpdateAssessmentTargetResult updateAssessmentTarget(
UpdateAssessmentTargetRequest updateAssessmentTargetRequest) {
ExecutionContext executionContext = createExecutionContext(updateAssessmentTargetRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateAssessmentTargetRequestMarshaller(
protocolFactory).marshall(super
.beforeMarshalling(updateAssessmentTargetRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true)
.withHasStreamingSuccessResponse(false),
new UpdateAssessmentTargetResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Returns additional metadata for a previously executed successful,
* request, typically used for debugging issues where a service isn't acting
* as expected. This data isn't considered part of the result data returned
* by an operation, so it's available through this separate, diagnostic
* interface.
*
* Response metadata is only cached for a limited period of time, so if you
* need to access this extra diagnostic information for an executed request,
* you should use this method to retrieve it as soon as possible after
* executing the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none
* is available.
*/
public ResponseMetadata getCachedResponseMetadata(
AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be
* overriden at the request level.
**/
private Response invoke(
Request request,
HttpResponseHandler> responseHandler,
ExecutionContext executionContext) {
executionContext.setCredentialsProvider(CredentialUtils
.getCredentialsProvider(request.getOriginalRequest(),
awsCredentialsProvider));
return doInvoke(request, responseHandler, executionContext);
}
/**
* Invoke with no authentication. Credentials are not required and any
* credentials set on the client or request will be ignored for this
* operation.
**/
private Response anonymousInvoke(
Request request,
HttpResponseHandler> responseHandler,
ExecutionContext executionContext) {
return doInvoke(request, responseHandler, executionContext);
}
/**
* Invoke the request using the http client. Assumes credentials (or lack
* thereof) have been configured in the ExecutionContext beforehand.
**/
private Response doInvoke(
Request request,
HttpResponseHandler> responseHandler,
ExecutionContext executionContext) {
request.setEndpoint(endpoint);
request.setTimeOffset(timeOffset);
HttpResponseHandler errorResponseHandler = protocolFactory
.createErrorResponseHandler(new JsonErrorResponseMetadata());
return client.execute(request, responseHandler, errorResponseHandler,
executionContext);
}
}