Skip to content

create_db_cluster_snapshot

create_db_cluster_snapshot(
    *,
    config_overrides: Optional[DocDBClientConfig] = None,
    db_cluster_snapshot_identifier: Optional[String] = None,
    db_cluster_identifier: Optional[String] = None,
    tags: Optional[TagList] = None,
) -> CreateDBClusterSnapshotResult

Creates a snapshot of a cluster.

Parameters:

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

    The identifier of the cluster snapshot. This parameter is stored as a lowercase string.

    Constraints:

    • Must contain from 1 to 63 letters, numbers, or hyphens.

    • The first character must be a letter.

    • Cannot end with a hyphen or contain two consecutive hyphens.

    Example: my-cluster-snapshot1

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

    The identifier of the cluster to create a snapshot for. This parameter is not case sensitive.

    Constraints:

    • Must match the identifier of an existing DBCluster.

    Example: my-cluster

  • tags (Optional[TagList], default: None ) –

    The tags to be assigned to the cluster snapshot.

Raises:

Source code in docs_src/capo_docdb/_services/doc_db.py
def create_db_cluster_snapshot(
    self,
    *,
    config_overrides: Optional[DocDBClientConfig] = None,
    db_cluster_snapshot_identifier: Optional[
        "capo_docdb.types.string.String"
    ] = None,
    db_cluster_identifier: Optional["capo_docdb.types.string.String"] = None,
    tags: Optional["capo_docdb.types.tag_list.TagList"] = None,
) -> "capo_docdb.types.create_db_cluster_snapshot_result.CreateDBClusterSnapshotResult":
    """<p>Creates a snapshot of a cluster. </p>

    Args:
        db_cluster_snapshot_identifier: <p>The identifier of the cluster snapshot. This parameter is stored as a lowercase string.</p> <p>Constraints:</p> <ul> <li> <p>Must contain from 1 to 63 letters, numbers, or hyphens.</p> </li> <li> <p>The first character must be a letter.</p> </li> <li> <p>Cannot end with a hyphen or contain two consecutive hyphens. </p> </li> </ul> <p>Example: <code>my-cluster-snapshot1</code> </p>
        db_cluster_identifier: <p>The identifier of the cluster to create a snapshot for. This parameter is not case sensitive.</p> <p>Constraints:</p> <ul> <li> <p>Must match the identifier of an existing <code>DBCluster</code>.</p> </li> </ul> <p>Example: <code>my-cluster</code> </p>
        tags: <p>The tags to be assigned to the cluster snapshot.</p>

    Raises:
        capo_docdb.errors.db_cluster_not_found_fault.DBClusterNotFoundFault: <p> <code>DBClusterIdentifier</code> doesn't refer to an existing cluster. </p>
        capo_docdb.errors.db_cluster_snapshot_already_exists_fault.DBClusterSnapshotAlreadyExistsFault: <p>You already have a cluster snapshot with the given identifier.</p>
        capo_docdb.errors.invalid_db_cluster_snapshot_state_fault.InvalidDBClusterSnapshotStateFault: <p>The provided value isn't a valid cluster snapshot state.</p>
        capo_docdb.errors.invalid_db_cluster_state_fault.InvalidDBClusterStateFault: <p>The cluster isn't in a valid state.</p>
        capo_docdb.errors.snapshot_quota_exceeded_fault.SnapshotQuotaExceededFault: <p>The request would cause you to exceed the allowed number of snapshots.</p>
        capo_docdb.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_docdb.types.create_db_cluster_snapshot_message.CreateDBClusterSnapshotMessage]",
    ) -> OperationResponse[
        "capo_docdb.types.create_db_cluster_snapshot_result.CreateDBClusterSnapshotResult"
    ]:
        import capo_docdb._operations.amazon_rd_sv19.create_db_cluster_snapshot

        output, http_response = (
            capo_docdb._operations.amazon_rd_sv19.create_db_cluster_snapshot.create_db_cluster_snapshot(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDBClusterSnapshot")
    )
    input_: capo_docdb.types.create_db_cluster_snapshot_message.CreateDBClusterSnapshotMessage = {}
    if db_cluster_snapshot_identifier is not None:
        input_["db_cluster_snapshot_identifier"] = db_cluster_snapshot_identifier
    if db_cluster_identifier is not None:
        input_["db_cluster_identifier"] = db_cluster_identifier
    if tags is not None:
        input_["tags"] = tags

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