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.
Parameters:
-
assessment_target_name
(AssessmentTargetName)
–
The user-defined name that identifies the assessment target that you want to create. The name must be unique within the AWS account.
-
resource_group_arn
(Optional[Arn], default:
None
)
–
The ARN that specifies the resource group that is used to create the assessment target. If resourceGroupArn is not specified, all EC2 instances in the current AWS account and region are included in the assessment target.
Raises:
Examples:
Create assessment target
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.
>>> await client.create_assessment_target(assessment_target_name='ExampleAssessmentTarget', resource_group_arn='arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-AB6DMKnv')
Source code in docs_src/capo_inspector/_services/async_inspector.py
| async def create_assessment_target(
self,
assessment_target_name: "capo_inspector.types.assessment_target_name.AssessmentTargetName",
*,
config_overrides: Optional[AsyncInspectorClientConfig] = None,
resource_group_arn: Optional["capo_inspector.types.arn.Arn"] = None,
) -> "capo_inspector.types.create_assessment_target_response.CreateAssessmentTargetResponse":
"""<p>Creates a new assessment target using the ARN of the resource group that is generated by <a>CreateResourceGroup</a>. If resourceGroupArn is not specified, all EC2 instances in the current AWS account and region are included in the assessment target. If the <a href="https://docs.aws.amazon.com/inspector/latest/userguide/inspector_slr.html">service-linked role</a> 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 <a href="https://docs.aws.amazon.com/inspector/latest/userguide/inspector_applications.html"> Amazon Inspector Assessment Targets</a>.</p>
Args:
assessment_target_name: <p>The user-defined name that identifies the assessment target that you want to create. The name must be unique within the AWS account.</p>
resource_group_arn: <p>The ARN that specifies the resource group that is used to create the assessment target. If resourceGroupArn is not specified, all EC2 instances in the current AWS account and region are included in the assessment target.</p>
Raises:
capo_inspector.errors.access_denied_exception.AccessDeniedException: <p>You do not have required permissions to access the requested resource.</p>
capo_inspector.errors.internal_exception.InternalException: <p>Internal server error.</p>
capo_inspector.errors.invalid_cross_account_role_exception.InvalidCrossAccountRoleException: <p>Amazon Inspector cannot assume the cross-account role that it needs to list your EC2 instances during the assessment run.</p>
capo_inspector.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because an invalid or out-of-range value was supplied for an input parameter.</p>
capo_inspector.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because it attempted to create resources beyond the current AWS account limits. The error code describes the limit exceeded.</p>
capo_inspector.errors.no_such_entity_exception.NoSuchEntityException: <p>The request was rejected because it referenced an entity that does not exist. The error code describes the entity.</p>
capo_inspector.errors.service_temporarily_unavailable_exception.ServiceTemporarilyUnavailableException: <p>The serice is temporary unavailable.</p>
capo_inspector.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Create assessment target
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.
>>> await client.create_assessment_target(assessment_target_name='ExampleAssessmentTarget', resource_group_arn='arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-AB6DMKnv')
"""
async def _handler(
req: "AsyncOperationRequest[capo_inspector.types.create_assessment_target_request.CreateAssessmentTargetRequest]",
) -> AsyncOperationResponse[
"capo_inspector.types.create_assessment_target_response.CreateAssessmentTargetResponse"
]:
import capo_inspector._operations.inspector_service.create_assessment_target
(
output,
http_response,
) = await capo_inspector._operations.inspector_service.create_assessment_target.async_create_assessment_target(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateAssessmentTarget")
)
input_: capo_inspector.types.create_assessment_target_request.CreateAssessmentTargetRequest = {
"assessment_target_name": assessment_target_name
}
if resource_group_arn is not None:
input_["resource_group_arn"] = resource_group_arn
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|