Skip to content

create_assessment async

create_assessment(
    name: AssessmentName,
    assessment_reports_destination: AssessmentReportsDestination,
    scope: Scope,
    roles: Roles,
    framework_id: UUID,
    *,
    config_overrides: Optional[AsyncAuditManagerClientConfig] = None,
    description: Optional[AssessmentDescription] = None,
    tags: Optional[TagMap] = None,
) -> CreateAssessmentResponse

Creates an assessment in Audit Manager.

Parameters:

  • name (AssessmentName) –

    The name of the assessment to be created.

  • description (Optional[AssessmentDescription], default: None ) –

    The optional description of the assessment to be created.

  • assessment_reports_destination (AssessmentReportsDestination) –

    The assessment report storage destination for the assessment that's being created.

  • roles (Roles) –

    The list of roles for the assessment.

  • framework_id (UUID) –

    The identifier for the framework that the assessment will be created from.

  • tags (Optional[TagMap], default: None ) –

    The tags that are associated with the assessment.

Raises:

Source code in docs_src/capo_auditmanager/_services/async_audit_manager.py
async def create_assessment(
    self,
    name: "capo_auditmanager.types.assessment_name.AssessmentName",
    assessment_reports_destination: "capo_auditmanager.types.assessment_reports_destination.AssessmentReportsDestination",
    scope: "capo_auditmanager.types.scope.Scope",
    roles: "capo_auditmanager.types.roles.Roles",
    framework_id: "capo_auditmanager.types.uuid.UUID",
    *,
    config_overrides: Optional[AsyncAuditManagerClientConfig] = None,
    description: Optional[
        "capo_auditmanager.types.assessment_description.AssessmentDescription"
    ] = None,
    tags: Optional["capo_auditmanager.types.tag_map.TagMap"] = None,
) -> "capo_auditmanager.types.create_assessment_response.CreateAssessmentResponse":
    """<p> Creates an assessment in Audit Manager. </p>

    Args:
        name: <p> The name of the assessment to be created. </p>
        description: <p> The optional description of the assessment to be created. </p>
        assessment_reports_destination: <p> The assessment report storage destination for the assessment that's being created. </p>
        roles: <p> The list of roles for the assessment. </p>
        framework_id: <p> The identifier for the framework that the assessment will be created from. </p>
        tags: <p> The tags that are associated with the assessment. </p>

    Raises:
        capo_auditmanager.errors.access_denied_exception.AccessDeniedException: <p> Your account isn't registered with Audit Manager. Check the delegated administrator setup on the Audit Manager settings page, and try again. </p>
        capo_auditmanager.errors.internal_server_exception.InternalServerException: <p> An internal service error occurred during the processing of your request. Try again later. </p>
        capo_auditmanager.errors.resource_not_found_exception.ResourceNotFoundException: <p> The resource that's specified in the request can't be found. </p>
        capo_auditmanager.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You've reached your account quota for this resource type. To perform the requested action, delete some existing resources or <a href="https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html">request a quota increase</a> from the Service Quotas console. For a list of Audit Manager service quotas, see <a href="https://docs.aws.amazon.com/audit-manager/latest/userguide/service-quotas.html">Quotas and restrictions for Audit Manager</a>.</p>
        capo_auditmanager.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_auditmanager.errors.validation_exception.ValidationException: <p> The request has invalid or missing parameters. </p>
        capo_auditmanager.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_auditmanager.types.create_assessment_request.CreateAssessmentRequest]",
    ) -> AsyncOperationResponse[
        "capo_auditmanager.types.create_assessment_response.CreateAssessmentResponse"
    ]:
        import capo_auditmanager._operations.bedrock_assessment_manager_lambda.create_assessment

        (
            output,
            http_response,
        ) = await capo_auditmanager._operations.bedrock_assessment_manager_lambda.create_assessment.async_create_assessment(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_auditmanager.types.create_assessment_request.CreateAssessmentRequest",
    ) -> dict[str, Any]:
        import capo_auditmanager.types.create_assessment_request

        return capo_auditmanager.types.create_assessment_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_auditmanager.types.create_assessment_response.CreateAssessmentResponse",
    ) -> dict[str, Any]:
        import capo_auditmanager.types.create_assessment_response

        return capo_auditmanager.types.create_assessment_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateAssessment",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_auditmanager.types.create_assessment_request.CreateAssessmentRequest = {
        "name": name,
        "assessment_reports_destination": assessment_reports_destination,
        "scope": scope,
        "roles": roles,
        "framework_id": framework_id,
    }
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags

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