updateSnapshotSchedule method

Future<UpdateSnapshotScheduleOutput> updateSnapshotSchedule({
  1. required int recurrenceInHours,
  2. required int startAt,
  3. required String volumeARN,
  4. String? description,
  5. List<Tag>? tags,
})

Updates a snapshot schedule configured for a gateway volume. This operation is only supported in the cached volume and stored volume gateway types.

The default snapshot schedule for volume is once every 24 hours, starting at the creation time of the volume. You can use this API to change the snapshot schedule configured for the volume.

In the request you must identify the gateway volume whose snapshot schedule you want to update, and the schedule information, including when you want the snapshot to begin on a day and the frequency (in hours) of snapshots.

May throw InvalidGatewayRequestException. May throw InternalServerError.

Parameter recurrenceInHours : Frequency of snapshots. Specify the number of hours between snapshots.

Parameter startAt : The hour of the day at which the snapshot schedule begins represented as hh, where hh is the hour (0 to 23). The hour of the day is in the time zone of the gateway.

Parameter volumeARN : The Amazon Resource Name (ARN) of the volume. Use the ListVolumes operation to return a list of gateway volumes.

Parameter description : Optional description of the snapshot that overwrites the existing description.

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<UpdateSnapshotScheduleOutput> updateSnapshotSchedule({
  required int recurrenceInHours,
  required int startAt,
  required String volumeARN,
  String? description,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(recurrenceInHours, 'recurrenceInHours');
  _s.validateNumRange(
    'recurrenceInHours',
    recurrenceInHours,
    1,
    24,
    isRequired: true,
  );
  ArgumentError.checkNotNull(startAt, 'startAt');
  _s.validateNumRange(
    'startAt',
    startAt,
    0,
    23,
    isRequired: true,
  );
  ArgumentError.checkNotNull(volumeARN, 'volumeARN');
  _s.validateStringLength(
    'volumeARN',
    volumeARN,
    50,
    500,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    255,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StorageGateway_20130630.UpdateSnapshotSchedule'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'RecurrenceInHours': recurrenceInHours,
      'StartAt': startAt,
      'VolumeARN': volumeARN,
      if (description != null) 'Description': description,
      if (tags != null) 'Tags': tags,
    },
  );

  return UpdateSnapshotScheduleOutput.fromJson(jsonResponse.body);
}