Skip to content

start_notebook_import async

start_notebook_import(
    domain_identifier: DomainId,
    owning_project_identifier: ProjectId,
    source_location: SourceLocation,
    name: NotebookName,
    *,
    config_overrides: Optional[AsyncDataZoneClientConfig] = None,
    description: Optional[Description] = None,
    type: Optional[NotebookType] = None,
    client_token: Optional[ClientToken] = None,
) -> StartNotebookImportOutput

Starts a notebook import in Amazon SageMaker Unified Studio. This operation imports a notebook from an Amazon Simple Storage Service location into a project.

Parameters:

  • domain_identifier (DomainId) –

    The identifier of the Amazon SageMaker Unified Studio domain in which to import the notebook.

  • owning_project_identifier (ProjectId) –

    The identifier of the project that will own the imported notebook.

  • source_location (SourceLocation) –

    The source location of the notebook to import. Specify either a single Amazon Simple Storage Service URI, or a list of objects to import as the notebook's cells.

  • name (NotebookName) –

    The name of the imported notebook. The name must be between 1 and 256 characters.

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

    The description of the imported notebook.

  • type (Optional[NotebookType], default: None ) –

    The type of the notebook to import. If not specified, defaults to DATA.

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

    A unique, case-sensitive identifier to ensure idempotency of the request. This field is automatically populated if not provided.

Raises:

Source code in docs_src/capo_datazone/_services/async_data_zone.py
async def start_notebook_import(
    self,
    domain_identifier: "capo_datazone.types.domain_id.DomainId",
    owning_project_identifier: "capo_datazone.types.project_id.ProjectId",
    source_location: "capo_datazone.types.source_location.SourceLocation",
    name: "capo_datazone.types.notebook_name.NotebookName",
    *,
    config_overrides: Optional[AsyncDataZoneClientConfig] = None,
    description: Optional["capo_datazone.types.description.Description"] = None,
    type: Optional["capo_datazone.types.notebook_type.NotebookType"] = None,
    client_token: Optional["capo_datazone.types.client_token.ClientToken"] = None,
) -> "capo_datazone.types.start_notebook_import_output.StartNotebookImportOutput":
    """<p>Starts a notebook import in Amazon SageMaker Unified Studio. This operation imports a notebook from an Amazon Simple Storage Service location into a project.</p>

    Args:
        domain_identifier: <p>The identifier of the Amazon SageMaker Unified Studio domain in which to import the notebook.</p>
        owning_project_identifier: <p>The identifier of the project that will own the imported notebook.</p>
        source_location: <p>The source location of the notebook to import. Specify either a single Amazon Simple Storage Service URI, or a list of objects to import as the notebook's cells.</p>
        name: <p>The name of the imported notebook. The name must be between 1 and 256 characters.</p>
        description: <p>The description of the imported notebook.</p>
        type: <p>The type of the notebook to import. If not specified, defaults to <code>DATA</code>.</p>
        client_token: <p>A unique, case-sensitive identifier to ensure idempotency of the request. This field is automatically populated if not provided.</p>

    Raises:
        capo_datazone.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_datazone.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_datazone.errors.unauthorized_exception.UnauthorizedException: <p>You do not have permission to perform this action.</p>
        capo_datazone.errors.conflict_exception.ConflictException: <p>There is a conflict while performing this action.</p>
        capo_datazone.errors.internal_server_exception.InternalServerException: <p>The request has failed because of an unknown error, exception or failure.</p>
        capo_datazone.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource cannot be found.</p>
        capo_datazone.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request has exceeded the specified service quota.</p>
        capo_datazone.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the Amazon Web Services service.</p>
        capo_datazone.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_datazone.types.start_notebook_import_input.StartNotebookImportInput]",
    ) -> AsyncOperationResponse[
        "capo_datazone.types.start_notebook_import_output.StartNotebookImportOutput"
    ]:
        import capo_datazone._operations.data_zone.start_notebook_import

        (
            output,
            http_response,
        ) = await capo_datazone._operations.data_zone.start_notebook_import.async_start_notebook_import(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_datazone.types.start_notebook_import_input.StartNotebookImportInput",
    ) -> dict[str, Any]:
        import capo_datazone.types.start_notebook_import_input

        return capo_datazone.types.start_notebook_import_input.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_datazone.types.start_notebook_import_output.StartNotebookImportOutput",
    ) -> dict[str, Any]:
        import capo_datazone.types.start_notebook_import_output

        return capo_datazone.types.start_notebook_import_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "StartNotebookImport",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_datazone.types.start_notebook_import_input.StartNotebookImportInput = {
        "domain_identifier": domain_identifier,
        "owning_project_identifier": owning_project_identifier,
        "source_location": source_location,
        "name": name,
    }
    if description is not None:
        input_["description"] = description
    if type is not None:
        input_["type"] = type
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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