Inspector / Client / create_assessment_template
create_assessment_template#
- Inspector.Client.create_assessment_template(**kwargs)#
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.
See also: AWS API Documentation
Request Syntax
response = client.create_assessment_template( assessmentTargetArn='string', assessmentTemplateName='string', durationInSeconds=123, rulesPackageArns=[ 'string', ], userAttributesForFindings=[ { 'key': 'string', 'value': 'string' }, ] )
- Parameters:
assessmentTargetArn (string) –
[REQUIRED]
The ARN that specifies the assessment target for which you want to create the assessment template.
assessmentTemplateName (string) –
[REQUIRED]
The user-defined name that identifies the assessment template that you want to create. You can create several assessment templates for an assessment target. The names of the assessment templates that correspond to a particular assessment target must be unique.
durationInSeconds (integer) –
[REQUIRED]
The duration of the assessment run in seconds.
rulesPackageArns (list) –
[REQUIRED]
The ARNs that specify the rules packages that you want to attach to the assessment template.
(string) –
userAttributesForFindings (list) –
The user-defined attributes that are assigned to every finding that is generated by the assessment run that uses this assessment template. An attribute is a key and value pair (an Attribute object). Within an assessment template, each key must be unique.
(dict) –
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
key (string) – [REQUIRED]
The attribute key.
value (string) –
The value assigned to the attribute key.
- Return type:
dict
- Returns:
Response Syntax
{ 'assessmentTemplateArn': 'string' }
Response Structure
(dict) –
assessmentTemplateArn (string) –
The ARN that specifies the assessment template that is created.
Exceptions
Inspector.Client.exceptions.InternalException
Inspector.Client.exceptions.InvalidInputException
Inspector.Client.exceptions.LimitExceededException
Inspector.Client.exceptions.AccessDeniedException
Inspector.Client.exceptions.NoSuchEntityException
Inspector.Client.exceptions.ServiceTemporarilyUnavailableException
Examples
Creates an assessment template for the assessment target that is specified by the ARN of the assessment target.
response = client.create_assessment_template( assessmentTargetArn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX', assessmentTemplateName='ExampleAssessmentTemplate', durationInSeconds=180, rulesPackageArns=[ 'arn:aws:inspector:us-west-2:758058086616:rulespackage/0-11B9DBXp', ], userAttributesForFindings=[ { 'key': 'Example', 'value': 'example', }, ], ) print(response)
Expected Output:
{ 'assessmentTemplateArn': 'arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T', 'ResponseMetadata': { '...': '...', }, }