list_assessment_runs

list_assessment_runs(**kwargs)

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
)
Parameters
  • assessmentTemplateArns (list) --

    The ARNs that specify the assessment templates whose assessment runs you want to list.

    • (string) --
  • filter (dict) --

    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.

    • namePattern (string) --

      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.

    • states (list) --

      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.

      • (string) --
    • durationRange (dict) --

      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.

      • minSeconds (integer) --

        The minimum value of the duration range. Must be greater than zero.

      • maxSeconds (integer) --

        The maximum value of the duration range. Must be less than or equal to 604800 seconds (1 week).

    • rulesPackageArns (list) --

      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.

      • (string) --
    • startTimeRange (dict) --

      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.

      • beginDate (datetime) --

        The minimum value of the timestamp range.

      • endDate (datetime) --

        The maximum value of the timestamp range.

    • completionTimeRange (dict) --

      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.

      • beginDate (datetime) --

        The minimum value of the timestamp range.

      • endDate (datetime) --

        The maximum value of the timestamp range.

    • stateChangeTimeRange (dict) --

      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.

      • beginDate (datetime) --

        The minimum value of the timestamp range.

      • endDate (datetime) --

        The maximum value of the timestamp range.

  • nextToken (string) -- You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListAssessmentRuns action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.
  • maxResults (integer) -- You can use this parameter to indicate the maximum number of items that you want in the response. The default value is 10. The maximum value is 500.
Return type

dict

Returns

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.

      • (string) --
    • 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.

Exceptions

  • Inspector.Client.exceptions.InternalException
  • Inspector.Client.exceptions.InvalidInputException
  • Inspector.Client.exceptions.AccessDeniedException
  • Inspector.Client.exceptions.NoSuchEntityException

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': {
        '...': '...',
    },
}