Skip to content

modify_snapshot_copy_retention_period

modify_snapshot_copy_retention_period(
    *,
    config_overrides: Optional[RedshiftClientConfig] = None,
    cluster_identifier: Optional[String] = None,
    retention_period: Optional[Integer] = None,
    manual: Optional[Boolean] = None,
) -> ModifySnapshotCopyRetentionPeriodResult

Modifies the number of days to retain snapshots in the destination Amazon Web Services Region after they are copied from the source Amazon Web Services Region. By default, this operation only changes the retention period of copied automated snapshots. The retention periods for both new and existing copied automated snapshots are updated with the new retention period. You can set the manual option to change only the retention periods of copied manual snapshots. If you set this option, only newly copied manual snapshots have the new retention period.

Parameters:

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

    The unique identifier of the cluster for which you want to change the retention period for either automated or manual snapshots that are copied to a destination Amazon Web Services Region.

    Constraints: Must be the valid name of an existing cluster that has cross-region snapshot copy enabled.

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

    The number of days to retain automated snapshots in the destination Amazon Web Services Region after they are copied from the source Amazon Web Services Region.

    By default, this only changes the retention period of copied automated snapshots.

    If you decrease the retention period for automated snapshots that are copied to a destination Amazon Web Services Region, Amazon Redshift deletes any existing automated snapshots that were copied to the destination Amazon Web Services Region and that fall outside of the new retention period.

    Constraints: Must be at least 1 and no more than 35 for automated snapshots.

    If you specify the manual option, only newly copied manual snapshots will have the new retention period.

    If you specify the value of -1 newly copied manual snapshots are retained indefinitely.

    Constraints: The number of days must be either -1 or an integer between 1 and 3,653 for manual snapshots.

  • manual (Optional[Boolean], default: None ) –

    Indicates whether to apply the snapshot retention period to newly copied manual snapshots instead of automated snapshots.

Raises:

Source code in docs_src/capo_redshift/_services/redshift.py
def modify_snapshot_copy_retention_period(
    self,
    *,
    config_overrides: Optional[RedshiftClientConfig] = None,
    cluster_identifier: Optional["capo_redshift.types.string.String"] = None,
    retention_period: Optional["capo_redshift.types.integer.Integer"] = None,
    manual: Optional["capo_redshift.types.boolean.Boolean"] = None,
) -> "capo_redshift.types.modify_snapshot_copy_retention_period_result.ModifySnapshotCopyRetentionPeriodResult":
    """<p>Modifies the number of days to retain snapshots in the destination Amazon Web Services Region after they are copied from the source Amazon Web Services Region. By default, this operation only changes the retention period of copied automated snapshots. The retention periods for both new and existing copied automated snapshots are updated with the new retention period. You can set the manual option to change only the retention periods of copied manual snapshots. If you set this option, only newly copied manual snapshots have the new retention period. </p>

    Args:
        cluster_identifier: <p>The unique identifier of the cluster for which you want to change the retention period for either automated or manual snapshots that are copied to a destination Amazon Web Services Region.</p> <p>Constraints: Must be the valid name of an existing cluster that has cross-region snapshot copy enabled.</p>
        retention_period: <p>The number of days to retain automated snapshots in the destination Amazon Web Services Region after they are copied from the source Amazon Web Services Region.</p> <p>By default, this only changes the retention period of copied automated snapshots. </p> <p>If you decrease the retention period for automated snapshots that are copied to a destination Amazon Web Services Region, Amazon Redshift deletes any existing automated snapshots that were copied to the destination Amazon Web Services Region and that fall outside of the new retention period.</p> <p>Constraints: Must be at least 1 and no more than 35 for automated snapshots. </p> <p>If you specify the <code>manual</code> option, only newly copied manual snapshots will have the new retention period. </p> <p>If you specify the value of -1 newly copied manual snapshots are retained indefinitely.</p> <p>Constraints: The number of days must be either -1 or an integer between 1 and 3,653 for manual snapshots.</p>
        manual: <p>Indicates whether to apply the snapshot retention period to newly copied manual snapshots instead of automated snapshots.</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.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.snapshot_copy_disabled_fault.SnapshotCopyDisabledFault: <p>Cross-region snapshot copy was temporarily disabled. Try your request again.</p>
        capo_redshift.errors.unauthorized_operation.UnauthorizedOperation: <p>Your account is not authorized to perform the requested operation.</p>
        capo_redshift.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_redshift.types.modify_snapshot_copy_retention_period_message.ModifySnapshotCopyRetentionPeriodMessage]",
    ) -> OperationResponse[
        "capo_redshift.types.modify_snapshot_copy_retention_period_result.ModifySnapshotCopyRetentionPeriodResult"
    ]:
        import capo_redshift._operations.redshift_service_version20121201.modify_snapshot_copy_retention_period

        output, http_response = (
            capo_redshift._operations.redshift_service_version20121201.modify_snapshot_copy_retention_period.modify_snapshot_copy_retention_period(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_redshift.types.modify_snapshot_copy_retention_period_result.ModifySnapshotCopyRetentionPeriodResult",
    ) -> dict[str, Any]:
        import capo_redshift.types.modify_snapshot_copy_retention_period_result

        return capo_redshift.types.modify_snapshot_copy_retention_period_result.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "ModifySnapshotCopyRetentionPeriod", redact_output=_redact_output
        ),
    )
    input_: capo_redshift.types.modify_snapshot_copy_retention_period_message.ModifySnapshotCopyRetentionPeriodMessage = {}
    if cluster_identifier is not None:
        input_["cluster_identifier"] = cluster_identifier
    if retention_period is not None:
        input_["retention_period"] = retention_period
    if manual is not None:
        input_["manual"] = manual

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