createSnapshotFromVolumeRecoveryPoint method

Future<CreateSnapshotFromVolumeRecoveryPointOutput> createSnapshotFromVolumeRecoveryPoint({
  1. required String snapshotDescription,
  2. required String volumeARN,
  3. List<Tag>? tags,
})

Initiates a snapshot of a gateway from a volume recovery point. This operation is only supported in the cached volume gateway type.

A volume recovery point is a point in time at which all data of the volume is consistent and from which you can create a snapshot. To get a list of volume recovery point for cached volume gateway, use ListVolumeRecoveryPoints.

In the CreateSnapshotFromVolumeRecoveryPoint request, you identify the volume by providing its Amazon Resource Name (ARN). You must also provide a description for the snapshot. When the gateway takes a snapshot of the specified volume, the snapshot and its description appear in the AWS Storage Gateway console. In response, the gateway returns you a snapshot ID. You can use this snapshot ID to check the snapshot progress or later use it when you want to create a volume from a snapshot.

May throw InvalidGatewayRequestException. May throw InternalServerError. May throw ServiceUnavailableError.

Parameter snapshotDescription : Textual description of the snapshot that appears in the Amazon EC2 console, Elastic Block Store snapshots panel in the Description field, and in the AWS Storage Gateway snapshot Details pane, Description field.

Parameter volumeARN : The Amazon Resource Name (ARN) of the iSCSI volume target. Use the DescribeStorediSCSIVolumes operation to return to retrieve the TargetARN for specified VolumeARN.

Parameter tags : A list of up to 50 tags that can be assigned to a snapshot. Each tag is a key-value pair.

Implementation

Future<CreateSnapshotFromVolumeRecoveryPointOutput>
    createSnapshotFromVolumeRecoveryPoint({
  required String snapshotDescription,
  required String volumeARN,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(snapshotDescription, 'snapshotDescription');
  _s.validateStringLength(
    'snapshotDescription',
    snapshotDescription,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(volumeARN, 'volumeARN');
  _s.validateStringLength(
    'volumeARN',
    volumeARN,
    50,
    500,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'StorageGateway_20130630.CreateSnapshotFromVolumeRecoveryPoint'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'SnapshotDescription': snapshotDescription,
      'VolumeARN': volumeARN,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateSnapshotFromVolumeRecoveryPointOutput.fromJson(
      jsonResponse.body);
}