enableLogging method

Future<LoggingStatus> enableLogging({
  1. required String clusterIdentifier,
  2. String? bucketName,
  3. LogDestinationType? logDestinationType,
  4. List<String>? logExports,
  5. String? s3KeyPrefix,
})

Starts logging information, such as queries and connection attempts, for the specified Amazon Redshift cluster.

May throw BucketNotFoundFault. May throw ClusterNotFoundFault. May throw InsufficientS3BucketPolicyFault. May throw InvalidClusterStateFault. May throw InvalidS3BucketNameFault. May throw InvalidS3KeyPrefixFault. May throw UnsupportedOperationFault.

Parameter clusterIdentifier : The identifier of the cluster on which logging is to be started.

Example: examplecluster

Parameter bucketName : The name of an existing S3 bucket where the log files are to be stored.

Constraints:

  • Must be in the same region as the cluster
  • The cluster must have read bucket and put object permissions

Parameter logDestinationType : The log destination type. An enum with possible values of s3 and cloudwatch.

Parameter logExports : The collection of exported log types. Possible values are connectionlog, useractivitylog, and userlog.

Parameter s3KeyPrefix : The prefix applied to the log file names.

Valid characters are any letter from any language, any whitespace character, any numeric character, and the following characters: underscore (_), period (.), colon (:), slash (/), equal (=), plus (+), backslash (</code>), hyphen (-), at symbol (@).

Implementation

Future<LoggingStatus> enableLogging({
  required String clusterIdentifier,
  String? bucketName,
  LogDestinationType? logDestinationType,
  List<String>? logExports,
  String? s3KeyPrefix,
}) async {
  final $request = <String, String>{
    'ClusterIdentifier': clusterIdentifier,
    if (bucketName != null) 'BucketName': bucketName,
    if (logDestinationType != null)
      'LogDestinationType': logDestinationType.value,
    if (logExports != null)
      if (logExports.isEmpty)
        'LogExports': ''
      else
        for (var i1 = 0; i1 < logExports.length; i1++)
          'LogExports.member.${i1 + 1}': logExports[i1],
    if (s3KeyPrefix != null) 'S3KeyPrefix': s3KeyPrefix,
  };
  final $result = await _protocol.send(
    $request,
    action: 'EnableLogging',
    version: '2012-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'EnableLoggingResult',
  );
  return LoggingStatus.fromXml($result);
}