startReplay method

Future<StartReplayResponse> startReplay({
  1. required ReplayDestination destination,
  2. required DateTime eventEndTime,
  3. required String eventSourceArn,
  4. required DateTime eventStartTime,
  5. required String replayName,
  6. String? description,
})

Starts the specified replay. Events are not necessarily replayed in the exact same order that they were added to the archive. A replay processes events to replay based on the time in the event, and replays them using 1 minute intervals. If you specify an EventStartTime and an EventEndTime that covers a 20 minute time range, the events are replayed from the first minute of that 20 minute range first. Then the events from the second minute are replayed. You can use DescribeReplay to determine the progress of a replay. The value returned for EventLastReplayedTime indicates the time within the specified time range associated with the last event replayed.

May throw ResourceNotFoundException. May throw ResourceAlreadyExistsException. May throw InvalidEventPatternException. May throw LimitExceededException. May throw InternalException.

Parameter destination : A ReplayDestination object that includes details about the destination for the replay.

Parameter eventEndTime : A time stamp for the time to stop replaying events. Only events that occurred between the EventStartTime and EventEndTime are replayed.

Parameter eventSourceArn : The ARN of the archive to replay events from.

Parameter eventStartTime : A time stamp for the time to start replaying events. Only events that occurred between the EventStartTime and EventEndTime are replayed.

Parameter replayName : The name of the replay to start.

Parameter description : A description for the replay to start.

Implementation

Future<StartReplayResponse> startReplay({
  required ReplayDestination destination,
  required DateTime eventEndTime,
  required String eventSourceArn,
  required DateTime eventStartTime,
  required String replayName,
  String? description,
}) async {
  ArgumentError.checkNotNull(destination, 'destination');
  ArgumentError.checkNotNull(eventEndTime, 'eventEndTime');
  ArgumentError.checkNotNull(eventSourceArn, 'eventSourceArn');
  _s.validateStringLength(
    'eventSourceArn',
    eventSourceArn,
    1,
    1600,
    isRequired: true,
  );
  ArgumentError.checkNotNull(eventStartTime, 'eventStartTime');
  ArgumentError.checkNotNull(replayName, 'replayName');
  _s.validateStringLength(
    'replayName',
    replayName,
    1,
    64,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    512,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSEvents.StartReplay'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Destination': destination,
      'EventEndTime': unixTimestampToJson(eventEndTime),
      'EventSourceArn': eventSourceArn,
      'EventStartTime': unixTimestampToJson(eventStartTime),
      'ReplayName': replayName,
      if (description != null) 'Description': description,
    },
  );

  return StartReplayResponse.fromJson(jsonResponse.body);
}