getRelationalDatabaseLogEvents method

Future<GetRelationalDatabaseLogEventsResult> getRelationalDatabaseLogEvents({
  1. required String logStreamName,
  2. required String relationalDatabaseName,
  3. DateTime? endTime,
  4. String? pageToken,
  5. bool? startFromHead,
  6. DateTime? startTime,
})

Returns a list of log events for a database in Amazon Lightsail.

May throw ServiceException. May throw InvalidInputException. May throw NotFoundException. May throw OperationFailureException. May throw AccessDeniedException. May throw AccountSetupInProgressException. May throw UnauthenticatedException.

Parameter logStreamName : The name of the log stream.

Use the get relational database log streams operation to get a list of available log streams.

Parameter relationalDatabaseName : The name of your database for which to get log events.

Parameter endTime : The end of the time interval from which to get log events.

Constraints:

  • Specified in Coordinated Universal Time (UTC).
  • Specified in the Unix time format.

    For example, if you wish to use an end time of October 1, 2018, at 8 PM UTC, then you input 1538424000 as the end time.

Parameter pageToken : The token to advance to the next or previous page of results from your request.

To get a page token, perform an initial GetRelationalDatabaseLogEvents request. If your results are paginated, the response will return a next forward token and/or next backward token that you can specify as the page token in a subsequent request.

Parameter startFromHead : Parameter to specify if the log should start from head or tail. If true is specified, the log event starts from the head of the log. If false is specified, the log event starts from the tail of the log.

Parameter startTime : The start of the time interval from which to get log events.

Constraints:

  • Specified in Coordinated Universal Time (UTC).
  • Specified in the Unix time format.

    For example, if you wish to use a start time of October 1, 2018, at 8 PM UTC, then you input 1538424000 as the start time.

Implementation

Future<GetRelationalDatabaseLogEventsResult> getRelationalDatabaseLogEvents({
  required String logStreamName,
  required String relationalDatabaseName,
  DateTime? endTime,
  String? pageToken,
  bool? startFromHead,
  DateTime? startTime,
}) async {
  ArgumentError.checkNotNull(logStreamName, 'logStreamName');
  ArgumentError.checkNotNull(
      relationalDatabaseName, 'relationalDatabaseName');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Lightsail_20161128.GetRelationalDatabaseLogEvents'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'logStreamName': logStreamName,
      'relationalDatabaseName': relationalDatabaseName,
      if (endTime != null) 'endTime': unixTimestampToJson(endTime),
      if (pageToken != null) 'pageToken': pageToken,
      if (startFromHead != null) 'startFromHead': startFromHead,
      if (startTime != null) 'startTime': unixTimestampToJson(startTime),
    },
  );

  return GetRelationalDatabaseLogEventsResult.fromJson(jsonResponse.body);
}