Skip to content

create_snapshot

create_snapshot(
    namespace_name: str,
    snapshot_name: str,
    *,
    config_overrides: Optional[RedshiftServerlessClientConfig] = None,
    retention_period: Optional[int] = None,
    tags: Optional[TagList] = None,
) -> CreateSnapshotResponse

Creates a snapshot of all databases in a namespace. For more information about snapshots, see Working with snapshots and recovery points.

Parameters:

  • namespace_name (str) –

    The namespace to create a snapshot for.

  • snapshot_name (str) –

    The name of the snapshot.

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

    How long to retain the created snapshot.

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

    An array of Tag objects to associate with the snapshot.

Raises:

Source code in docs_src/capo_redshift_serverless/_services/redshift_serverless.py
def create_snapshot(
    self,
    namespace_name: str,
    snapshot_name: str,
    *,
    config_overrides: Optional[RedshiftServerlessClientConfig] = None,
    retention_period: Optional[int] = None,
    tags: Optional["capo_redshift_serverless.types.tag_list.TagList"] = None,
) -> (
    "capo_redshift_serverless.types.create_snapshot_response.CreateSnapshotResponse"
):
    """<p>Creates a snapshot of all databases in a namespace. For more information about snapshots, see <a href="https://docs.aws.amazon.com/redshift/latest/mgmt/serverless-snapshots-recovery-points.html"> Working with snapshots and recovery points</a>.</p>

    Args:
        namespace_name: <p>The namespace to create a snapshot for.</p>
        snapshot_name: <p>The name of the snapshot.</p>
        retention_period: <p>How long to retain the created snapshot.</p>
        tags: <p>An array of <a href="https://docs.aws.amazon.com/redshift-serverless/latest/APIReference/API_Tag.html">Tag objects</a> to associate with the 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.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service limit was exceeded.</p>
        capo_redshift_serverless.errors.too_many_tags_exception.TooManyTagsException: <p>The request exceeded the number of tags allowed for a resource.</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.create_snapshot_request.CreateSnapshotRequest]",
    ) -> OperationResponse[
        "capo_redshift_serverless.types.create_snapshot_response.CreateSnapshotResponse"
    ]:
        import capo_redshift_serverless._operations.redshift_serverless.create_snapshot

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSnapshot")
    )
    input_: capo_redshift_serverless.types.create_snapshot_request.CreateSnapshotRequest = {
        "namespace_name": namespace_name,
        "snapshot_name": snapshot_name,
    }
    if retention_period is not None:
        input_["retention_period"] = retention_period
    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