decreaseStreamRetentionPeriod method

Future<void> decreaseStreamRetentionPeriod({
  1. required int retentionPeriodHours,
  2. required String streamName,
})

Decreases the Kinesis data stream's retention period, which is the length of time data records are accessible after they are added to the stream. The minimum value of a stream's retention period is 24 hours.

This operation may result in lost data. For example, if the stream's retention period is 48 hours and is decreased to 24 hours, any data already in the stream that is older than 24 hours is inaccessible.

May throw ResourceInUseException. May throw ResourceNotFoundException. May throw LimitExceededException. May throw InvalidArgumentException.

Parameter retentionPeriodHours : The new retention period of the stream, in hours. Must be less than the current retention period.

Parameter streamName : The name of the stream to modify.

Implementation

Future<void> decreaseStreamRetentionPeriod({
  required int retentionPeriodHours,
  required String streamName,
}) async {
  ArgumentError.checkNotNull(retentionPeriodHours, 'retentionPeriodHours');
  ArgumentError.checkNotNull(streamName, 'streamName');
  _s.validateStringLength(
    'streamName',
    streamName,
    1,
    128,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Kinesis_20131202.DecreaseStreamRetentionPeriod'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'RetentionPeriodHours': retentionPeriodHours,
      'StreamName': streamName,
    },
  );
}