Skip to content

delete_namespace

delete_namespace(
    namespace_name: NamespaceName,
    *,
    config_overrides: Optional[RedshiftServerlessClientConfig] = None,
    final_snapshot_name: Optional[str] = None,
    final_snapshot_retention_period: Optional[int] = None,
) -> DeleteNamespaceResponse

Deletes a namespace from Amazon Redshift Serverless. Before you delete the namespace, you can create a final snapshot that has all of the data within the namespace.

Parameters:

  • namespace_name (NamespaceName) –

    The name of the namespace to delete.

  • final_snapshot_name (Optional[str], default: None ) –

    The name of the snapshot to be created before the namespace is deleted.

  • final_snapshot_retention_period (Optional[int], default: None ) –

    How long to retain the final snapshot.

Raises:

Source code in docs_src/capo_redshift_serverless/_services/redshift_serverless.py
def delete_namespace(
    self,
    namespace_name: "capo_redshift_serverless.types.namespace_name.NamespaceName",
    *,
    config_overrides: Optional[RedshiftServerlessClientConfig] = None,
    final_snapshot_name: Optional[str] = None,
    final_snapshot_retention_period: Optional[int] = None,
) -> "capo_redshift_serverless.types.delete_namespace_response.DeleteNamespaceResponse":
    """<p>Deletes a namespace from Amazon Redshift Serverless. Before you delete the namespace, you can create a final snapshot that has all of the data within the namespace.</p>

    Args:
        namespace_name: <p>The name of the namespace to delete.</p>
        final_snapshot_name: <p>The name of the snapshot to be created before the namespace is deleted.</p>
        final_snapshot_retention_period: <p>How long to retain the final snapshot.</p>

    Raises:
        capo_redshift_serverless.errors.conflict_exception.ConflictException: <p>The submitted action has conflicts.</p>
        capo_redshift_serverless.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_redshift_serverless.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_redshift_serverless.errors.validation_exception.ValidationException: <p>The input failed to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_redshift_serverless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_redshift_serverless.types.delete_namespace_request.DeleteNamespaceRequest]",
    ) -> OperationResponse[
        "capo_redshift_serverless.types.delete_namespace_response.DeleteNamespaceResponse"
    ]:
        import capo_redshift_serverless._operations.redshift_serverless.delete_namespace

        output, http_response = (
            capo_redshift_serverless._operations.redshift_serverless.delete_namespace.delete_namespace(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_redshift_serverless.types.delete_namespace_response.DeleteNamespaceResponse",
    ) -> dict[str, Any]:
        import capo_redshift_serverless.types.delete_namespace_response

        return capo_redshift_serverless.types.delete_namespace_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("DeleteNamespace", redact_output=_redact_output),
    )
    input_: capo_redshift_serverless.types.delete_namespace_request.DeleteNamespaceRequest = {
        "namespace_name": namespace_name
    }
    if final_snapshot_name is not None:
        input_["final_snapshot_name"] = final_snapshot_name
    if final_snapshot_retention_period is not None:
        input_["final_snapshot_retention_period"] = final_snapshot_retention_period

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