enableLogging method

Future<LoggingStatus> enableLogging({
  1. required String bucketName,
  2. required String clusterIdentifier,
  3. String? s3KeyPrefix,
})

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

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

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 clusterIdentifier : The identifier of the cluster on which logging is to be started.

Example: examplecluster

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

Constraints:

  • Cannot exceed 512 characters
  • Cannot contain spaces( ), double quotes ("), single quotes ('), a backslash (\), or control characters. The hexadecimal codes for invalid characters are:
    • x00 to x20
    • x22
    • x27
    • x5c
    • x7f or larger

Implementation

Future<LoggingStatus> enableLogging({
  required String bucketName,
  required String clusterIdentifier,
  String? s3KeyPrefix,
}) async {
  ArgumentError.checkNotNull(bucketName, 'bucketName');
  _s.validateStringLength(
    'bucketName',
    bucketName,
    0,
    2147483647,
    isRequired: true,
  );
  ArgumentError.checkNotNull(clusterIdentifier, 'clusterIdentifier');
  _s.validateStringLength(
    'clusterIdentifier',
    clusterIdentifier,
    0,
    2147483647,
    isRequired: true,
  );
  _s.validateStringLength(
    's3KeyPrefix',
    s3KeyPrefix,
    0,
    2147483647,
  );
  final $request = <String, dynamic>{};
  $request['BucketName'] = bucketName;
  $request['ClusterIdentifier'] = clusterIdentifier;
  s3KeyPrefix?.also((arg) => $request['S3KeyPrefix'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'EnableLogging',
    version: '2012-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['EnableLoggingMessage'],
    shapes: shapes,
    resultWrapper: 'EnableLoggingResult',
  );
  return LoggingStatus.fromXml($result);
}