Skip to content

start_import_job async

start_import_job(
    knowledge_base_id: UuidOrArn,
    import_job_type: ImportJobType,
    upload_id: UploadId,
    *,
    config_overrides: Optional[AsyncQConnectClientConfig] = None,
    client_token: Optional[NonEmptyString] = None,
    metadata: Optional[ContentMetadata] = None,
    external_source_configuration: Optional[ExternalSourceConfiguration] = None,
) -> StartImportJobResponse

Start an asynchronous job to import Amazon Q in Connect resources from an uploaded source file. Before calling this API, use StartContentUpload to upload an asset that contains the resource data.

  • For importing Amazon Q in Connect quick responses, you need to upload a csv file including the quick responses. For information about how to format the csv file for importing quick responses, see Import quick responses.

Parameters:

  • knowledge_base_id (UuidOrArn) –

    The identifier of the knowledge base. Can be either the ID or the ARN. URLs cannot contain the ARN.

    • For importing Amazon Q in Connect quick responses, this should be a QUICK_RESPONSES type knowledge base.

  • import_job_type (ImportJobType) –

    The type of the import job.

    • For importing quick response resource, set the value to QUICK_RESPONSES.

  • upload_id (UploadId) –

    A pointer to the uploaded asset. This value is returned by StartContentUpload.

  • client_token (Optional[NonEmptyString], default: None ) –

    The tags used to organize, track, or control access for this resource.

  • metadata (Optional[ContentMetadata], default: None ) –

    The metadata fields of the imported Amazon Q in Connect resources.

  • external_source_configuration (Optional[ExternalSourceConfiguration], default: None ) –

    The configuration information of the external source that the resource data are imported from.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    The request could not be processed because of conflict in the current state of the resource. For example, if you're using a Create API (such as CreateAssistant) that accepts name, a conflicting resource (usually with the same name) is being created or mutated.

  • ResourceNotFoundException –

    The specified resource does not exist.

  • ServiceQuotaExceededException –

    You've exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use service quotas to request a service quota increase.

  • UnauthorizedException –

    You do not have permission to perform this action.

  • ValidationException –

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

  • UnknownServiceError –

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

Source code in docs_src/capo_qconnect/_services/async_q_connect.py
async def start_import_job(
    self,
    knowledge_base_id: "capo_qconnect.types.uuid_or_arn.UuidOrArn",
    import_job_type: "capo_qconnect.types.import_job_type.ImportJobType",
    upload_id: "capo_qconnect.types.upload_id.UploadId",
    *,
    config_overrides: Optional[AsyncQConnectClientConfig] = None,
    client_token: Optional[
        "capo_qconnect.types.non_empty_string.NonEmptyString"
    ] = None,
    metadata: Optional[
        "capo_qconnect.types.content_metadata.ContentMetadata"
    ] = None,
    external_source_configuration: Optional[
        "capo_qconnect.types.external_source_configuration.ExternalSourceConfiguration"
    ] = None,
) -> "capo_qconnect.types.start_import_job_response.StartImportJobResponse":
    """<p>Start an asynchronous job to import Amazon Q in Connect resources from an uploaded source file. Before calling this API, use <a href="https://docs.aws.amazon.com/wisdom/latest/APIReference/API_StartContentUpload.html">StartContentUpload</a> to upload an asset that contains the resource data.</p> <ul> <li> <p>For importing Amazon Q in Connect quick responses, you need to upload a csv file including the quick responses. For information about how to format the csv file for importing quick responses, see <a href="https://docs.aws.amazon.com/console/connect/quick-responses/add-data">Import quick responses</a>.</p> </li> </ul>

    Args:
        knowledge_base_id: <p>The identifier of the knowledge base. Can be either the ID or the ARN. URLs cannot contain the ARN.</p> <ul> <li> <p>For importing Amazon Q in Connect quick responses, this should be a <code>QUICK_RESPONSES</code> type knowledge base.</p> </li> </ul>
        import_job_type: <p>The type of the import job.</p> <ul> <li> <p>For importing quick response resource, set the value to <code>QUICK_RESPONSES</code>.</p> </li> </ul>
        upload_id: <p>A pointer to the uploaded asset. This value is returned by <a href="https://docs.aws.amazon.com/wisdom/latest/APIReference/API_StartContentUpload.html">StartContentUpload</a>.</p>
        client_token: <p>The tags used to organize, track, or control access for this resource.</p>
        metadata: <p>The metadata fields of the imported Amazon Q in Connect resources.</p>
        external_source_configuration: <p>The configuration information of the external source that the resource data are imported from.</p>

    Raises:
        capo_qconnect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_qconnect.errors.conflict_exception.ConflictException: <p>The request could not be processed because of conflict in the current state of the resource. For example, if you're using a <code>Create</code> API (such as <code>CreateAssistant</code>) that accepts name, a conflicting resource (usually with the same name) is being created or mutated.</p>
        capo_qconnect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_qconnect.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You've exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use service quotas to request a service quota increase.</p>
        capo_qconnect.errors.unauthorized_exception.UnauthorizedException: <p>You do not have permission to perform this action.</p>
        capo_qconnect.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by a service.</p>
        capo_qconnect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_qconnect.types.start_import_job_request.StartImportJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_qconnect.types.start_import_job_response.StartImportJobResponse"
    ]:
        import capo_qconnect._operations.wisdom_service.start_import_job

        (
            output,
            http_response,
        ) = await capo_qconnect._operations.wisdom_service.start_import_job.async_start_import_job(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_qconnect.types.start_import_job_response.StartImportJobResponse",
    ) -> dict[str, Any]:
        import capo_qconnect.types.start_import_job_response

        return capo_qconnect.types.start_import_job_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("StartImportJob", redact_output=_redact_output),
    )
    input_: capo_qconnect.types.start_import_job_request.StartImportJobRequest = {
        "knowledge_base_id": knowledge_base_id,
        "import_job_type": import_job_type,
        "upload_id": upload_id,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if metadata is not None:
        input_["metadata"] = metadata
    if external_source_configuration is not None:
        input_["external_source_configuration"] = external_source_configuration

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