Skip to content

delete_cluster async

delete_cluster(
    cluster_name: String,
    *,
    config_overrides: Optional[AsyncMemoryDBClientConfig] = None,
    multi_region_cluster_name: Optional[String] = None,
    final_snapshot_name: Optional[String] = None,
) -> DeleteClusterResponse

Deletes a cluster. It also deletes all associated nodes and node endpoints.

CreateSnapshot permission is required to create a final snapshot. Without this permission, the API call will fail with an Access Denied exception.

Parameters:

  • cluster_name (String) –

    The name of the cluster to be deleted

  • multi_region_cluster_name (Optional[String], default: None ) –

    The name of the multi-Region cluster to be deleted.

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

    The user-supplied name of a final cluster snapshot. This is the unique name that identifies the snapshot. MemoryDB creates the snapshot, and then deletes the cluster immediately afterward.

Raises:

Source code in docs_src/capo_memorydb/_services/async_memory_db.py
async def delete_cluster(
    self,
    cluster_name: "capo_memorydb.types.string.String",
    *,
    config_overrides: Optional[AsyncMemoryDBClientConfig] = None,
    multi_region_cluster_name: Optional["capo_memorydb.types.string.String"] = None,
    final_snapshot_name: Optional["capo_memorydb.types.string.String"] = None,
) -> "capo_memorydb.types.delete_cluster_response.DeleteClusterResponse":
    """<p>Deletes a cluster. It also deletes all associated nodes and node endpoints.</p> <note> <p> <code>CreateSnapshot</code> permission is required to create a final snapshot. Without this permission, the API call will fail with an <code>Access Denied</code> exception.</p> </note>

    Args:
        cluster_name: <p>The name of the cluster to be deleted</p>
        multi_region_cluster_name: <p>The name of the multi-Region cluster to be deleted.</p>
        final_snapshot_name: <p>The user-supplied name of a final cluster snapshot. This is the unique name that identifies the snapshot. MemoryDB creates the snapshot, and then deletes the cluster immediately afterward.</p>

    Raises:
        capo_memorydb.errors.cluster_not_found_fault.ClusterNotFoundFault: <p>The specified cluster does not exist.</p>
        capo_memorydb.errors.invalid_cluster_state_fault.InvalidClusterStateFault: <p>The cluster is not in a valid state for the requested operation.</p>
        capo_memorydb.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>The specified parameter combination is not valid.</p>
        capo_memorydb.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The specified parameter value is not valid.</p>
        capo_memorydb.errors.service_linked_role_not_found_fault.ServiceLinkedRoleNotFoundFault: <p>The required service-linked role was not found.</p>
        capo_memorydb.errors.snapshot_already_exists_fault.SnapshotAlreadyExistsFault: <p>A snapshot with the specified name already exists.</p>
        capo_memorydb.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_memorydb.types.delete_cluster_request.DeleteClusterRequest]",
    ) -> AsyncOperationResponse[
        "capo_memorydb.types.delete_cluster_response.DeleteClusterResponse"
    ]:
        import capo_memorydb._operations.amazon_memory_db.delete_cluster

        (
            output,
            http_response,
        ) = await capo_memorydb._operations.amazon_memory_db.delete_cluster.async_delete_cluster(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteCluster")
    )
    input_: capo_memorydb.types.delete_cluster_request.DeleteClusterRequest = {
        "cluster_name": cluster_name
    }
    if multi_region_cluster_name is not None:
        input_["multi_region_cluster_name"] = multi_region_cluster_name
    if final_snapshot_name is not None:
        input_["final_snapshot_name"] = final_snapshot_name

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