Skip to content

import_security_requirements async

import_security_requirements(
    pack_id: SecurityRequirementPackId,
    input: ImportSource,
    *,
    config_overrides: Optional[AsyncSecurityAgentClientConfig] = None,
) -> ImportSecurityRequirementsOutput

Imports security requirements from uploaded documents into a customer managed security requirement pack. The import process asynchronously extracts and generates structured security requirements from the provided source files.

Parameters:

  • pack_id (SecurityRequirementPackId) –

    The unique identifier of the security requirement pack to import requirements into.

  • input (ImportSource) –

    The import source containing the documents to extract security requirements from.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    The request could not be completed due to a conflict with the current state of the resource.

  • InternalServerException –

    An unexpected error occurred during the processing of your request.

  • ResourceNotFoundException –

    The specified resource was not found. Verify that the resource identifier is correct and that the resource exists in the specified agent space or account.

  • ServiceQuotaExceededException –

    The request exceeds a service quota. Review your current usage and request a quota increase if needed.

  • ThrottlingException –

    The request was denied due to request throttling.

  • ValidationException –

    The input fails to satisfy the constraints specified by the service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_securityagent/_services/async_security_agent.py
async def import_security_requirements(
    self,
    pack_id: "capo_securityagent.types.security_requirement_pack_id.SecurityRequirementPackId",
    input: "capo_securityagent.types.import_source.ImportSource",
    *,
    config_overrides: Optional[AsyncSecurityAgentClientConfig] = None,
) -> "capo_securityagent.types.import_security_requirements_output.ImportSecurityRequirementsOutput":
    """<p>Imports security requirements from uploaded documents into a customer managed security requirement pack. The import process asynchronously extracts and generates structured security requirements from the provided source files.</p>

    Args:
        pack_id: <p>The unique identifier of the security requirement pack to import requirements into.</p>
        input: <p>The import source containing the documents to extract security requirements from.</p>

    Raises:
        capo_securityagent.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_securityagent.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
        capo_securityagent.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during the processing of your request.</p>
        capo_securityagent.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found. Verify that the resource identifier is correct and that the resource exists in the specified agent space or account.</p>
        capo_securityagent.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request exceeds a service quota. Review your current usage and request a quota increase if needed.</p>
        capo_securityagent.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_securityagent.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service.</p>
        capo_securityagent.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_securityagent.types.import_security_requirements_input.ImportSecurityRequirementsInput]",
    ) -> AsyncOperationResponse[
        "capo_securityagent.types.import_security_requirements_output.ImportSecurityRequirementsOutput"
    ]:
        import capo_securityagent._operations.security_agent.import_security_requirements

        (
            output,
            http_response,
        ) = await capo_securityagent._operations.security_agent.import_security_requirements.async_import_security_requirements(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_securityagent.types.import_security_requirements_input.ImportSecurityRequirementsInput",
    ) -> dict[str, Any]:
        import capo_securityagent.types.import_security_requirements_input

        return capo_securityagent.types.import_security_requirements_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ImportSecurityRequirements", redact_input=_redact_input),
    )
    input_: capo_securityagent.types.import_security_requirements_input.ImportSecurityRequirementsInput = {
        "pack_id": pack_id,
        "input": input,
    }

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