Skip to content

copy_snapshot_and_update_volume

copy_snapshot_and_update_volume(
    *,
    config_overrides: Optional[FSxClientConfig] = None,
    client_request_token: Optional[ClientRequestToken] = None,
    volume_id: Optional[VolumeId] = None,
    source_snapshot_arn: Optional[ResourceARN] = None,
    copy_strategy: Optional[OpenZFSCopyStrategy] = None,
    options: Optional[UpdateOpenZFSVolumeOptions] = None,
) -> CopySnapshotAndUpdateVolumeResponse

Updates an existing volume by using a snapshot from another Amazon FSx for OpenZFS file system. For more information, see on-demand data replication in the Amazon FSx for OpenZFS User Guide.

Parameters:

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

    Specifies the ID of the volume that you are copying the snapshot to.

  • copy_strategy (Optional[OpenZFSCopyStrategy], default: None ) –

    Specifies the strategy to use when copying data from a snapshot to the volume.

    • FULL_COPY - Copies all data from the snapshot to the volume.

    • INCREMENTAL_COPY - Copies only the snapshot data that's changed since the previous replication.

    CLONE isn't a valid copy strategy option for the CopySnapshotAndUpdateVolume operation.

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

    Confirms that you want to delete data on the destination volume that wasn’t there during the previous snapshot replication.

    Your replication will fail if you don’t include an option for a specific type of data and that data is on your destination. For example, if you don’t include DELETE_INTERMEDIATE_SNAPSHOTS and there are intermediate snapshots on the destination, you can’t copy the snapshot.

    • DELETE_INTERMEDIATE_SNAPSHOTS - Deletes snapshots on the destination volume that aren’t on the source volume.

    • DELETE_CLONED_VOLUMES - Deletes snapshot clones on the destination volume that aren't on the source volume.

    • DELETE_INTERMEDIATE_DATA - Overwrites snapshots on the destination volume that don’t match the source snapshot that you’re copying.

Raises:

  • BadRequest –

    A generic error indicating a failure with a client request.

  • IncompatibleParameterError –

    The error returned when a second request is received with the same client request token but different parameters settings. A client request token should always uniquely identify a single request.

  • InternalServerError –

    A generic error indicating a server-side failure.

  • ServiceLimitExceeded –

    An error indicating that a particular service limit was exceeded. You can increase some service limits by contacting Amazon Web Services Support.

  • UnknownServiceError –

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

Source code in docs_src/capo_fsx/_services/f_sx.py
def copy_snapshot_and_update_volume(
    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,
    source_snapshot_arn: Optional["capo_fsx.types.resource_arn.ResourceARN"] = None,
    copy_strategy: Optional[
        "capo_fsx.types.open_zfs_copy_strategy.OpenZFSCopyStrategy"
    ] = None,
    options: Optional[
        "capo_fsx.types.update_open_zfs_volume_options.UpdateOpenZFSVolumeOptions"
    ] = None,
) -> "capo_fsx.types.copy_snapshot_and_update_volume_response.CopySnapshotAndUpdateVolumeResponse":
    """<p>Updates an existing volume by using a snapshot from another Amazon FSx for OpenZFS file system. For more information, see <a href="https://docs.aws.amazon.com/fsx/latest/OpenZFSGuide/on-demand-replication.html">on-demand data replication</a> in the Amazon FSx for OpenZFS User Guide.</p>

    Args:
        volume_id: <p>Specifies the ID of the volume that you are copying the snapshot to.</p>
        copy_strategy: <p>Specifies the strategy to use when copying data from a snapshot to the volume. </p> <ul> <li> <p> <code>FULL_COPY</code> - Copies all data from the snapshot to the volume. </p> </li> <li> <p> <code>INCREMENTAL_COPY</code> - Copies only the snapshot data that's changed since the previous replication.</p> </li> </ul> <note> <p> <code>CLONE</code> isn't a valid copy strategy option for the <code>CopySnapshotAndUpdateVolume</code> operation.</p> </note>
        options: <p>Confirms that you want to delete data on the destination volume that wasn’t there during the previous snapshot replication.</p> <p>Your replication will fail if you don’t include an option for a specific type of data and that data is on your destination. For example, if you don’t include <code>DELETE_INTERMEDIATE_SNAPSHOTS</code> and there are intermediate snapshots on the destination, you can’t copy the snapshot.</p> <ul> <li> <p> <code>DELETE_INTERMEDIATE_SNAPSHOTS</code> - Deletes snapshots on the destination volume that aren’t on the source volume.</p> </li> <li> <p> <code>DELETE_CLONED_VOLUMES</code> - Deletes snapshot clones on the destination volume that aren't on the source volume.</p> </li> <li> <p> <code>DELETE_INTERMEDIATE_DATA</code> - Overwrites snapshots on the destination volume that don’t match the source snapshot that you’re copying.</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.incompatible_parameter_error.IncompatibleParameterError: <p>The error returned when a second request is received with the same client request token but different parameters settings. A client request token should always uniquely identify a single request.</p>
        capo_fsx.errors.internal_server_error.InternalServerError: <p>A generic error indicating a server-side failure.</p>
        capo_fsx.errors.service_limit_exceeded.ServiceLimitExceeded: <p>An error indicating that a particular service limit was exceeded. You can increase some service limits by contacting Amazon Web Services Support.</p>
        capo_fsx.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_fsx.types.copy_snapshot_and_update_volume_request.CopySnapshotAndUpdateVolumeRequest]",
    ) -> OperationResponse[
        "capo_fsx.types.copy_snapshot_and_update_volume_response.CopySnapshotAndUpdateVolumeResponse"
    ]:
        import capo_fsx._operations.aws_simba_api_service_v20180301.copy_snapshot_and_update_volume

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

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

        return capo_fsx.types.copy_snapshot_and_update_volume_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CopySnapshotAndUpdateVolume", redact_output=_redact_output
        ),
    )
    input_: capo_fsx.types.copy_snapshot_and_update_volume_request.CopySnapshotAndUpdateVolumeRequest = {}
    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 source_snapshot_arn is not None:
        input_["source_snapshot_arn"] = source_snapshot_arn
    if copy_strategy is not None:
        input_["copy_strategy"] = copy_strategy
    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