Deletes a previously provisioned cluster without its final snapshot being created. A successful response from the web service indicates that the request was received correctly. Use DescribeClusters to monitor the status of the deletion. The delete operation cannot be canceled or reverted once submitted. For more information about managing clusters, go to Amazon Redshift Clusters in the Amazon Redshift Cluster Management Guide.
If you want to shut down the cluster and retain it for future use, set SkipFinalClusterSnapshot to false and specify a name for FinalClusterSnapshotIdentifier. You can later restore this snapshot to resume using the cluster. If a final cluster snapshot is requested, the status of the cluster will be "final-snapshot" while the snapshot is being taken, then it's "deleting" once Amazon Redshift begins deleting the cluster.
For more information about managing clusters, go to Amazon Redshift Clusters in the Amazon Redshift Cluster Management Guide.
Parameters:
-
cluster_identifier
(Optional[String], default:
None
)
–
The identifier of the cluster to be deleted.
Constraints:
-
Must contain lowercase characters.
-
Must contain from 1 to 63 alphanumeric characters or hyphens.
-
First character must be a letter.
-
Cannot end with a hyphen or contain two consecutive hyphens.
-
skip_final_cluster_snapshot
(Optional[Boolean], default:
None
)
–
Determines whether a final snapshot of the cluster is created before Amazon Redshift deletes the cluster. If true, a final cluster snapshot is not created. If false, a final cluster snapshot is created before the cluster is deleted.
The FinalClusterSnapshotIdentifier parameter must be specified if SkipFinalClusterSnapshot is false.
Default: false
-
final_cluster_snapshot_identifier
(Optional[String], default:
None
)
–
The identifier of the final snapshot that is to be created immediately before deleting the cluster. If this parameter is provided, SkipFinalClusterSnapshot must be false.
Constraints:
-
Must be 1 to 255 alphanumeric characters.
-
First character must be a letter.
-
Cannot end with a hyphen or contain two consecutive hyphens.
-
final_cluster_snapshot_retention_period
(Optional[IntegerOptional], default:
None
)
–
The number of days that a manual snapshot is retained. If the value is -1, the manual snapshot is retained indefinitely.
The value must be either -1 or an integer between 1 and 3,653.
The default value is -1.
Raises:
Source code in docs_src/capo_redshift/_services/redshift.py
| def delete_cluster(
self,
*,
config_overrides: Optional[RedshiftClientConfig] = None,
cluster_identifier: Optional["capo_redshift.types.string.String"] = None,
skip_final_cluster_snapshot: Optional[
"capo_redshift.types.boolean.Boolean"
] = None,
final_cluster_snapshot_identifier: Optional[
"capo_redshift.types.string.String"
] = None,
final_cluster_snapshot_retention_period: Optional[
"capo_redshift.types.integer_optional.IntegerOptional"
] = None,
) -> "capo_redshift.types.delete_cluster_result.DeleteClusterResult":
"""<p>Deletes a previously provisioned cluster without its final snapshot being created. A successful response from the web service indicates that the request was received correctly. Use <a>DescribeClusters</a> to monitor the status of the deletion. The delete operation cannot be canceled or reverted once submitted. For more information about managing clusters, go to <a href="https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-clusters.html">Amazon Redshift Clusters</a> in the <i>Amazon Redshift Cluster Management Guide</i>.</p> <p>If you want to shut down the cluster and retain it for future use, set <i>SkipFinalClusterSnapshot</i> to <code>false</code> and specify a name for <i>FinalClusterSnapshotIdentifier</i>. You can later restore this snapshot to resume using the cluster. If a final cluster snapshot is requested, the status of the cluster will be "final-snapshot" while the snapshot is being taken, then it's "deleting" once Amazon Redshift begins deleting the cluster. </p> <p> For more information about managing clusters, go to <a href="https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-clusters.html">Amazon Redshift Clusters</a> in the <i>Amazon Redshift Cluster Management Guide</i>.</p>
Args:
cluster_identifier: <p>The identifier of the cluster to be deleted.</p> <p>Constraints:</p> <ul> <li> <p>Must contain lowercase characters.</p> </li> <li> <p>Must contain from 1 to 63 alphanumeric characters or hyphens.</p> </li> <li> <p>First character must be a letter.</p> </li> <li> <p>Cannot end with a hyphen or contain two consecutive hyphens.</p> </li> </ul>
skip_final_cluster_snapshot: <p>Determines whether a final snapshot of the cluster is created before Amazon Redshift deletes the cluster. If <code>true</code>, a final cluster snapshot is not created. If <code>false</code>, a final cluster snapshot is created before the cluster is deleted. </p> <note> <p>The <i>FinalClusterSnapshotIdentifier</i> parameter must be specified if <i>SkipFinalClusterSnapshot</i> is <code>false</code>.</p> </note> <p>Default: <code>false</code> </p>
final_cluster_snapshot_identifier: <p>The identifier of the final snapshot that is to be created immediately before deleting the cluster. If this parameter is provided, <i>SkipFinalClusterSnapshot</i> must be <code>false</code>. </p> <p>Constraints:</p> <ul> <li> <p>Must be 1 to 255 alphanumeric characters.</p> </li> <li> <p>First character must be a letter.</p> </li> <li> <p>Cannot end with a hyphen or contain two consecutive hyphens.</p> </li> </ul>
final_cluster_snapshot_retention_period: <p>The number of days that a manual snapshot is retained. If the value is -1, the manual snapshot is retained indefinitely.</p> <p>The value must be either -1 or an integer between 1 and 3,653.</p> <p>The default value is -1.</p>
Raises:
capo_redshift.errors.cluster_not_found_fault.ClusterNotFoundFault: <p>The <code>ClusterIdentifier</code> parameter does not refer to an existing cluster. </p>
capo_redshift.errors.cluster_snapshot_already_exists_fault.ClusterSnapshotAlreadyExistsFault: <p>The value specified as a snapshot identifier is already used by an existing snapshot.</p>
capo_redshift.errors.cluster_snapshot_quota_exceeded_fault.ClusterSnapshotQuotaExceededFault: <p>The request would result in the user exceeding the allowed number of cluster snapshots.</p>
capo_redshift.errors.invalid_cluster_state_fault.InvalidClusterStateFault: <p>The specified cluster is not in the <code>available</code> state. </p>
capo_redshift.errors.invalid_retention_period_fault.InvalidRetentionPeriodFault: <p>The retention period specified is either in the past or is not a valid value.</p> <p>The value must be either -1 or an integer between 1 and 3,653.</p>
capo_redshift.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_redshift.types.delete_cluster_message.DeleteClusterMessage]",
) -> OperationResponse[
"capo_redshift.types.delete_cluster_result.DeleteClusterResult"
]:
import capo_redshift._operations.redshift_service_version20121201.delete_cluster
output, http_response = (
capo_redshift._operations.redshift_service_version20121201.delete_cluster.delete_cluster(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_redshift.types.delete_cluster_result.DeleteClusterResult",
) -> dict[str, Any]:
import capo_redshift.types.delete_cluster_result
return capo_redshift.types.delete_cluster_result.redact_sensitive(output)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("DeleteCluster", redact_output=_redact_output),
)
input_: capo_redshift.types.delete_cluster_message.DeleteClusterMessage = {}
if cluster_identifier is not None:
input_["cluster_identifier"] = cluster_identifier
if skip_final_cluster_snapshot is not None:
input_["skip_final_cluster_snapshot"] = skip_final_cluster_snapshot
if final_cluster_snapshot_identifier is not None:
input_["final_cluster_snapshot_identifier"] = (
final_cluster_snapshot_identifier
)
if final_cluster_snapshot_retention_period is not None:
input_["final_cluster_snapshot_retention_period"] = (
final_cluster_snapshot_retention_period
)
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|