Modifies the settings for a snapshot.
This exanmple modifies the manual retention period setting for a cluster snapshot.
Parameters:
-
snapshot_identifier
(Optional[String], default:
None
)
–
The identifier of the snapshot whose setting you want to modify.
-
manual_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.
If the manual snapshot falls outside of the new retention period, you can specify the force option to immediately delete the snapshot.
The value must be either -1 or an integer between 1 and 3,653.
-
force
(Optional[Boolean], default:
None
)
–
A Boolean option to override an exception if the retention period has already passed.
Raises:
Source code in docs_src/capo_redshift/_services/redshift.py
| def modify_cluster_snapshot(
self,
*,
config_overrides: Optional[RedshiftClientConfig] = None,
snapshot_identifier: Optional["capo_redshift.types.string.String"] = None,
manual_snapshot_retention_period: Optional[
"capo_redshift.types.integer_optional.IntegerOptional"
] = None,
force: Optional["capo_redshift.types.boolean.Boolean"] = None,
) -> (
"capo_redshift.types.modify_cluster_snapshot_result.ModifyClusterSnapshotResult"
):
"""<p>Modifies the settings for a snapshot.</p> <p>This exanmple modifies the manual retention period setting for a cluster snapshot.</p>
Args:
snapshot_identifier: <p>The identifier of the snapshot whose setting you want to modify.</p>
manual_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>If the manual snapshot falls outside of the new retention period, you can specify the force option to immediately delete the snapshot.</p> <p>The value must be either -1 or an integer between 1 and 3,653.</p>
force: <p>A Boolean option to override an exception if the retention period has already passed.</p>
Raises:
capo_redshift.errors.cluster_snapshot_not_found_fault.ClusterSnapshotNotFoundFault: <p>The snapshot identifier does not refer to an existing cluster snapshot.</p>
capo_redshift.errors.invalid_cluster_snapshot_state_fault.InvalidClusterSnapshotStateFault: <p>The specified cluster snapshot is not in the <code>available</code> state, or other accounts are authorized to access the snapshot. </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.modify_cluster_snapshot_message.ModifyClusterSnapshotMessage]",
) -> OperationResponse[
"capo_redshift.types.modify_cluster_snapshot_result.ModifyClusterSnapshotResult"
]:
import capo_redshift._operations.redshift_service_version20121201.modify_cluster_snapshot
output, http_response = (
capo_redshift._operations.redshift_service_version20121201.modify_cluster_snapshot.modify_cluster_snapshot(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ModifyClusterSnapshot")
)
input_: capo_redshift.types.modify_cluster_snapshot_message.ModifyClusterSnapshotMessage = {}
if snapshot_identifier is not None:
input_["snapshot_identifier"] = snapshot_identifier
if manual_snapshot_retention_period is not None:
input_["manual_snapshot_retention_period"] = (
manual_snapshot_retention_period
)
if force is not None:
input_["force"] = force
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|