Skip to content

list_assessment_outcomes async

list_assessment_outcomes(
    environment_arn: EnvironmentArn,
    project: ProjectName,
    framework: FrameworkName,
    framework_version: FrameworkVersion,
    *,
    config_overrides: Optional[AsyncAssuranceClientConfig] = None,
    control_id: Optional[ControlID] = None,
    resource_identifier: Optional[ResourceIdentifier] = None,
    aggregation_level: Optional[AggregationLevel] = None,
    start_time: Optional[datetime] = None,
    end_time: Optional[datetime] = None,
    period: Optional[AssessmentOutcomePeriod] = None,
    statistic: Optional[AssessmentOutcomeStat] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[PaginationToken] = None,
) -> ListAssessmentOutcomesOutput

Returns the compliance score of a framework in a project over a time range. You can narrow the score to one control, one resource, or one control on one resource. You can also get one score per control for a resource.

The operation returns either the current score or a history of scores, depending on whether you specify a time range.

  • Current score. If you don't specify startTime or endTime, and you use the default LAST statistic, the operation returns the most recent score as a single data point. Its timestamp is the time of the assessment that produced the score. This option isn't available when you get one score per control.

  • History. If you specify startTime, endTime, or both, or you specify the MAX, MIN, or AVG statistic, the operation divides the time range into buckets of one hour or one day (set by period). It returns one data point for each bucket that has a score, newest first. Buckets with no score are left out, so match each data point to its bucket by timestamp.

Specify times in UTC. The time range includes startTime and excludes endTime.

Parameters:

  • environment_arn (EnvironmentArn) –

    The ARN of the environment.

  • project (ProjectName) –

    The project the request is scoped to.

  • framework (FrameworkName) –

    The name of the framework.

  • framework_version (FrameworkVersion) –

    The version of the framework.

  • control_id (Optional[ControlID], default: None ) –

    Narrows the series to one control's score over time. Omit for the whole framework's score over time.

  • resource_identifier (Optional[ResourceIdentifier], default: None ) –

    Use this parameter to narrow the series to one resource. Specify the resource identifier that ListDiscoveredResources returns, which is its ARN if one exists, or its AWS Config resource type and resource ID (separated by a slash) otherwise. If you omit this parameter, the series reports the score for the whole project.

  • aggregation_level (Optional[AggregationLevel], default: None ) –

    The level of the scores in each point. Specify one of the following values:

    • FRAMEWORK – One score for the framework. This is the default.

    • CONTROL – One score for each control that has a score in the bucket. The controls can differ from one point to the next. Specify a window with startTime and endTime, or use the MAX, MIN, or AVG statistic.

    You can specify this parameter only together with resourceIdentifier, and not together with controlId.

  • start_time (Optional[datetime], default: None ) –

    The start of the window, inclusive, in UTC. The default is 7 days before endTime. To get the most recent score instead of a series, omit both startTime and endTime.

  • end_time (Optional[datetime], default: None ) –

    The end of the window, exclusive, in UTC. The default is the time of the request. endTime must be later than startTime. To get the most recent score instead of a series, omit both startTime and endTime.

  • period (Optional[AssessmentOutcomePeriod], default: None ) –

    The width of each time bucket. Valid values are ONE_HOUR and ONE_DAY. The default is ONE_DAY. This parameter has no effect when the response is the most recent score.

  • statistic (Optional[AssessmentOutcomeStat], default: None ) –

    How AWS Assurance combines the scores of the assessments in a bucket. Specify one of the following values:

    • LAST – The score of the most recent assessment in the bucket. If that assessment has no score, the bucket is left out. This is the default.

    • MAX – The highest score in the bucket.

    • MIN – The lowest score in the bucket.

    • AVG – The average score in the bucket. Each assessment counts once, so assessments that run more often carry more weight.

    At CONTROL aggregation, the statistic is applied to each control separately.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of points to return on one page. If you omit it, the operation uses its default page size.

  • next_token (Optional[PaginationToken], default: None ) –

    The token for the next page of results, from a previous response.

Raises:

Examples:

Daily score history for one control on one S3 bucket Lists how a PCI DSS control has scored a payments bucket day by day, so the team can see whether a remediation took effect.

