Skip to content

create_notebook

create_notebook(
    domain_identifier: DomainId,
    owning_project_identifier: ProjectId,
    name: NotebookName,
    *,
    config_overrides: Optional[DataZoneClientConfig] = None,
    description: Optional[Description] = None,
    type: Optional[NotebookType] = None,
    metadata: Optional[Metadata] = None,
    parameters: Optional[Parameters] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateNotebookOutput

Creates a notebook in Amazon SageMaker Unified Studio. A notebook is a collaborative document within a project that contains code cells for interactive computing.

Parameters:

  • domain_identifier (DomainId) –

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

  • owning_project_identifier (ProjectId) –

    The identifier of the project that owns the notebook.

  • name (NotebookName) –

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

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

    The description of the notebook.

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

    The type of the notebook.

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

    The metadata for the notebook, specified as key-value pairs. You can specify up to 50 entries, with keys up to 128 characters and values up to 1024 characters.

  • parameters (Optional[Parameters], default: None ) –

    The sensitive parameters for the notebook, specified as key-value pairs. You can specify up to 50 entries, with keys up to 128 characters and values up to 1024 characters.

  • 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/data_zone.py
def create_notebook(
    self,
    domain_identifier: "capo_datazone.types.domain_id.DomainId",
    owning_project_identifier: "capo_datazone.types.project_id.ProjectId",
    name: "capo_datazone.types.notebook_name.NotebookName",
    *,
    config_overrides: Optional[DataZoneClientConfig] = None,
    description: Optional["capo_datazone.types.description.Description"] = None,
    type: Optional["capo_datazone.types.notebook_type.NotebookType"] = None,
    metadata: Optional["capo_datazone.types.metadata.Metadata"] = None,
    parameters: Optional["capo_datazone.types.parameters.Parameters"] = None,
    client_token: Optional["capo_datazone.types.client_token.ClientToken"] = None,
) -> "capo_datazone.types.create_notebook_output.CreateNotebookOutput":
    """<p>Creates a <a href="https://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/notebooks.html">notebook</a> in Amazon SageMaker Unified Studio. A notebook is a collaborative document within a project that contains code cells for interactive computing.</p>

    Args:
        domain_identifier: <p>The identifier of the Amazon SageMaker Unified Studio domain in which to create the notebook.</p>
        owning_project_identifier: <p>The identifier of the project that owns the notebook.</p>
        name: <p>The name of the notebook. The name must be between 1 and 256 characters.</p>
        description: <p>The description of the notebook.</p>
        type: <p>The type of the notebook.</p>
        metadata: <p>The metadata for the notebook, specified as key-value pairs. You can specify up to 50 entries, with keys up to 128 characters and values up to 1024 characters.</p>
        parameters: <p>The sensitive parameters for the notebook, specified as key-value pairs. You can specify up to 50 entries, with keys up to 128 characters and values up to 1024 characters.</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.
    """

    def _handler(
        req: "OperationRequest[capo_datazone.types.create_notebook_input.CreateNotebookInput]",
    ) -> OperationResponse[
        "capo_datazone.types.create_notebook_output.CreateNotebookOutput"
    ]:
        import capo_datazone._operations.data_zone.create_notebook

        output, http_response = (
            capo_datazone._operations.data_zone.create_notebook.create_notebook(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

        return capo_datazone.types.create_notebook_input.redact_sensitive(input_)

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

        return capo_datazone.types.create_notebook_output.redact_sensitive(output)

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

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output