Skip to content

restore_volume_from_snapshot

restore_volume_from_snapshot(
    *,
    config_overrides: Optional[FSxClientConfig] = None,
    client_request_token: Optional[ClientRequestToken] = None,
    volume_id: Optional[VolumeId] = None,
    snapshot_id: Optional[SnapshotId] = None,
    options: Optional[RestoreOpenZFSVolumeOptions] = None,
) -> RestoreVolumeFromSnapshotResponse

Returns an Amazon FSx for OpenZFS volume to the state saved by the specified snapshot.

Parameters:

  • volume_id (Optional[VolumeId], default: None ) –

    The ID of the volume that you are restoring.

  • snapshot_id (Optional[SnapshotId], default: None ) –

    The ID of the source snapshot. Specifies the snapshot that you are restoring from.

  • options (Optional[RestoreOpenZFSVolumeOptions], default: None ) –

    The settings used when restoring the specified volume from snapshot.

    • DELETE_INTERMEDIATE_SNAPSHOTS - Deletes snapshots between the current state and the specified snapshot. If there are intermediate snapshots and this option isn't used, RestoreVolumeFromSnapshot fails.

    • DELETE_CLONED_VOLUMES - Deletes any dependent clone volumes created from intermediate snapshots. If there are any dependent clone volumes and this option isn't used, RestoreVolumeFromSnapshot fails.

Raises:

  • BadRequest –

    A generic error indicating a failure with a client request.

  • InternalServerError –

    A generic error indicating a server-side failure.

  • VolumeNotFound –

    No Amazon FSx volumes were found based upon the supplied parameters.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_fsx/_services/f_sx.py
def restore_volume_from_snapshot(
    self,
    *,
    config_overrides: Optional[FSxClientConfig] = None,
    client_request_token: Optional[
        "capo_fsx.types.client_request_token.ClientRequestToken"
    ] = None,
    volume_id: Optional["capo_fsx.types.volume_id.VolumeId"] = None,
    snapshot_id: Optional["capo_fsx.types.snapshot_id.SnapshotId"] = None,
    options: Optional[
        "capo_fsx.types.restore_open_zfs_volume_options.RestoreOpenZFSVolumeOptions"
    ] = None,
) -> "capo_fsx.types.restore_volume_from_snapshot_response.RestoreVolumeFromSnapshotResponse":
    """<p>Returns an Amazon FSx for OpenZFS volume to the state saved by the specified snapshot.</p>

    Args:
        volume_id: <p>The ID of the volume that you are restoring.</p>
        snapshot_id: <p>The ID of the source snapshot. Specifies the snapshot that you are restoring from.</p>
        options: <p>The settings used when restoring the specified volume from snapshot.</p> <ul> <li> <p> <code>DELETE_INTERMEDIATE_SNAPSHOTS</code> - Deletes snapshots between the current state and the specified snapshot. If there are intermediate snapshots and this option isn't used, <code>RestoreVolumeFromSnapshot</code> fails.</p> </li> <li> <p> <code>DELETE_CLONED_VOLUMES</code> - Deletes any dependent clone volumes created from intermediate snapshots. If there are any dependent clone volumes and this option isn't used, <code>RestoreVolumeFromSnapshot</code> fails.</p> </li> </ul>

    Raises:
        capo_fsx.errors.bad_request.BadRequest: <p>A generic error indicating a failure with a client request.</p>
        capo_fsx.errors.internal_server_error.InternalServerError: <p>A generic error indicating a server-side failure.</p>
        capo_fsx.errors.volume_not_found.VolumeNotFound: <p>No Amazon FSx volumes were found based upon the supplied parameters.</p>
        capo_fsx.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_fsx.types.restore_volume_from_snapshot_request.RestoreVolumeFromSnapshotRequest]",
    ) -> OperationResponse[
        "capo_fsx.types.restore_volume_from_snapshot_response.RestoreVolumeFromSnapshotResponse"
    ]:
        import capo_fsx._operations.aws_simba_api_service_v20180301.restore_volume_from_snapshot

        output, http_response = (
            capo_fsx._operations.aws_simba_api_service_v20180301.restore_volume_from_snapshot.restore_volume_from_snapshot(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_fsx.types.restore_volume_from_snapshot_response.RestoreVolumeFromSnapshotResponse",
    ) -> dict[str, Any]:
        import capo_fsx.types.restore_volume_from_snapshot_response

        return (
            capo_fsx.types.restore_volume_from_snapshot_response.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("RestoreVolumeFromSnapshot", redact_output=_redact_output),
    )
    input_: capo_fsx.types.restore_volume_from_snapshot_request.RestoreVolumeFromSnapshotRequest = {}
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if volume_id is not None:
        input_["volume_id"] = volume_id
    if snapshot_id is not None:
        input_["snapshot_id"] = snapshot_id
    if options is not None:
        input_["options"] = options

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