generateAccessLogs method

Future<GenerateAccessLogsResult> generateAccessLogs({
  1. required String appId,
  2. required String domainName,
  3. DateTime? endTime,
  4. DateTime? startTime,
})

Returns the website access logs for a specific time range using a presigned URL.

May throw NotFoundException. May throw BadRequestException. May throw UnauthorizedException. May throw InternalFailureException.

Parameter appId : The unique ID for an Amplify app.

Parameter domainName : The name of the domain.

Parameter endTime : The time at which the logs should end. The time range specified is inclusive of the end time.

Parameter startTime : The time at which the logs should start. The time range specified is inclusive of the start time.

Implementation

Future<GenerateAccessLogsResult> generateAccessLogs({
  required String appId,
  required String domainName,
  DateTime? endTime,
  DateTime? startTime,
}) async {
  ArgumentError.checkNotNull(appId, 'appId');
  _s.validateStringLength(
    'appId',
    appId,
    1,
    20,
    isRequired: true,
  );
  ArgumentError.checkNotNull(domainName, 'domainName');
  _s.validateStringLength(
    'domainName',
    domainName,
    0,
    255,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'domainName': domainName,
    if (endTime != null) 'endTime': unixTimestampToJson(endTime),
    if (startTime != null) 'startTime': unixTimestampToJson(startTime),
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/apps/${Uri.encodeComponent(appId)}/accesslogs',
    exceptionFnMap: _exceptionFns,
  );
  return GenerateAccessLogsResult.fromJson(response);
}