>>> await client.list_assessment_outcomes(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', project='payments-prod', framework='AWS:PCI-DSS', framework_version='4', control_id='8.2.1', resource_identifier='arn:aws:s3:::payments-prod-transaction-logs', start_time='2026-03-12T00:00:00Z', end_time='2026-03-15T00:00:00Z', period='ONE_DAY', statistic='LAST')
The current score for a project, with no window named
Reads the score the most recent assessment produced, for a dashboard tile that shows where the project stands now.
>>> await client.list_assessment_outcomes(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', project='payments-prod', framework='AWS:PCI-DSS', framework_version='4')
Source code in docs_src/capo_assurance/_services/async_assurance.py
async def list_assessment_outcomes(
    self,
    environment_arn: "capo_assurance.types.environment_arn.EnvironmentArn",
    project: "capo_assurance.types.project_name.ProjectName",
    framework: "capo_assurance.types.framework_name.FrameworkName",
    framework_version: "capo_assurance.types.framework_version.FrameworkVersion",
    *,
    config_overrides: Optional[AsyncAssuranceClientConfig] = None,
    control_id: Optional["capo_assurance.types.control_id.ControlID"] = None,
    resource_identifier: Optional[
        "capo_assurance.types.resource_identifier.ResourceIdentifier"
    ] = None,
    aggregation_level: Optional[
        "capo_assurance.types.aggregation_level.AggregationLevel"
    ] = None,
    start_time: Optional[datetime.datetime] = None,
    end_time: Optional[datetime.datetime] = None,
    period: Optional[
        "capo_assurance.types.assessment_outcome_period.AssessmentOutcomePeriod"
    ] = None,
    statistic: Optional[
        "capo_assurance.types.assessment_outcome_stat.AssessmentOutcomeStat"
    ] = None,
    max_results: Optional["capo_assurance.types.max_results.MaxResults"] = None,
    next_token: Optional[
        "capo_assurance.types.pagination_token.PaginationToken"
    ] = None,
) -> "capo_assurance.types.list_assessment_outcomes_output.ListAssessmentOutcomesOutput":
    """<p>Returns the compliance score of a framework in a project over a time range. You can narrow the score to one control, one resource, or one control on one resource. You can also get one score per control for a resource.</p> <p>The operation returns either the current score or a history of scores, depending on whether you specify a time range.</p> <ul> <li> <p>Current score. If you don't specify <code>startTime</code> or <code>endTime</code>, and you use the default <code>LAST</code> statistic, the operation returns the most recent score as a single data point. Its <code>timestamp</code> is the time of the assessment that produced the score. This option isn't available when you get one score per control.</p> </li> <li> <p>History. If you specify <code>startTime</code>, <code>endTime</code>, or both, or you specify the <code>MAX</code>, <code>MIN</code>, or <code>AVG</code> statistic, the operation divides the time range into buckets of one hour or one day (set by <code>period</code>). It returns one data point for each bucket that has a score, newest first. Buckets with no score are left out, so match each data point to its bucket by <code>timestamp</code>.</p> </li> </ul> <p>Specify times in UTC. The time range includes <code>startTime</code> and excludes <code>endTime</code>.</p>

    Args:
        environment_arn: <p>The ARN of the environment.</p>
        project: <p>The project the request is scoped to.</p>
        framework: <p>The name of the framework.</p>
        framework_version: <p>The version of the framework.</p>
        control_id: <p>Narrows the series to one control's score over time. Omit for the whole framework's score over time.</p>
        resource_identifier: <p>Use this parameter to narrow the series to one resource. Specify the resource identifier that <code>ListDiscoveredResources</code> returns, which is its ARN if one exists, or its AWS Config resource type and resource ID (separated by a slash) otherwise. If you omit this parameter, the series reports the score for the whole project.</p>
        aggregation_level: <p>The level of the scores in each point. Specify one of the following values:</p> <ul> <li> <p> <code>FRAMEWORK</code> – One score for the framework. This is the default.</p> </li> <li> <p> <code>CONTROL</code> – One score for each control that has a score in the bucket. The controls can differ from one point to the next. Specify a window with <code>startTime</code> and <code>endTime</code>, or use the <code>MAX</code>, <code>MIN</code>, or <code>AVG</code> statistic.</p> </li> </ul> <p>You can specify this parameter only together with <code>resourceIdentifier</code>, and not together with <code>controlId</code>.</p>
        start_time: <p>The start of the window, inclusive, in UTC. The default is 7 days before <code>endTime</code>. To get the most recent score instead of a series, omit both <code>startTime</code> and <code>endTime</code>.</p>
        end_time: <p>The end of the window, exclusive, in UTC. The default is the time of the request. <code>endTime</code> must be later than <code>startTime</code>. To get the most recent score instead of a series, omit both <code>startTime</code> and <code>endTime</code>.</p>
        period: <p>The width of each time bucket. Valid values are <code>ONE_HOUR</code> and <code>ONE_DAY</code>. The default is <code>ONE_DAY</code>. This parameter has no effect when the response is the most recent score.</p>
        statistic: <p>How AWS Assurance combines the scores of the assessments in a bucket. Specify one of the following values:</p> <ul> <li> <p> <code>LAST</code> – The score of the most recent assessment in the bucket. If that assessment has no score, the bucket is left out. This is the default.</p> </li> <li> <p> <code>MAX</code> – The highest score in the bucket.</p> </li> <li> <p> <code>MIN</code> – The lowest score in the bucket.</p> </li> <li> <p> <code>AVG</code> – The average score in the bucket. Each assessment counts once, so assessments that run more often carry more weight.</p> </li> </ul> <p>At <code>CONTROL</code> aggregation, the statistic is applied to each control separately.</p>
        max_results: <p>The maximum number of points to return on one page. If you omit it, the operation uses its default page size.</p>
        next_token: <p>The token for the next page of results, from a previous response.</p>

    Raises:
        capo_assurance.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action. This error occurs when the request is unauthenticated, or is authenticated but lacks permission to invoke the operation.</p>
        capo_assurance.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred.</p>
        capo_assurance.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
        capo_assurance.errors.throttling_exception.ThrottlingException: <p>The request was throttled.</p>
        capo_assurance.errors.validation_exception.ValidationException: <p>The request failed validation.</p>
        capo_assurance.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Daily score history for one control on one S3 bucket
        Lists how a PCI DSS control has scored a payments bucket day by day, so the team can see whether a remediation took effect.

        >>> await client.list_assessment_outcomes(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', project='payments-prod', framework='AWS:PCI-DSS', framework_version='4', control_id='8.2.1', resource_identifier='arn:aws:s3:::payments-prod-transaction-logs', start_time='2026-03-12T00:00:00Z', end_time='2026-03-15T00:00:00Z', period='ONE_DAY', statistic='LAST')
        The current score for a project, with no window named
        Reads the score the most recent assessment produced, for a dashboard tile that shows where the project stands now.

        >>> await client.list_assessment_outcomes(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', project='payments-prod', framework='AWS:PCI-DSS', framework_version='4')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_assurance.types.list_assessment_outcomes_input.ListAssessmentOutcomesInput]",
    ) -> AsyncOperationResponse[
        "capo_assurance.types.list_assessment_outcomes_output.ListAssessmentOutcomesOutput"
    ]:
        import capo_assurance._operations.assurance.list_assessment_outcomes

        (
            output,
            http_response,
        ) = await capo_assurance._operations.assurance.list_assessment_outcomes.async_list_assessment_outcomes(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListAssessmentOutcomes")
    )
    input_: capo_assurance.types.list_assessment_outcomes_input.ListAssessmentOutcomesInput = {
        "environment_arn": environment_arn,
        "project": project,
        "framework": framework,
        "framework_version": framework_version,
    }
    if control_id is not None:
        input_["control_id"] = control_id
    if resource_identifier is not None:
        input_["resource_identifier"] = resource_identifier
    if aggregation_level is not None:
        input_["aggregation_level"] = aggregation_level
    if start_time is not None:
        input_["start_time"] = start_time
    if end_time is not None:
        input_["end_time"] = end_time
    if period is not None:
        input_["period"] = period
    if statistic is not None:
        input_["statistic"] = statistic
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output