createLookupTable method

Future<CreateLookupTableResponse> createLookupTable({
  1. required String lookupTableName,
  2. String? description,
  3. String? kmsKeyId,
  4. String? queryId,
  5. String? tableBody,
  6. Map<String, String>? tags,
})

Creates a lookup table by uploading CSV data or from CloudWatch Logs query results. You can use lookup tables to enrich log data in CloudWatch Logs queries with reference data such as user details, application names, or error descriptions.

The table name must be unique within your account and Region. You must specify either tableBody or queryId, but not both. If you use tableBody, the CSV content must include a header row with column names, use UTF-8 encoding, and not exceed 10 MB.

May throw AccessDeniedException. May throw InvalidParameterException. May throw LimitExceededException. May throw ResourceAlreadyExistsException. May throw ServiceUnavailableException. May throw ValidationException.

Parameter lookupTableName : The name of the lookup table. The name must be unique within your account and Region. The name can contain only alphanumeric characters and underscores, and can be up to 256 characters long.

Parameter description : A description of the lookup table. The description can be up to 1024 characters long.

Parameter kmsKeyId : The ARN of the KMS key to use to encrypt the lookup table data. If you don't specify a key, the data is encrypted with an Amazon Web Services-owned key.

Parameter queryId : The ID of a completed or cancelled CloudWatch Logs query whose results populate the lookup table. A cancelled query populates the table with the partial results that were available when the query was stopped.

You must specify either tableBody or queryId, but not both.

Parameter tableBody : The CSV content of the lookup table. The first row must be a header row with column names. The content must use UTF-8 encoding and not exceed 10 MB.

You must specify either tableBody or queryId, but not both.

Parameter tags : A list of key-value pairs to associate with the lookup table. You can associate as many as 50 tags with a lookup table. Tags can help you organize and categorize your resources.

Implementation

Future<CreateLookupTableResponse> createLookupTable({
  required String lookupTableName,
  String? description,
  String? kmsKeyId,
  String? queryId,
  String? tableBody,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Logs_20140328.CreateLookupTable'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'lookupTableName': lookupTableName,
      if (description != null) 'description': description,
      if (kmsKeyId != null) 'kmsKeyId': kmsKeyId,
      if (queryId != null) 'queryId': queryId,
      if (tableBody != null) 'tableBody': tableBody,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateLookupTableResponse.fromJson(jsonResponse.body);
}