Table of Contents
A low-level client representing Amazon Inspector:
import boto3
client = boto3.client('inspector')
These are the available methods:
Assigns attributes (key and value pairs) to the findings that are specified by the ARNs of the findings.
See also: AWS API Documentation
Request Syntax
response = client.add_attributes_to_findings(
findingArns=[
'string',
],
attributes=[
{
'key': 'string',
'value': 'string'
},
]
)
[REQUIRED]
The ARNs that specify the findings that you want to assign attributes to.
[REQUIRED]
The array of attributes that you want to assign to specified findings.
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
The attribute key.
The value assigned to the attribute key.
dict
Response Syntax
{
'failedItems': {
'string': {
'failureCode': 'INVALID_ARN'|'DUPLICATE_ARN'|'ITEM_DOES_NOT_EXIST'|'ACCESS_DENIED'|'LIMIT_EXCEEDED'|'INTERNAL_ERROR',
'retryable': True|False
}
}
}
Response Structure
(dict) --
failedItems (dict) --
Attribute details that cannot be described. An error code is provided for each failed item.
(string) --
(dict) --
Includes details about the failed items.
failureCode (string) --
The status code of a failed item.
retryable (boolean) --
Indicates whether you can immediately retry a request for this item for a specified resource.
Examples
Assigns attributes (key and value pairs) to the findings that are specified by the ARNs of the findings.
response = client.add_attributes_to_findings(
attributes=[
{
'key': 'Example',
'value': 'example',
},
],
findingArns=[
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-8l1VIE0D/run/0-Z02cjjug/finding/0-T8yM9mEU',
],
)
print(response)
Expected Output:
{
'failedItems': {
},
'ResponseMetadata': {
'...': '...',
},
}
Check if an operation can be paginated.
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 .
See also: AWS API Documentation
Request Syntax
response = client.create_assessment_target(
assessmentTargetName='string',
resourceGroupArn='string'
)
[REQUIRED]
The user-defined name that identifies the assessment target that you want to create. The name must be unique within the AWS account.
dict
Response Syntax
{
'assessmentTargetArn': 'string'
}
Response Structure
(dict) --
assessmentTargetArn (string) --
The ARN that specifies the assessment target that is created.
Examples
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.
response = client.create_assessment_target(
assessmentTargetName='ExampleAssessmentTarget',
resourceGroupArn='arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-AB6DMKnv',
)
print(response)
Expected Output:
{
'assessmentTargetArn': 'arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX',
'ResponseMetadata': {
'...': '...',
},
}
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'
},
]
)
[REQUIRED]
The ARN that specifies the assessment target for which you want to create the assessment template.
[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.
[REQUIRED]
The duration of the assessment run in seconds.
[REQUIRED]
The ARNs that specify the rules packages that you want to attach to the assessment template.
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.
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
The attribute key.
The value assigned to the attribute key.
dict
Response Syntax
{
'assessmentTemplateArn': 'string'
}
Response Structure
(dict) --
assessmentTemplateArn (string) --
The ARN that specifies the assessment template that is created.
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': {
'...': '...',
},
}
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.
See also: AWS API Documentation
Request Syntax
response = client.create_exclusions_preview(
assessmentTemplateArn='string'
)
[REQUIRED]
The ARN that specifies the assessment template for which you want to create an exclusions preview.
{
'previewToken': 'string'
}
Response Structure
Specifies the unique identifier of the requested exclusions preview. You can use the unique identifier to retrieve the exclusions preview when running the GetExclusionsPreview API.
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 .
See also: AWS API Documentation
Request Syntax
response = client.create_resource_group(
resourceGroupTags=[
{
'key': 'string',
'value': 'string'
},
]
)
[REQUIRED]
A collection of keys and an array of possible values, '[{"key":"key1","values":["Value1","Value2"]},{"key":"Key2","values":["Value3"]}]'.
For example,'[{"key":"Name","values":["TestEC2Instance"]}]'.
This data type is used as one of the elements of the ResourceGroup data type.
A tag key.
The value assigned to a tag key.
{
'resourceGroupArn': 'string'
}
Response Structure
The ARN that specifies the resource group that is created.
Examples
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.
response = client.create_resource_group(
resourceGroupTags=[
{
'key': 'Name',
'value': 'example',
},
],
)
print(response)
Expected Output:
{
'resourceGroupArn': 'arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-AB6DMKnv',
'ResponseMetadata': {
'...': '...',
},
}
Deletes the assessment run that is specified by the ARN of the assessment run.
See also: AWS API Documentation
Request Syntax
response = client.delete_assessment_run(
assessmentRunArn='string'
)
[REQUIRED]
The ARN that specifies the assessment run that you want to delete.
Examples
Deletes the assessment run that is specified by the ARN of the assessment run.
response = client.delete_assessment_run(
assessmentRunArn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T/run/0-11LMTAVe',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
Deletes the assessment target that is specified by the ARN of the assessment target.
See also: AWS API Documentation
Request Syntax
response = client.delete_assessment_target(
assessmentTargetArn='string'
)
[REQUIRED]
The ARN that specifies the assessment target that you want to delete.
Examples
Deletes the assessment target that is specified by the ARN of the assessment target.
response = client.delete_assessment_target(
assessmentTargetArn='arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
Deletes the assessment template that is specified by the ARN of the assessment template.
See also: AWS API Documentation
Request Syntax
response = client.delete_assessment_template(
assessmentTemplateArn='string'
)
[REQUIRED]
The ARN that specifies the assessment template that you want to delete.
Examples
Deletes the assessment template that is specified by the ARN of the assessment template.
response = client.delete_assessment_template(
assessmentTemplateArn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
Describes the assessment runs that are specified by the ARNs of the assessment runs.
See also: AWS API Documentation
Request Syntax
response = client.describe_assessment_runs(
assessmentRunArns=[
'string',
]
)
[REQUIRED]
The ARN that specifies the assessment run that you want to describe.
{
'assessmentRuns': [
{
'arn': 'string',
'name': 'string',
'assessmentTemplateArn': 'string',
'state': 'CREATED'|'START_DATA_COLLECTION_PENDING'|'START_DATA_COLLECTION_IN_PROGRESS'|'COLLECTING_DATA'|'STOP_DATA_COLLECTION_PENDING'|'DATA_COLLECTED'|'START_EVALUATING_RULES_PENDING'|'EVALUATING_RULES'|'FAILED'|'ERROR'|'COMPLETED'|'COMPLETED_WITH_ERRORS'|'CANCELED',
'durationInSeconds': 123,
'rulesPackageArns': [
'string',
],
'userAttributesForFindings': [
{
'key': 'string',
'value': 'string'
},
],
'createdAt': datetime(2015, 1, 1),
'startedAt': datetime(2015, 1, 1),
'completedAt': datetime(2015, 1, 1),
'stateChangedAt': datetime(2015, 1, 1),
'dataCollected': True|False,
'stateChanges': [
{
'stateChangedAt': datetime(2015, 1, 1),
'state': 'CREATED'|'START_DATA_COLLECTION_PENDING'|'START_DATA_COLLECTION_IN_PROGRESS'|'COLLECTING_DATA'|'STOP_DATA_COLLECTION_PENDING'|'DATA_COLLECTED'|'START_EVALUATING_RULES_PENDING'|'EVALUATING_RULES'|'FAILED'|'ERROR'|'COMPLETED'|'COMPLETED_WITH_ERRORS'|'CANCELED'
},
],
'notifications': [
{
'date': datetime(2015, 1, 1),
'event': 'ASSESSMENT_RUN_STARTED'|'ASSESSMENT_RUN_COMPLETED'|'ASSESSMENT_RUN_STATE_CHANGED'|'FINDING_REPORTED'|'OTHER',
'message': 'string',
'error': True|False,
'snsTopicArn': 'string',
'snsPublishStatusCode': 'SUCCESS'|'TOPIC_DOES_NOT_EXIST'|'ACCESS_DENIED'|'INTERNAL_ERROR'
},
],
'findingCounts': {
'string': 123
}
},
],
'failedItems': {
'string': {
'failureCode': 'INVALID_ARN'|'DUPLICATE_ARN'|'ITEM_DOES_NOT_EXIST'|'ACCESS_DENIED'|'LIMIT_EXCEEDED'|'INTERNAL_ERROR',
'retryable': True|False
}
}
}
Response Structure
Information about the assessment run.
A snapshot of an Amazon Inspector assessment run that contains the findings of the assessment run .
Used as the response element in the DescribeAssessmentRuns action.
The ARN of the assessment run.
The auto-generated name for the assessment run.
The ARN of the assessment template that is associated with the assessment run.
The state of the assessment run.
The duration of the assessment run.
The rules packages selected for the assessment run.
The user-defined attributes that are assigned to every generated finding.
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
The attribute key.
The value assigned to the attribute key.
The time when StartAssessmentRun was called.
The time when StartAssessmentRun was called.
The assessment run completion time that corresponds to the rules packages evaluation completion time or failure.
The last time when the assessment run's state changed.
A Boolean value (true or false) that specifies whether the process of collecting data from the agents is completed.
A list of the assessment run state changes.
Used as one of the elements of the AssessmentRun data type.
The last time the assessment run state changed.
The assessment run state.
A list of notifications for the event subscriptions. A notification about a particular generated finding is added to this list only once.
Used as one of the elements of the AssessmentRun data type.
The date of the notification.
The event for which a notification is sent.
The message included in the notification.
The Boolean value that specifies whether the notification represents an error.
The SNS topic to which the SNS notification is sent.
The status code of the SNS notification.
Provides a total count of generated findings per severity.
Assessment run details that cannot be described. An error code is provided for each failed item.
Includes details about the failed items.
The status code of a failed item.
Indicates whether you can immediately retry a request for this item for a specified resource.
Examples
Describes the assessment runs that are specified by the ARNs of the assessment runs.
response = client.describe_assessment_runs(
assessmentRunArns=[
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE',
],
)
print(response)
Expected Output:
{
'assessmentRuns': [
{
'name': 'Run 1 for ExampleAssessmentTemplate',
'arn': 'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE',
'assessmentTemplateArn': 'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw',
'completedAt': datetime(2016, 3, 22, 13, 58, 21, 1, 82, 1),
'createdAt': datetime(2016, 3, 22, 13, 56, 10, 1, 82, 1),
'dataCollected': True,
'durationInSeconds': 3600,
'notifications': [
],
'rulesPackageArns': [
'arn:aws:inspector:us-west-2:758058086616:rulespackage/0-X1KXtawP',
],
'startedAt': datetime(2016, 3, 22, 13, 56, 10, 1, 82, 1),
'state': 'COMPLETED',
'stateChangedAt': datetime(2016, 3, 22, 13, 58, 21, 1, 82, 1),
'stateChanges': [
{
'state': 'CREATED',
'stateChangedAt': datetime(2016, 3, 22, 13, 56, 10, 1, 82, 1),
},
{
'state': 'START_DATA_COLLECTION_PENDING',
'stateChangedAt': datetime(2016, 3, 22, 13, 56, 10, 1, 82, 1),
},
{
'state': 'START_DATA_COLLECTION_IN_PROGRESS',
'stateChangedAt': datetime(2016, 3, 22, 13, 56, 10, 1, 82, 1),
},
{
'state': 'COLLECTING_DATA',
'stateChangedAt': datetime(2016, 3, 22, 13, 56, 10, 1, 82, 1),
},
{
'state': 'STOP_DATA_COLLECTION_PENDING',
'stateChangedAt': datetime(2016, 3, 22, 13, 57, 19, 1, 82, 1),
},
{
'state': 'DATA_COLLECTED',
'stateChangedAt': datetime(2016, 3, 22, 13, 58, 19, 1, 82, 1),
},
{
'state': 'EVALUATING_RULES',
'stateChangedAt': datetime(2016, 3, 22, 13, 58, 20, 1, 82, 1),
},
{
'state': 'COMPLETED',
'stateChangedAt': datetime(2016, 3, 22, 13, 58, 21, 1, 82, 1),
},
],
'userAttributesForFindings': [
],
},
],
'failedItems': {
},
'ResponseMetadata': {
'...': '...',
},
}
Describes the assessment targets that are specified by the ARNs of the assessment targets.
See also: AWS API Documentation
Request Syntax
response = client.describe_assessment_targets(
assessmentTargetArns=[
'string',
]
)
[REQUIRED]
The ARNs that specifies the assessment targets that you want to describe.
{
'assessmentTargets': [
{
'arn': 'string',
'name': 'string',
'resourceGroupArn': 'string',
'createdAt': datetime(2015, 1, 1),
'updatedAt': datetime(2015, 1, 1)
},
],
'failedItems': {
'string': {
'failureCode': 'INVALID_ARN'|'DUPLICATE_ARN'|'ITEM_DOES_NOT_EXIST'|'ACCESS_DENIED'|'LIMIT_EXCEEDED'|'INTERNAL_ERROR',
'retryable': True|False
}
}
}
Response Structure
Information about the assessment targets.
Contains information about an Amazon Inspector application. This data type is used as the response element in the DescribeAssessmentTargets action.
The ARN that specifies the Amazon Inspector assessment target.
The name of the Amazon Inspector assessment target.
The ARN that specifies the resource group that is associated with the assessment target.
The time at which the assessment target is created.
The time at which UpdateAssessmentTarget is called.
Assessment target details that cannot be described. An error code is provided for each failed item.
Includes details about the failed items.
The status code of a failed item.
Indicates whether you can immediately retry a request for this item for a specified resource.
Examples
Describes the assessment targets that are specified by the ARNs of the assessment targets.
response = client.describe_assessment_targets(
assessmentTargetArns=[
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq',
],
)
print(response)
Expected Output:
{
'assessmentTargets': [
{
'name': 'ExampleAssessmentTarget',
'arn': 'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq',
'createdAt': datetime(2016, 3, 15, 13, 36, 31, 1, 75, 1),
'resourceGroupArn': 'arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-PyGXopAI',
'updatedAt': datetime(2016, 3, 15, 13, 36, 31, 1, 75, 1),
},
],
'failedItems': {
},
'ResponseMetadata': {
'...': '...',
},
}
Describes the assessment templates that are specified by the ARNs of the assessment templates.
See also: AWS API Documentation
Request Syntax
response = client.describe_assessment_templates(
assessmentTemplateArns=[
'string',
]
)
[REQUIRED]
{
'assessmentTemplates': [
{
'arn': 'string',
'name': 'string',
'assessmentTargetArn': 'string',
'durationInSeconds': 123,
'rulesPackageArns': [
'string',
],
'userAttributesForFindings': [
{
'key': 'string',
'value': 'string'
},
],
'lastAssessmentRunArn': 'string',
'assessmentRunCount': 123,
'createdAt': datetime(2015, 1, 1)
},
],
'failedItems': {
'string': {
'failureCode': 'INVALID_ARN'|'DUPLICATE_ARN'|'ITEM_DOES_NOT_EXIST'|'ACCESS_DENIED'|'LIMIT_EXCEEDED'|'INTERNAL_ERROR',
'retryable': True|False
}
}
}
Response Structure
Information about the assessment templates.
Contains information about an Amazon Inspector assessment template. This data type is used as the response element in the DescribeAssessmentTemplates action.
The ARN of the assessment template.
The name of the assessment template.
The ARN of the assessment target that corresponds to this assessment template.
The duration in seconds specified for this assessment template. The default value is 3600 seconds (one hour). The maximum value is 86400 seconds (one day).
The rules packages that are specified for this assessment template.
The user-defined attributes that are assigned to every generated finding from the assessment run that uses this assessment template.
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
The attribute key.
The value assigned to the attribute key.
The Amazon Resource Name (ARN) of the most recent assessment run associated with this assessment template. This value exists only when the value of assessmentRunCount is greaterpa than zero.
The number of existing assessment runs associated with this assessment template. This value can be zero or a positive integer.
The time at which the assessment template is created.
Assessment template details that cannot be described. An error code is provided for each failed item.
Includes details about the failed items.
The status code of a failed item.
Indicates whether you can immediately retry a request for this item for a specified resource.
Examples
Describes the assessment templates that are specified by the ARNs of the assessment templates.
response = client.describe_assessment_templates(
assessmentTemplateArns=[
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw',
],
)
print(response)
Expected Output:
{
'assessmentTemplates': [
{
'name': 'ExampleAssessmentTemplate',
'arn': 'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw',
'assessmentTargetArn': 'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq',
'createdAt': datetime(2016, 3, 15, 13, 36, 31, 1, 75, 1),
'durationInSeconds': 3600,
'rulesPackageArns': [
'arn:aws:inspector:us-west-2:758058086616:rulespackage/0-X1KXtawP',
],
'userAttributesForFindings': [
],
},
],
'failedItems': {
},
'ResponseMetadata': {
'...': '...',
},
}
Describes the IAM role that enables Amazon Inspector to access your AWS account.
See also: AWS API Documentation
Request Syntax
response = client.describe_cross_account_access_role()
{
'roleArn': 'string',
'valid': True|False,
'registeredAt': datetime(2015, 1, 1)
}
Response Structure
The ARN that specifies the IAM role that Amazon Inspector uses to access your AWS account.
A Boolean value that specifies whether the IAM role has the necessary policies attached to enable Amazon Inspector to access your AWS account.
The date when the cross-account access role was registered.
Examples
Describes the IAM role that enables Amazon Inspector to access your AWS account.
response = client.describe_cross_account_access_role(
)
print(response)
Expected Output:
{
'registeredAt': datetime(2016, 3, 15, 12, 13, 2, 1, 75, 1),
'roleArn': 'arn:aws:iam::123456789012:role/inspector',
'valid': True,
'ResponseMetadata': {
'...': '...',
},
}
Describes the exclusions that are specified by the exclusions' ARNs.
See also: AWS API Documentation
Request Syntax
response = client.describe_exclusions(
exclusionArns=[
'string',
],
locale='EN_US'
)
[REQUIRED]
The list of ARNs that specify the exclusions that you want to describe.
dict
Response Syntax
{
'exclusions': {
'string': {
'arn': 'string',
'title': 'string',
'description': 'string',
'recommendation': 'string',
'scopes': [
{
'key': 'INSTANCE_ID'|'RULES_PACKAGE_ARN',
'value': 'string'
},
],
'attributes': [
{
'key': 'string',
'value': 'string'
},
]
}
},
'failedItems': {
'string': {
'failureCode': 'INVALID_ARN'|'DUPLICATE_ARN'|'ITEM_DOES_NOT_EXIST'|'ACCESS_DENIED'|'LIMIT_EXCEEDED'|'INTERNAL_ERROR',
'retryable': True|False
}
}
}
Response Structure
(dict) --
exclusions (dict) --
Information about the exclusions.
(string) --
(dict) --
Contains information about what was excluded from an assessment run.
arn (string) --
The ARN that specifies the exclusion.
title (string) --
The name of the exclusion.
description (string) --
The description of the exclusion.
recommendation (string) --
The recommendation for the exclusion.
scopes (list) --
The AWS resources for which the exclusion pertains.
(dict) --
This data type contains key-value pairs that identify various Amazon resources.
key (string) --
The type of the scope.
value (string) --
The resource identifier for the specified scope type.
attributes (list) --
The system-defined attributes for the exclusion.
(dict) --
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
key (string) --
The attribute key.
value (string) --
The value assigned to the attribute key.
failedItems (dict) --
Exclusion details that cannot be described. An error code is provided for each failed item.
(string) --
(dict) --
Includes details about the failed items.
failureCode (string) --
The status code of a failed item.
retryable (boolean) --
Indicates whether you can immediately retry a request for this item for a specified resource.
Describes the findings that are specified by the ARNs of the findings.
See also: AWS API Documentation
Request Syntax
response = client.describe_findings(
findingArns=[
'string',
],
locale='EN_US'
)
[REQUIRED]
The ARN that specifies the finding that you want to describe.
dict
Response Syntax
{
'findings': [
{
'arn': 'string',
'schemaVersion': 123,
'service': 'string',
'serviceAttributes': {
'schemaVersion': 123,
'assessmentRunArn': 'string',
'rulesPackageArn': 'string'
},
'assetType': 'ec2-instance',
'assetAttributes': {
'schemaVersion': 123,
'agentId': 'string',
'autoScalingGroup': 'string',
'amiId': 'string',
'hostname': 'string',
'ipv4Addresses': [
'string',
],
'tags': [
{
'key': 'string',
'value': 'string'
},
],
'networkInterfaces': [
{
'networkInterfaceId': 'string',
'subnetId': 'string',
'vpcId': 'string',
'privateDnsName': 'string',
'privateIpAddress': 'string',
'privateIpAddresses': [
{
'privateDnsName': 'string',
'privateIpAddress': 'string'
},
],
'publicDnsName': 'string',
'publicIp': 'string',
'ipv6Addresses': [
'string',
],
'securityGroups': [
{
'groupName': 'string',
'groupId': 'string'
},
]
},
]
},
'id': 'string',
'title': 'string',
'description': 'string',
'recommendation': 'string',
'severity': 'Low'|'Medium'|'High'|'Informational'|'Undefined',
'numericSeverity': 123.0,
'confidence': 123,
'indicatorOfCompromise': True|False,
'attributes': [
{
'key': 'string',
'value': 'string'
},
],
'userAttributes': [
{
'key': 'string',
'value': 'string'
},
],
'createdAt': datetime(2015, 1, 1),
'updatedAt': datetime(2015, 1, 1)
},
],
'failedItems': {
'string': {
'failureCode': 'INVALID_ARN'|'DUPLICATE_ARN'|'ITEM_DOES_NOT_EXIST'|'ACCESS_DENIED'|'LIMIT_EXCEEDED'|'INTERNAL_ERROR',
'retryable': True|False
}
}
}
Response Structure
(dict) --
findings (list) --
Information about the finding.
(dict) --
Contains information about an Amazon Inspector finding. This data type is used as the response element in the DescribeFindings action.
arn (string) --
The ARN that specifies the finding.
schemaVersion (integer) --
The schema version of this data type.
service (string) --
The data element is set to "Inspector".
serviceAttributes (dict) --
This data type is used in the Finding data type.
schemaVersion (integer) --
The schema version of this data type.
assessmentRunArn (string) --
The ARN of the assessment run during which the finding is generated.
rulesPackageArn (string) --
The ARN of the rules package that is used to generate the finding.
assetType (string) --
The type of the host from which the finding is generated.
assetAttributes (dict) --
A collection of attributes of the host from which the finding is generated.
schemaVersion (integer) --
The schema version of this data type.
agentId (string) --
The ID of the agent that is installed on the EC2 instance where the finding is generated.
autoScalingGroup (string) --
The Auto Scaling group of the EC2 instance where the finding is generated.
amiId (string) --
The ID of the Amazon Machine Image (AMI) that is installed on the EC2 instance where the finding is generated.
hostname (string) --
The hostname of the EC2 instance where the finding is generated.
ipv4Addresses (list) --
The list of IP v4 addresses of the EC2 instance where the finding is generated.
tags (list) --
The tags related to the EC2 instance where the finding is generated.
(dict) --
A key and value pair. This data type is used as a request parameter in the SetTagsForResource action and a response element in the ListTagsForResource action.
key (string) --
A tag key.
value (string) --
A value assigned to a tag key.
networkInterfaces (list) --
An array of the network interfaces interacting with the EC2 instance where the finding is generated.
(dict) --
Contains information about the network interfaces interacting with an EC2 instance. This data type is used as one of the elements of the AssetAttributes data type.
networkInterfaceId (string) --
The ID of the network interface.
subnetId (string) --
The ID of a subnet associated with the network interface.
vpcId (string) --
The ID of a VPC associated with the network interface.
privateDnsName (string) --
The name of a private DNS associated with the network interface.
privateIpAddress (string) --
The private IP address associated with the network interface.
privateIpAddresses (list) --
A list of the private IP addresses associated with the network interface. Includes the privateDnsName and privateIpAddress.
(dict) --
Contains information about a private IP address associated with a network interface. This data type is used as a response element in the DescribeFindings action.
privateDnsName (string) --
The DNS name of the private IP address.
privateIpAddress (string) --
The full IP address of the network inteface.
publicDnsName (string) --
The name of a public DNS associated with the network interface.
publicIp (string) --
The public IP address from which the network interface is reachable.
ipv6Addresses (list) --
The IP addresses associated with the network interface.
securityGroups (list) --
A list of the security groups associated with the network interface. Includes the groupId and groupName.
(dict) --
Contains information about a security group associated with a network interface. This data type is used as one of the elements of the NetworkInterface data type.
groupName (string) --
The name of the security group.
groupId (string) --
The ID of the security group.
id (string) --
The ID of the finding.
title (string) --
The name of the finding.
description (string) --
The description of the finding.
recommendation (string) --
The recommendation for the finding.
severity (string) --
The finding severity. Values can be set to High, Medium, Low, and Informational.
numericSeverity (float) --
The numeric value of the finding severity.
confidence (integer) --
This data element is currently not used.
indicatorOfCompromise (boolean) --
This data element is currently not used.
attributes (list) --
The system-defined attributes for the finding.
(dict) --
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
key (string) --
The attribute key.
value (string) --
The value assigned to the attribute key.
userAttributes (list) --
The user-defined attributes that are assigned to the finding.
(dict) --
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
key (string) --
The attribute key.
value (string) --
The value assigned to the attribute key.
createdAt (datetime) --
The time when the finding was generated.
updatedAt (datetime) --
The time when AddAttributesToFindings is called.
failedItems (dict) --
Finding details that cannot be described. An error code is provided for each failed item.
(string) --
(dict) --
Includes details about the failed items.
failureCode (string) --
The status code of a failed item.
retryable (boolean) --
Indicates whether you can immediately retry a request for this item for a specified resource.
Examples
Describes the findings that are specified by the ARNs of the findings.
response = client.describe_findings(
findingArns=[
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE/finding/0-HwPnsDm4',
],
)
print(response)
Expected Output:
{
'failedItems': {
},
'findings': [
{
'arn': 'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE/finding/0-HwPnsDm4',
'assetAttributes': {
'ipv4Addresses': [
],
'schemaVersion': 1,
},
'assetType': 'ec2-instance',
'attributes': [
],
'confidence': 10,
'createdAt': datetime(2016, 3, 22, 13, 58, 21, 1, 82, 1),
'description': 'Amazon Inspector did not find any potential security issues during this assessment.',
'indicatorOfCompromise': False,
'numericSeverity': 0,
'recommendation': 'No remediation needed.',
'schemaVersion': 1,
'service': 'Inspector',
'serviceAttributes': {
'assessmentRunArn': 'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE',
'rulesPackageArn': 'arn:aws:inspector:us-west-2:758058086616:rulespackage/0-X1KXtawP',
'schemaVersion': 1,
},
'severity': 'Informational',
'title': 'No potential security issues found',
'updatedAt': datetime(2016, 3, 22, 13, 58, 21, 1, 82, 1),
'userAttributes': [
],
},
],
'ResponseMetadata': {
'...': '...',
},
}
Describes the resource groups that are specified by the ARNs of the resource groups.
See also: AWS API Documentation
Request Syntax
response = client.describe_resource_groups(
resourceGroupArns=[
'string',
]
)
[REQUIRED]
The ARN that specifies the resource group that you want to describe.
{
'resourceGroups': [
{
'arn': 'string',
'tags': [
{
'key': 'string',
'value': 'string'
},
],
'createdAt': datetime(2015, 1, 1)
},
],
'failedItems': {
'string': {
'failureCode': 'INVALID_ARN'|'DUPLICATE_ARN'|'ITEM_DOES_NOT_EXIST'|'ACCESS_DENIED'|'LIMIT_EXCEEDED'|'INTERNAL_ERROR',
'retryable': True|False
}
}
}
Response Structure
Information about a resource group.
Contains information about a resource group. The resource group defines a set of tags that, when queried, identify the AWS resources that make up the assessment target. This data type is used as the response element in the DescribeResourceGroups action.
The ARN of the resource group.
The tags (key and value pairs) of the resource group. This data type property is used in the CreateResourceGroup action.
This data type is used as one of the elements of the ResourceGroup data type.
A tag key.
The value assigned to a tag key.
The time at which resource group is created.
Resource group details that cannot be described. An error code is provided for each failed item.
Includes details about the failed items.
The status code of a failed item.
Indicates whether you can immediately retry a request for this item for a specified resource.
Examples
Describes the resource groups that are specified by the ARNs of the resource groups.
response = client.describe_resource_groups(
resourceGroupArns=[
'arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-PyGXopAI',
],
)
print(response)
Expected Output:
{
'failedItems': {
},
'resourceGroups': [
{
'arn': 'arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-PyGXopAI',
'createdAt': datetime(2016, 3, 15, 13, 36, 31, 1, 75, 1),
'tags': [
{
'key': 'Name',
'value': 'example',
},
],
},
],
'ResponseMetadata': {
'...': '...',
},
}
Describes the rules packages that are specified by the ARNs of the rules packages.
See also: AWS API Documentation
Request Syntax
response = client.describe_rules_packages(
rulesPackageArns=[
'string',
],
locale='EN_US'
)
[REQUIRED]
The ARN that specifies the rules package that you want to describe.
dict
Response Syntax
{
'rulesPackages': [
{
'arn': 'string',
'name': 'string',
'version': 'string',
'provider': 'string',
'description': 'string'
},
],
'failedItems': {
'string': {
'failureCode': 'INVALID_ARN'|'DUPLICATE_ARN'|'ITEM_DOES_NOT_EXIST'|'ACCESS_DENIED'|'LIMIT_EXCEEDED'|'INTERNAL_ERROR',
'retryable': True|False
}
}
}
Response Structure
(dict) --
rulesPackages (list) --
Information about the rules package.
(dict) --
Contains information about an Amazon Inspector rules package. This data type is used as the response element in the DescribeRulesPackages action.
arn (string) --
The ARN of the rules package.
name (string) --
The name of the rules package.
version (string) --
The version ID of the rules package.
provider (string) --
The provider of the rules package.
description (string) --
The description of the rules package.
failedItems (dict) --
Rules package details that cannot be described. An error code is provided for each failed item.
(string) --
(dict) --
Includes details about the failed items.
failureCode (string) --
The status code of a failed item.
retryable (boolean) --
Indicates whether you can immediately retry a request for this item for a specified resource.
Examples
Describes the rules packages that are specified by the ARNs of the rules packages.
response = client.describe_rules_packages(
rulesPackageArns=[
'arn:aws:inspector:us-west-2:758058086616:rulespackage/0-JJOtZiqQ',
],
)
print(response)
Expected Output:
{
'failedItems': {
},
'rulesPackages': [
{
'version': '1.1',
'name': 'Security Best Practices',
'arn': 'arn:aws:inspector:us-west-2:758058086616:rulespackage/0-JJOtZiqQ',
'description': 'The rules in this package help determine whether your systems are configured securely.',
'provider': 'Amazon Web Services, Inc.',
},
],
'ResponseMetadata': {
'...': '...',
},
}
Generate a presigned url given a client, its method, and arguments
The presigned url
Produces an assessment report that includes detailed and comprehensive results of a specified assessment run.
See also: AWS API Documentation
Request Syntax
response = client.get_assessment_report(
assessmentRunArn='string',
reportFileFormat='HTML'|'PDF',
reportType='FINDING'|'FULL'
)
[REQUIRED]
The ARN that specifies the assessment run for which you want to generate a report.
[REQUIRED]
Specifies the file format (html or pdf) of the assessment report that you want to generate.
[REQUIRED]
Specifies the type of the assessment report that you want to generate. There are two types of assessment reports: a finding report and a full report. For more information, see Assessment Reports .
dict
Response Syntax
{
'status': 'WORK_IN_PROGRESS'|'FAILED'|'COMPLETED',
'url': 'string'
}
Response Structure
(dict) --
status (string) --
Specifies the status of the request to generate an assessment report.
url (string) --
Specifies the URL where you can find the generated assessment report. This parameter is only returned if the report is successfully generated.
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.
See also: AWS API Documentation
Request Syntax
response = client.get_exclusions_preview(
assessmentTemplateArn='string',
previewToken='string',
nextToken='string',
maxResults=123,
locale='EN_US'
)
[REQUIRED]
The ARN that specifies the assessment template for which the exclusions preview was requested.
[REQUIRED]
The unique identifier associated of the exclusions preview.
dict
Response Syntax
{
'previewStatus': 'WORK_IN_PROGRESS'|'COMPLETED',
'exclusionPreviews': [
{
'title': 'string',
'description': 'string',
'recommendation': 'string',
'scopes': [
{
'key': 'INSTANCE_ID'|'RULES_PACKAGE_ARN',
'value': 'string'
},
],
'attributes': [
{
'key': 'string',
'value': 'string'
},
]
},
],
'nextToken': 'string'
}
Response Structure
(dict) --
previewStatus (string) --
Specifies the status of the request to generate an exclusions preview.
exclusionPreviews (list) --
Information about the exclusions included in the preview.
(dict) --
Contains information about what is excluded from an assessment run given the current state of the assessment template.
title (string) --
The name of the exclusion preview.
description (string) --
The description of the exclusion preview.
recommendation (string) --
The recommendation for the exclusion preview.
scopes (list) --
The AWS resources for which the exclusion preview pertains.
(dict) --
This data type contains key-value pairs that identify various Amazon resources.
key (string) --
The type of the scope.
value (string) --
The resource identifier for the specified scope type.
attributes (list) --
The system-defined attributes for the exclusion preview.
(dict) --
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
key (string) --
The attribute key.
value (string) --
The value assigned to the attribute key.
nextToken (string) --
When a response is generated, if there is more data to be listed, this parameters is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.
Create a paginator for an operation.
Information about the data that is collected for the specified assessment run.
See also: AWS API Documentation
Request Syntax
response = client.get_telemetry_metadata(
assessmentRunArn='string'
)
[REQUIRED]
The ARN that specifies the assessment run that has the telemetry data that you want to obtain.
{
'telemetryMetadata': [
{
'messageType': 'string',
'count': 123,
'dataSize': 123
},
]
}
Response Structure
Telemetry details.
The metadata about the Amazon Inspector application data metrics collected by the agent. This data type is used as the response element in the GetTelemetryMetadata action.
A specific type of behavioral data that is collected by the agent.
The count of messages that the agent sends to the Amazon Inspector service.
The data size of messages that the agent sends to the Amazon Inspector service.
Examples
Information about the data that is collected for the specified assessment run.
response = client.get_telemetry_metadata(
assessmentRunArn='arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE',
)
print(response)
Expected Output:
{
'telemetryMetadata': [
{
'count': 2,
'dataSize': 345,
'messageType': 'InspectorDuplicateProcess',
},
{
'count': 3,
'dataSize': 255,
'messageType': 'InspectorTimeEventMsg',
},
{
'count': 4,
'dataSize': 1082,
'messageType': 'InspectorNetworkInterface',
},
{
'count': 2,
'dataSize': 349,
'messageType': 'InspectorDnsEntry',
},
{
'count': 11,
'dataSize': 2514,
'messageType': 'InspectorDirectoryInfoMsg',
},
{
'count': 1,
'dataSize': 179,
'messageType': 'InspectorTcpV6ListeningPort',
},
{
'count': 101,
'dataSize': 10949,
'messageType': 'InspectorTerminal',
},
{
'count': 26,
'dataSize': 5916,
'messageType': 'InspectorUser',
},
{
'count': 282,
'dataSize': 32148,
'messageType': 'InspectorDynamicallyLoadedCodeModule',
},
{
'count': 18,
'dataSize': 10172,
'messageType': 'InspectorCreateProcess',
},
{
'count': 3,
'dataSize': 8001,
'messageType': 'InspectorProcessPerformance',
},
{
'count': 1,
'dataSize': 360,
'messageType': 'InspectorOperatingSystem',
},
{
'count': 6,
'dataSize': 546,
'messageType': 'InspectorStopProcess',
},
{
'count': 1,
'dataSize': 1553,
'messageType': 'InspectorInstanceMetaData',
},
{
'count': 2,
'dataSize': 434,
'messageType': 'InspectorTcpV4Connection',
},
{
'count': 474,
'dataSize': 2960322,
'messageType': 'InspectorPackageInfo',
},
{
'count': 3,
'dataSize': 2235,
'messageType': 'InspectorSystemPerformance',
},
{
'count': 105,
'dataSize': 46048,
'messageType': 'InspectorCodeModule',
},
{
'count': 1,
'dataSize': 182,
'messageType': 'InspectorUdpV6ListeningPort',
},
{
'count': 2,
'dataSize': 371,
'messageType': 'InspectorUdpV4ListeningPort',
},
{
'count': 18,
'dataSize': 8362,
'messageType': 'InspectorKernelModule',
},
{
'count': 29,
'dataSize': 48788,
'messageType': 'InspectorConfigurationInfo',
},
{
'count': 1,
'dataSize': 79,
'messageType': 'InspectorMonitoringStart',
},
{
'count': 5,
'dataSize': 0,
'messageType': 'InspectorSplitMsgBegin',
},
{
'count': 51,
'dataSize': 4593,
'messageType': 'InspectorGroup',
},
{
'count': 1,
'dataSize': 184,
'messageType': 'InspectorTcpV4ListeningPort',
},
{
'count': 1159,
'dataSize': 3146579,
'messageType': 'Total',
},
{
'count': 5,
'dataSize': 0,
'messageType': 'InspectorSplitMsgEnd',
},
{
'count': 1,
'dataSize': 612,
'messageType': 'InspectorLoadImageInProcess',
},
],
'ResponseMetadata': {
'...': '...',
},
}
Returns an object that can wait for some condition.
Lists the agents of the assessment runs that are specified by the ARNs of the assessment runs.
See also: AWS API Documentation
Request Syntax
response = client.list_assessment_run_agents(
assessmentRunArn='string',
filter={
'agentHealths': [
'HEALTHY'|'UNHEALTHY'|'UNKNOWN',
],
'agentHealthCodes': [
'IDLE'|'RUNNING'|'SHUTDOWN'|'UNHEALTHY'|'THROTTLED'|'UNKNOWN',
]
},
nextToken='string',
maxResults=123
)
[REQUIRED]
The ARN that specifies the assessment run whose agents you want to list.
You can use this parameter to specify a subset of data to be included in the action's response.
For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.
The current health state of the agent. Values can be set to HEALTHY or UNHEALTHY .
The detailed health state of the agent. Values can be set to IDLE , RUNNING , SHUTDOWN , UNHEALTHY , THROTTLED , and UNKNOWN .
dict
Response Syntax
{
'assessmentRunAgents': [
{
'agentId': 'string',
'assessmentRunArn': 'string',
'agentHealth': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN',
'agentHealthCode': 'IDLE'|'RUNNING'|'SHUTDOWN'|'UNHEALTHY'|'THROTTLED'|'UNKNOWN',
'agentHealthDetails': 'string',
'autoScalingGroup': 'string',
'telemetryMetadata': [
{
'messageType': 'string',
'count': 123,
'dataSize': 123
},
]
},
],
'nextToken': 'string'
}
Response Structure
(dict) --
assessmentRunAgents (list) --
A list of ARNs that specifies the agents returned by the action.
(dict) --
Contains information about an Amazon Inspector agent. This data type is used as a response element in the ListAssessmentRunAgents action.
agentId (string) --
The AWS account of the EC2 instance where the agent is installed.
assessmentRunArn (string) --
The ARN of the assessment run that is associated with the agent.
agentHealth (string) --
The current health state of the agent.
agentHealthCode (string) --
The detailed health state of the agent.
agentHealthDetails (string) --
The description for the agent health code.
autoScalingGroup (string) --
The Auto Scaling group of the EC2 instance that is specified by the agent ID.
telemetryMetadata (list) --
The Amazon Inspector application data metrics that are collected by the agent.
(dict) --
The metadata about the Amazon Inspector application data metrics collected by the agent. This data type is used as the response element in the GetTelemetryMetadata action.
messageType (string) --
A specific type of behavioral data that is collected by the agent.
count (integer) --
The count of messages that the agent sends to the Amazon Inspector service.
dataSize (integer) --
The data size of messages that the agent sends to the Amazon Inspector service.
nextToken (string) --
When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.
Examples
Lists the agents of the assessment runs that are specified by the ARNs of the assessment runs.
response = client.list_assessment_run_agents(
assessmentRunArn='arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE',
maxResults=123,
)
print(response)
Expected Output:
{
'assessmentRunAgents': [
{
'agentHealth': 'HEALTHY',
'agentHealthCode': 'RUNNING',
'agentId': 'i-49113b93',
'assessmentRunArn': 'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE',
'telemetryMetadata': [
{
'count': 2,
'dataSize': 345,
'messageType': 'InspectorDuplicateProcess',
},
{
'count': 3,
'dataSize': 255,
'messageType': 'InspectorTimeEventMsg',
},
{
'count': 4,
'dataSize': 1082,
'messageType': 'InspectorNetworkInterface',
},
{
'count': 2,
'dataSize': 349,
'messageType': 'InspectorDnsEntry',
},
{
'count': 11,
'dataSize': 2514,
'messageType': 'InspectorDirectoryInfoMsg',
},
{
'count': 1,
'dataSize': 179,
'messageType': 'InspectorTcpV6ListeningPort',
},
{
'count': 101,
'dataSize': 10949,
'messageType': 'InspectorTerminal',
},
{
'count': 26,
'dataSize': 5916,
'messageType': 'InspectorUser',
},
{
'count': 282,
'dataSize': 32148,
'messageType': 'InspectorDynamicallyLoadedCodeModule',
},
{
'count': 18,
'dataSize': 10172,
'messageType': 'InspectorCreateProcess',
},
{
'count': 3,
'dataSize': 8001,
'messageType': 'InspectorProcessPerformance',
},
{
'count': 1,
'dataSize': 360,
'messageType': 'InspectorOperatingSystem',
},
{
'count': 6,
'dataSize': 546,
'messageType': 'InspectorStopProcess',
},
{
'count': 1,
'dataSize': 1553,
'messageType': 'InspectorInstanceMetaData',
},
{
'count': 2,
'dataSize': 434,
'messageType': 'InspectorTcpV4Connection',
},
{
'count': 474,
'dataSize': 2960322,
'messageType': 'InspectorPackageInfo',
},
{
'count': 3,
'dataSize': 2235,
'messageType': 'InspectorSystemPerformance',
},
{
'count': 105,
'dataSize': 46048,
'messageType': 'InspectorCodeModule',
},
{
'count': 1,
'dataSize': 182,
'messageType': 'InspectorUdpV6ListeningPort',
},
{
'count': 2,
'dataSize': 371,
'messageType': 'InspectorUdpV4ListeningPort',
},
{
'count': 18,
'dataSize': 8362,
'messageType': 'InspectorKernelModule',
},
{
'count': 29,
'dataSize': 48788,
'messageType': 'InspectorConfigurationInfo',
},
{
'count': 1,
'dataSize': 79,
'messageType': 'InspectorMonitoringStart',
},
{
'count': 5,
'dataSize': 0,
'messageType': 'InspectorSplitMsgBegin',
},
{
'count': 51,
'dataSize': 4593,
'messageType': 'InspectorGroup',
},
{
'count': 1,
'dataSize': 184,
'messageType': 'InspectorTcpV4ListeningPort',
},
{
'count': 1159,
'dataSize': 3146579,
'messageType': 'Total',
},
{
'count': 5,
'dataSize': 0,
'messageType': 'InspectorSplitMsgEnd',
},
{
'count': 1,
'dataSize': 612,
'messageType': 'InspectorLoadImageInProcess',
},
],
},
],
'nextToken': '1',
'ResponseMetadata': {
'...': '...',
},
}
Lists the assessment runs that correspond to the assessment templates that are specified by the ARNs of the assessment templates.
See also: AWS API Documentation
Request Syntax
response = client.list_assessment_runs(
assessmentTemplateArns=[
'string',
],
filter={
'namePattern': 'string',
'states': [
'CREATED'|'START_DATA_COLLECTION_PENDING'|'START_DATA_COLLECTION_IN_PROGRESS'|'COLLECTING_DATA'|'STOP_DATA_COLLECTION_PENDING'|'DATA_COLLECTED'|'START_EVALUATING_RULES_PENDING'|'EVALUATING_RULES'|'FAILED'|'ERROR'|'COMPLETED'|'COMPLETED_WITH_ERRORS'|'CANCELED',
],
'durationRange': {
'minSeconds': 123,
'maxSeconds': 123
},
'rulesPackageArns': [
'string',
],
'startTimeRange': {
'beginDate': datetime(2015, 1, 1),
'endDate': datetime(2015, 1, 1)
},
'completionTimeRange': {
'beginDate': datetime(2015, 1, 1),
'endDate': datetime(2015, 1, 1)
},
'stateChangeTimeRange': {
'beginDate': datetime(2015, 1, 1),
'endDate': datetime(2015, 1, 1)
}
},
nextToken='string',
maxResults=123
)
The ARNs that specify the assessment templates whose assessment runs you want to list.
You can use this parameter to specify a subset of data to be included in the action's response.
For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.
For a record to match a filter, an explicit value or a string containing a wildcard that is specified for this data type property must match the value of the assessmentRunName property of the AssessmentRun data type.
For a record to match a filter, one of the values specified for this data type property must be the exact match of the value of the assessmentRunState property of the AssessmentRun data type.
For a record to match a filter, the value that is specified for this data type property must inclusively match any value between the specified minimum and maximum values of the durationInSeconds property of the AssessmentRun data type.
The minimum value of the duration range. Must be greater than zero.
The maximum value of the duration range. Must be less than or equal to 604800 seconds (1 week).
For a record to match a filter, the value that is specified for this data type property must be contained in the list of values of the rulesPackages property of the AssessmentRun data type.
For a record to match a filter, the value that is specified for this data type property must inclusively match any value between the specified minimum and maximum values of the startTime property of the AssessmentRun data type.
The minimum value of the timestamp range.
The maximum value of the timestamp range.
For a record to match a filter, the value that is specified for this data type property must inclusively match any value between the specified minimum and maximum values of the completedAt property of the AssessmentRun data type.
The minimum value of the timestamp range.
The maximum value of the timestamp range.
For a record to match a filter, the value that is specified for this data type property must match the stateChangedAt property of the AssessmentRun data type.
The minimum value of the timestamp range.
The maximum value of the timestamp range.
dict
Response Syntax
{
'assessmentRunArns': [
'string',
],
'nextToken': 'string'
}
Response Structure
(dict) --
assessmentRunArns (list) --
A list of ARNs that specifies the assessment runs that are returned by the action.
nextToken (string) --
When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.
Examples
Lists the assessment runs that correspond to the assessment templates that are specified by the ARNs of the assessment templates.
response = client.list_assessment_runs(
assessmentTemplateArns=[
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw',
],
maxResults=123,
)
print(response)
Expected Output:
{
'assessmentRunArns': [
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE',
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-v5D6fI3v',
],
'nextToken': '1',
'ResponseMetadata': {
'...': '...',
},
}
Lists the ARNs of the assessment targets within this AWS account. For more information about assessment targets, see Amazon Inspector Assessment Targets .
See also: AWS API Documentation
Request Syntax
response = client.list_assessment_targets(
filter={
'assessmentTargetNamePattern': 'string'
},
nextToken='string',
maxResults=123
)
You can use this parameter to specify a subset of data to be included in the action's response.
For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.
For a record to match a filter, an explicit value or a string that contains a wildcard that is specified for this data type property must match the value of the assessmentTargetName property of the AssessmentTarget data type.
dict
Response Syntax
{
'assessmentTargetArns': [
'string',
],
'nextToken': 'string'
}
Response Structure
(dict) --
assessmentTargetArns (list) --
A list of ARNs that specifies the assessment targets that are returned by the action.
nextToken (string) --
When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.
Examples
Lists the ARNs of the assessment targets within this AWS account.
response = client.list_assessment_targets(
maxResults=123,
)
print(response)
Expected Output:
{
'assessmentTargetArns': [
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq',
],
'nextToken': '1',
'ResponseMetadata': {
'...': '...',
},
}
Lists the assessment templates that correspond to the assessment targets that are specified by the ARNs of the assessment targets.
See also: AWS API Documentation
Request Syntax
response = client.list_assessment_templates(
assessmentTargetArns=[
'string',
],
filter={
'namePattern': 'string',
'durationRange': {
'minSeconds': 123,
'maxSeconds': 123
},
'rulesPackageArns': [
'string',
]
},
nextToken='string',
maxResults=123
)
A list of ARNs that specifies the assessment targets whose assessment templates you want to list.
You can use this parameter to specify a subset of data to be included in the action's response.
For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.
For a record to match a filter, an explicit value or a string that contains a wildcard that is specified for this data type property must match the value of the assessmentTemplateName property of the AssessmentTemplate data type.
For a record to match a filter, the value specified for this data type property must inclusively match any value between the specified minimum and maximum values of the durationInSeconds property of the AssessmentTemplate data type.
The minimum value of the duration range. Must be greater than zero.
The maximum value of the duration range. Must be less than or equal to 604800 seconds (1 week).
For a record to match a filter, the values that are specified for this data type property must be contained in the list of values of the rulesPackageArns property of the AssessmentTemplate data type.
dict
Response Syntax
{
'assessmentTemplateArns': [
'string',
],
'nextToken': 'string'
}
Response Structure
(dict) --
assessmentTemplateArns (list) --
A list of ARNs that specifies the assessment templates returned by the action.
nextToken (string) --
When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.
Examples
Lists the assessment templates that correspond to the assessment targets that are specified by the ARNs of the assessment targets.
response = client.list_assessment_templates(
assessmentTargetArns=[
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq',
],
maxResults=123,
)
print(response)
Expected Output:
{
'assessmentTemplateArns': [
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw',
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-Uza6ihLh',
],
'nextToken': '1',
'ResponseMetadata': {
'...': '...',
},
}
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 .
See also: AWS API Documentation
Request Syntax
response = client.list_event_subscriptions(
resourceArn='string',
nextToken='string',
maxResults=123
)
dict
Response Syntax
{
'subscriptions': [
{
'resourceArn': 'string',
'topicArn': 'string',
'eventSubscriptions': [
{
'event': 'ASSESSMENT_RUN_STARTED'|'ASSESSMENT_RUN_COMPLETED'|'ASSESSMENT_RUN_STATE_CHANGED'|'FINDING_REPORTED'|'OTHER',
'subscribedAt': datetime(2015, 1, 1)
},
]
},
],
'nextToken': 'string'
}
Response Structure
(dict) --
subscriptions (list) --
Details of the returned event subscriptions.
(dict) --
This data type is used as a response element in the ListEventSubscriptions action.
resourceArn (string) --
The ARN of the assessment template that is used during the event for which the SNS notification is sent.
topicArn (string) --
The ARN of the Amazon Simple Notification Service (SNS) topic to which the SNS notifications are sent.
eventSubscriptions (list) --
The list of existing event subscriptions.
(dict) --
This data type is used in the Subscription data type.
event (string) --
The event for which Amazon Simple Notification Service (SNS) notifications are sent.
subscribedAt (datetime) --
The time at which SubscribeToEvent is called.
nextToken (string) --
When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.
Examples
Lists all the event subscriptions for the assessment template that is specified by the ARN of the assessment template.
response = client.list_event_subscriptions(
maxResults=123,
resourceArn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0',
)
print(response)
Expected Output:
{
'nextToken': '1',
'subscriptions': [
{
'eventSubscriptions': [
{
'event': 'ASSESSMENT_RUN_COMPLETED',
'subscribedAt': datetime(2016, 3, 31, 13, 17, 20, 3, 91, 1),
},
],
'resourceArn': 'arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0',
'topicArn': 'arn:aws:sns:us-west-2:123456789012:exampletopic',
},
],
'ResponseMetadata': {
'...': '...',
},
}
List exclusions that are generated by the assessment run.
See also: AWS API Documentation
Request Syntax
response = client.list_exclusions(
assessmentRunArn='string',
nextToken='string',
maxResults=123
)
[REQUIRED]
The ARN of the assessment run that generated the exclusions that you want to list.
dict
Response Syntax
{
'exclusionArns': [
'string',
],
'nextToken': 'string'
}
Response Structure
(dict) --
exclusionArns (list) --
A list of exclusions' ARNs returned by the action.
nextToken (string) --
When a response is generated, if there is more data to be listed, this parameters is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.
Lists findings that are generated by the assessment runs that are specified by the ARNs of the assessment runs.
See also: AWS API Documentation
Request Syntax
response = client.list_findings(
assessmentRunArns=[
'string',
],
filter={
'agentIds': [
'string',
],
'autoScalingGroups': [
'string',
],
'ruleNames': [
'string',
],
'severities': [
'Low'|'Medium'|'High'|'Informational'|'Undefined',
],
'rulesPackageArns': [
'string',
],
'attributes': [
{
'key': 'string',
'value': 'string'
},
],
'userAttributes': [
{
'key': 'string',
'value': 'string'
},
],
'creationTimeRange': {
'beginDate': datetime(2015, 1, 1),
'endDate': datetime(2015, 1, 1)
}
},
nextToken='string',
maxResults=123
)
The ARNs of the assessment runs that generate the findings that you want to list.
You can use this parameter to specify a subset of data to be included in the action's response.
For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.
For a record to match a filter, one of the values that is specified for this data type property must be the exact match of the value of the agentId property of the Finding data type.
For a record to match a filter, one of the values that is specified for this data type property must be the exact match of the value of the autoScalingGroup property of the Finding data type.
For a record to match a filter, one of the values that is specified for this data type property must be the exact match of the value of the ruleName property of the Finding data type.
For a record to match a filter, one of the values that is specified for this data type property must be the exact match of the value of the severity property of the Finding data type.
For a record to match a filter, one of the values that is specified for this data type property must be the exact match of the value of the rulesPackageArn property of the Finding data type.
For a record to match a filter, the list of values that are specified for this data type property must be contained in the list of values of the attributes property of the Finding data type.
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
The attribute key.
The value assigned to the attribute key.
For a record to match a filter, the value that is specified for this data type property must be contained in the list of values of the userAttributes property of the Finding data type.
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
The attribute key.
The value assigned to the attribute key.
The time range during which the finding is generated.
The minimum value of the timestamp range.
The maximum value of the timestamp range.
dict
Response Syntax
{
'findingArns': [
'string',
],
'nextToken': 'string'
}
Response Structure
(dict) --
findingArns (list) --
A list of ARNs that specifies the findings returned by the action.
nextToken (string) --
When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.
Examples
Lists findings that are generated by the assessment runs that are specified by the ARNs of the assessment runs.
response = client.list_findings(
assessmentRunArns=[
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE',
],
maxResults=123,
)
print(response)
Expected Output:
{
'findingArns': [
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-MKkpXXPE/finding/0-HwPnsDm4',
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-4r1V2mAw/run/0-v5D6fI3v/finding/0-tyvmqBLy',
],
'nextToken': '1',
'ResponseMetadata': {
'...': '...',
},
}
Lists all available Amazon Inspector rules packages.
See also: AWS API Documentation
Request Syntax
response = client.list_rules_packages(
nextToken='string',
maxResults=123
)
dict
Response Syntax
{
'rulesPackageArns': [
'string',
],
'nextToken': 'string'
}
Response Structure
(dict) --
rulesPackageArns (list) --
The list of ARNs that specifies the rules packages returned by the action.
nextToken (string) --
When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.
Examples
Lists all available Amazon Inspector rules packages.
response = client.list_rules_packages(
maxResults=123,
)
print(response)
Expected Output:
{
'nextToken': '1',
'rulesPackageArns': [
'arn:aws:inspector:us-west-2:758058086616:rulespackage/0-9hgA516p',
'arn:aws:inspector:us-west-2:758058086616:rulespackage/0-H5hpSawc',
'arn:aws:inspector:us-west-2:758058086616:rulespackage/0-JJOtZiqQ',
'arn:aws:inspector:us-west-2:758058086616:rulespackage/0-vg5GGHSD',
],
'ResponseMetadata': {
'...': '...',
},
}
Lists all tags associated with an assessment template.
See also: AWS API Documentation
Request Syntax
response = client.list_tags_for_resource(
resourceArn='string'
)
[REQUIRED]
The ARN that specifies the assessment template whose tags you want to list.
{
'tags': [
{
'key': 'string',
'value': 'string'
},
]
}
Response Structure
A collection of key and value pairs.
A key and value pair. This data type is used as a request parameter in the SetTagsForResource action and a response element in the ListTagsForResource action.
A tag key.
A value assigned to a tag key.
Examples
Lists all tags associated with an assessment template.
response = client.list_tags_for_resource(
resourceArn='arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-gcwFliYu',
)
print(response)
Expected Output:
{
'tags': [
{
'key': 'Name',
'value': 'Example',
},
],
'ResponseMetadata': {
'...': '...',
},
}
Previews the agents installed on the EC2 instances that are part of the specified assessment target.
See also: AWS API Documentation
Request Syntax
response = client.preview_agents(
previewAgentsArn='string',
nextToken='string',
maxResults=123
)
[REQUIRED]
The ARN of the assessment target whose agents you want to preview.
dict
Response Syntax
{
'agentPreviews': [
{
'hostname': 'string',
'agentId': 'string',
'autoScalingGroup': 'string',
'agentHealth': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN',
'agentVersion': 'string',
'operatingSystem': 'string',
'kernelVersion': 'string',
'ipv4Address': 'string'
},
],
'nextToken': 'string'
}
Response Structure
(dict) --
agentPreviews (list) --
The resulting list of agents.
(dict) --
Used as a response element in the PreviewAgents action.
hostname (string) --
The hostname of the EC2 instance on which the Amazon Inspector Agent is installed.
agentId (string) --
The ID of the EC2 instance where the agent is installed.
autoScalingGroup (string) --
The Auto Scaling group for the EC2 instance where the agent is installed.
agentHealth (string) --
The health status of the Amazon Inspector Agent.
agentVersion (string) --
The version of the Amazon Inspector Agent.
operatingSystem (string) --
The operating system running on the EC2 instance on which the Amazon Inspector Agent is installed.
kernelVersion (string) --
The kernel version of the operating system running on the EC2 instance on which the Amazon Inspector Agent is installed.
ipv4Address (string) --
The IP address of the EC2 instance on which the Amazon Inspector Agent is installed.
nextToken (string) --
When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.
Examples
Previews the agents installed on the EC2 instances that are part of the specified assessment target.
response = client.preview_agents(
maxResults=123,
previewAgentsArn='arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq',
)
print(response)
Expected Output:
{
'agentPreviews': [
{
'agentId': 'i-49113b93',
},
],
'nextToken': '1',
'ResponseMetadata': {
'...': '...',
},
}
Registers the IAM role that grants Amazon Inspector access to AWS Services needed to perform security assessments.
See also: AWS API Documentation
Request Syntax
response = client.register_cross_account_access_role(
roleArn='string'
)
[REQUIRED]
The ARN of the IAM role that grants Amazon Inspector access to AWS Services needed to perform security assessments.
Examples
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.
response = client.register_cross_account_access_role(
roleArn='arn:aws:iam::123456789012:role/inspector',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
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.
See also: AWS API Documentation
Request Syntax
response = client.remove_attributes_from_findings(
findingArns=[
'string',
],
attributeKeys=[
'string',
]
)
[REQUIRED]
The ARNs that specify the findings that you want to remove attributes from.
[REQUIRED]
The array of attribute keys that you want to remove from specified findings.
dict
Response Syntax
{
'failedItems': {
'string': {
'failureCode': 'INVALID_ARN'|'DUPLICATE_ARN'|'ITEM_DOES_NOT_EXIST'|'ACCESS_DENIED'|'LIMIT_EXCEEDED'|'INTERNAL_ERROR',
'retryable': True|False
}
}
}
Response Structure
(dict) --
failedItems (dict) --
Attributes details that cannot be described. An error code is provided for each failed item.
(string) --
(dict) --
Includes details about the failed items.
failureCode (string) --
The status code of a failed item.
retryable (boolean) --
Indicates whether you can immediately retry a request for this item for a specified resource.
Examples
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.
response = client.remove_attributes_from_findings(
attributeKeys=[
'key=Example,value=example',
],
findingArns=[
'arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq/template/0-8l1VIE0D/run/0-Z02cjjug/finding/0-T8yM9mEU',
],
)
print(response)
Expected Output:
{
'failedItems': {
},
'ResponseMetadata': {
'...': '...',
},
}
Sets tags (key and value pairs) to the assessment template that is specified by the ARN of the assessment template.
See also: AWS API Documentation
Request Syntax
response = client.set_tags_for_resource(
resourceArn='string',
tags=[
{
'key': 'string',
'value': 'string'
},
]
)
[REQUIRED]
The ARN of the assessment template that you want to set tags to.
A collection of key and value pairs that you want to set to the assessment template.
A key and value pair. This data type is used as a request parameter in the SetTagsForResource action and a response element in the ListTagsForResource action.
A tag key.
A value assigned to a tag key.
None
Examples
Sets tags (key and value pairs) to the assessment template that is specified by the ARN of the assessment template.
response = client.set_tags_for_resource(
resourceArn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0',
tags=[
{
'key': 'Example',
'value': 'example',
},
],
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
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.
See also: AWS API Documentation
Request Syntax
response = client.start_assessment_run(
assessmentTemplateArn='string',
assessmentRunName='string'
)
[REQUIRED]
The ARN of the assessment template of the assessment run that you want to start.
dict
Response Syntax
{
'assessmentRunArn': 'string'
}
Response Structure
(dict) --
assessmentRunArn (string) --
The ARN of the assessment run that has been started.
Examples
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.
response = client.start_assessment_run(
assessmentRunName='examplerun',
assessmentTemplateArn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T',
)
print(response)
Expected Output:
{
'assessmentRunArn': 'arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T/run/0-jOoroxyY',
'ResponseMetadata': {
'...': '...',
},
}
Stops the assessment run that is specified by the ARN of the assessment run.
See also: AWS API Documentation
Request Syntax
response = client.stop_assessment_run(
assessmentRunArn='string',
stopAction='START_EVALUATION'|'SKIP_EVALUATION'
)
[REQUIRED]
The ARN of the assessment run that you want to stop.
None
Examples
Stops the assessment run that is specified by the ARN of the assessment run.
response = client.stop_assessment_run(
assessmentRunArn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T/run/0-11LMTAVe',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
Enables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.
See also: AWS API Documentation
Request Syntax
response = client.subscribe_to_event(
resourceArn='string',
event='ASSESSMENT_RUN_STARTED'|'ASSESSMENT_RUN_COMPLETED'|'ASSESSMENT_RUN_STATE_CHANGED'|'FINDING_REPORTED'|'OTHER',
topicArn='string'
)
[REQUIRED]
The ARN of the assessment template that is used during the event for which you want to receive SNS notifications.
[REQUIRED]
The event for which you want to receive SNS notifications.
[REQUIRED]
The ARN of the SNS topic to which the SNS notifications are sent.
None
Examples
Enables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.
response = client.subscribe_to_event(
event='ASSESSMENT_RUN_COMPLETED',
resourceArn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0',
topicArn='arn:aws:sns:us-west-2:123456789012:exampletopic',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
Disables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.
See also: AWS API Documentation
Request Syntax
response = client.unsubscribe_from_event(
resourceArn='string',
event='ASSESSMENT_RUN_STARTED'|'ASSESSMENT_RUN_COMPLETED'|'ASSESSMENT_RUN_STATE_CHANGED'|'FINDING_REPORTED'|'OTHER',
topicArn='string'
)
[REQUIRED]
The ARN of the assessment template that is used during the event for which you want to stop receiving SNS notifications.
[REQUIRED]
The event for which you want to stop receiving SNS notifications.
[REQUIRED]
The ARN of the SNS topic to which SNS notifications are sent.
None
Examples
Disables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.
response = client.unsubscribe_from_event(
event='ASSESSMENT_RUN_COMPLETED',
resourceArn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0',
topicArn='arn:aws:sns:us-west-2:123456789012:exampletopic',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
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.
See also: AWS API Documentation
Request Syntax
response = client.update_assessment_target(
assessmentTargetArn='string',
assessmentTargetName='string',
resourceGroupArn='string'
)
[REQUIRED]
The ARN of the assessment target that you want to update.
[REQUIRED]
The name of the assessment target that you want to update.
None
Examples
Updates the assessment target that is specified by the ARN of the assessment target.
response = client.update_assessment_target(
assessmentTargetArn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX',
assessmentTargetName='Example',
resourceGroupArn='arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-yNbgL5Pt',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
The available paginators are:
paginator = client.get_paginator('list_assessment_run_agents')
Creates an iterator that will paginate through responses from Inspector.Client.list_assessment_run_agents().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
assessmentRunArn='string',
filter={
'agentHealths': [
'HEALTHY'|'UNHEALTHY'|'UNKNOWN',
],
'agentHealthCodes': [
'IDLE'|'RUNNING'|'SHUTDOWN'|'UNHEALTHY'|'THROTTLED'|'UNKNOWN',
]
},
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
[REQUIRED]
The ARN that specifies the assessment run whose agents you want to list.
You can use this parameter to specify a subset of data to be included in the action's response.
For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.
The current health state of the agent. Values can be set to HEALTHY or UNHEALTHY .
The detailed health state of the agent. Values can be set to IDLE , RUNNING , SHUTDOWN , UNHEALTHY , THROTTLED , and UNKNOWN .
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'assessmentRunAgents': [
{
'agentId': 'string',
'assessmentRunArn': 'string',
'agentHealth': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN',
'agentHealthCode': 'IDLE'|'RUNNING'|'SHUTDOWN'|'UNHEALTHY'|'THROTTLED'|'UNKNOWN',
'agentHealthDetails': 'string',
'autoScalingGroup': 'string',
'telemetryMetadata': [
{
'messageType': 'string',
'count': 123,
'dataSize': 123
},
]
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
assessmentRunAgents (list) --
A list of ARNs that specifies the agents returned by the action.
(dict) --
Contains information about an Amazon Inspector agent. This data type is used as a response element in the ListAssessmentRunAgents action.
agentId (string) --
The AWS account of the EC2 instance where the agent is installed.
assessmentRunArn (string) --
The ARN of the assessment run that is associated with the agent.
agentHealth (string) --
The current health state of the agent.
agentHealthCode (string) --
The detailed health state of the agent.
agentHealthDetails (string) --
The description for the agent health code.
autoScalingGroup (string) --
The Auto Scaling group of the EC2 instance that is specified by the agent ID.
telemetryMetadata (list) --
The Amazon Inspector application data metrics that are collected by the agent.
(dict) --
The metadata about the Amazon Inspector application data metrics collected by the agent. This data type is used as the response element in the GetTelemetryMetadata action.
messageType (string) --
A specific type of behavioral data that is collected by the agent.
count (integer) --
The count of messages that the agent sends to the Amazon Inspector service.
dataSize (integer) --
The data size of messages that the agent sends to the Amazon Inspector service.
NextToken (string) --
A token to resume pagination.
paginator = client.get_paginator('list_assessment_runs')
Creates an iterator that will paginate through responses from Inspector.Client.list_assessment_runs().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
assessmentTemplateArns=[
'string',
],
filter={
'namePattern': 'string',
'states': [
'CREATED'|'START_DATA_COLLECTION_PENDING'|'START_DATA_COLLECTION_IN_PROGRESS'|'COLLECTING_DATA'|'STOP_DATA_COLLECTION_PENDING'|'DATA_COLLECTED'|'START_EVALUATING_RULES_PENDING'|'EVALUATING_RULES'|'FAILED'|'ERROR'|'COMPLETED'|'COMPLETED_WITH_ERRORS'|'CANCELED',
],
'durationRange': {
'minSeconds': 123,
'maxSeconds': 123
},
'rulesPackageArns': [
'string',
],
'startTimeRange': {
'beginDate': datetime(2015, 1, 1),
'endDate': datetime(2015, 1, 1)
},
'completionTimeRange': {
'beginDate': datetime(2015, 1, 1),
'endDate': datetime(2015, 1, 1)
},
'stateChangeTimeRange': {
'beginDate': datetime(2015, 1, 1),
'endDate': datetime(2015, 1, 1)
}
},
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
The ARNs that specify the assessment templates whose assessment runs you want to list.
You can use this parameter to specify a subset of data to be included in the action's response.
For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.
For a record to match a filter, an explicit value or a string containing a wildcard that is specified for this data type property must match the value of the assessmentRunName property of the AssessmentRun data type.
For a record to match a filter, one of the values specified for this data type property must be the exact match of the value of the assessmentRunState property of the AssessmentRun data type.
For a record to match a filter, the value that is specified for this data type property must inclusively match any value between the specified minimum and maximum values of the durationInSeconds property of the AssessmentRun data type.
The minimum value of the duration range. Must be greater than zero.
The maximum value of the duration range. Must be less than or equal to 604800 seconds (1 week).
For a record to match a filter, the value that is specified for this data type property must be contained in the list of values of the rulesPackages property of the AssessmentRun data type.
For a record to match a filter, the value that is specified for this data type property must inclusively match any value between the specified minimum and maximum values of the startTime property of the AssessmentRun data type.
The minimum value of the timestamp range.
The maximum value of the timestamp range.
For a record to match a filter, the value that is specified for this data type property must inclusively match any value between the specified minimum and maximum values of the completedAt property of the AssessmentRun data type.
The minimum value of the timestamp range.
The maximum value of the timestamp range.
For a record to match a filter, the value that is specified for this data type property must match the stateChangedAt property of the AssessmentRun data type.
The minimum value of the timestamp range.
The maximum value of the timestamp range.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'assessmentRunArns': [
'string',
],
'NextToken': 'string'
}
Response Structure
(dict) --
assessmentRunArns (list) --
A list of ARNs that specifies the assessment runs that are returned by the action.
NextToken (string) --
A token to resume pagination.
paginator = client.get_paginator('list_assessment_targets')
Creates an iterator that will paginate through responses from Inspector.Client.list_assessment_targets().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
filter={
'assessmentTargetNamePattern': 'string'
},
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
You can use this parameter to specify a subset of data to be included in the action's response.
For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.
For a record to match a filter, an explicit value or a string that contains a wildcard that is specified for this data type property must match the value of the assessmentTargetName property of the AssessmentTarget data type.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'assessmentTargetArns': [
'string',
],
'NextToken': 'string'
}
Response Structure
(dict) --
assessmentTargetArns (list) --
A list of ARNs that specifies the assessment targets that are returned by the action.
NextToken (string) --
A token to resume pagination.
paginator = client.get_paginator('list_assessment_templates')
Creates an iterator that will paginate through responses from Inspector.Client.list_assessment_templates().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
assessmentTargetArns=[
'string',
],
filter={
'namePattern': 'string',
'durationRange': {
'minSeconds': 123,
'maxSeconds': 123
},
'rulesPackageArns': [
'string',
]
},
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
A list of ARNs that specifies the assessment targets whose assessment templates you want to list.
You can use this parameter to specify a subset of data to be included in the action's response.
For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.
For a record to match a filter, an explicit value or a string that contains a wildcard that is specified for this data type property must match the value of the assessmentTemplateName property of the AssessmentTemplate data type.
For a record to match a filter, the value specified for this data type property must inclusively match any value between the specified minimum and maximum values of the durationInSeconds property of the AssessmentTemplate data type.
The minimum value of the duration range. Must be greater than zero.
The maximum value of the duration range. Must be less than or equal to 604800 seconds (1 week).
For a record to match a filter, the values that are specified for this data type property must be contained in the list of values of the rulesPackageArns property of the AssessmentTemplate data type.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'assessmentTemplateArns': [
'string',
],
'NextToken': 'string'
}
Response Structure
(dict) --
assessmentTemplateArns (list) --
A list of ARNs that specifies the assessment templates returned by the action.
NextToken (string) --
A token to resume pagination.
paginator = client.get_paginator('list_event_subscriptions')
Creates an iterator that will paginate through responses from Inspector.Client.list_event_subscriptions().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
resourceArn='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'subscriptions': [
{
'resourceArn': 'string',
'topicArn': 'string',
'eventSubscriptions': [
{
'event': 'ASSESSMENT_RUN_STARTED'|'ASSESSMENT_RUN_COMPLETED'|'ASSESSMENT_RUN_STATE_CHANGED'|'FINDING_REPORTED'|'OTHER',
'subscribedAt': datetime(2015, 1, 1)
},
]
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
subscriptions (list) --
Details of the returned event subscriptions.
(dict) --
This data type is used as a response element in the ListEventSubscriptions action.
resourceArn (string) --
The ARN of the assessment template that is used during the event for which the SNS notification is sent.
topicArn (string) --
The ARN of the Amazon Simple Notification Service (SNS) topic to which the SNS notifications are sent.
eventSubscriptions (list) --
The list of existing event subscriptions.
(dict) --
This data type is used in the Subscription data type.
event (string) --
The event for which Amazon Simple Notification Service (SNS) notifications are sent.
subscribedAt (datetime) --
The time at which SubscribeToEvent is called.
NextToken (string) --
A token to resume pagination.
paginator = client.get_paginator('list_exclusions')
Creates an iterator that will paginate through responses from Inspector.Client.list_exclusions().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
assessmentRunArn='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
[REQUIRED]
The ARN of the assessment run that generated the exclusions that you want to list.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'exclusionArns': [
'string',
],
'NextToken': 'string'
}
Response Structure
(dict) --
exclusionArns (list) --
A list of exclusions' ARNs returned by the action.
NextToken (string) --
A token to resume pagination.
paginator = client.get_paginator('list_findings')
Creates an iterator that will paginate through responses from Inspector.Client.list_findings().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
assessmentRunArns=[
'string',
],
filter={
'agentIds': [
'string',
],
'autoScalingGroups': [
'string',
],
'ruleNames': [
'string',
],
'severities': [
'Low'|'Medium'|'High'|'Informational'|'Undefined',
],
'rulesPackageArns': [
'string',
],
'attributes': [
{
'key': 'string',
'value': 'string'
},
],
'userAttributes': [
{
'key': 'string',
'value': 'string'
},
],
'creationTimeRange': {
'beginDate': datetime(2015, 1, 1),
'endDate': datetime(2015, 1, 1)
}
},
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
The ARNs of the assessment runs that generate the findings that you want to list.
You can use this parameter to specify a subset of data to be included in the action's response.
For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.
For a record to match a filter, one of the values that is specified for this data type property must be the exact match of the value of the agentId property of the Finding data type.
For a record to match a filter, one of the values that is specified for this data type property must be the exact match of the value of the autoScalingGroup property of the Finding data type.
For a record to match a filter, one of the values that is specified for this data type property must be the exact match of the value of the ruleName property of the Finding data type.
For a record to match a filter, one of the values that is specified for this data type property must be the exact match of the value of the severity property of the Finding data type.
For a record to match a filter, one of the values that is specified for this data type property must be the exact match of the value of the rulesPackageArn property of the Finding data type.
For a record to match a filter, the list of values that are specified for this data type property must be contained in the list of values of the attributes property of the Finding data type.
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
The attribute key.
The value assigned to the attribute key.
For a record to match a filter, the value that is specified for this data type property must be contained in the list of values of the userAttributes property of the Finding data type.
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
The attribute key.
The value assigned to the attribute key.
The time range during which the finding is generated.
The minimum value of the timestamp range.
The maximum value of the timestamp range.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'findingArns': [
'string',
],
'NextToken': 'string'
}
Response Structure
(dict) --
findingArns (list) --
A list of ARNs that specifies the findings returned by the action.
NextToken (string) --
A token to resume pagination.
paginator = client.get_paginator('list_rules_packages')
Creates an iterator that will paginate through responses from Inspector.Client.list_rules_packages().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
{
'rulesPackageArns': [
'string',
],
'NextToken': 'string'
}
Response Structure
The list of ARNs that specifies the rules packages returned by the action.
A token to resume pagination.
paginator = client.get_paginator('preview_agents')
Creates an iterator that will paginate through responses from Inspector.Client.preview_agents().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
previewAgentsArn='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
[REQUIRED]
The ARN of the assessment target whose agents you want to preview.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'agentPreviews': [
{
'hostname': 'string',
'agentId': 'string',
'autoScalingGroup': 'string',
'agentHealth': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN',
'agentVersion': 'string',
'operatingSystem': 'string',
'kernelVersion': 'string',
'ipv4Address': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
agentPreviews (list) --
The resulting list of agents.
(dict) --
Used as a response element in the PreviewAgents action.
hostname (string) --
The hostname of the EC2 instance on which the Amazon Inspector Agent is installed.
agentId (string) --
The ID of the EC2 instance where the agent is installed.
autoScalingGroup (string) --
The Auto Scaling group for the EC2 instance where the agent is installed.
agentHealth (string) --
The health status of the Amazon Inspector Agent.
agentVersion (string) --
The version of the Amazon Inspector Agent.
operatingSystem (string) --
The operating system running on the EC2 instance on which the Amazon Inspector Agent is installed.
kernelVersion (string) --
The kernel version of the operating system running on the EC2 instance on which the Amazon Inspector Agent is installed.
ipv4Address (string) --
The IP address of the EC2 instance on which the Amazon Inspector Agent is installed.
NextToken (string) --
A token to resume pagination.