addApplicationCloudWatchLoggingOption method

Future<AddApplicationCloudWatchLoggingOptionResponse> addApplicationCloudWatchLoggingOption({
  1. required String applicationName,
  2. required CloudWatchLoggingOption cloudWatchLoggingOption,
  3. String? conditionalToken,
  4. int? currentApplicationVersionId,
})

Adds an Amazon CloudWatch log stream to monitor application configuration errors.

May throw ConcurrentModificationException. May throw InvalidApplicationConfigurationException. May throw InvalidArgumentException. May throw InvalidRequestException. May throw ResourceInUseException. May throw ResourceNotFoundException.

Parameter applicationName : The Kinesis Data Analytics application name.

Parameter cloudWatchLoggingOption : Provides the Amazon CloudWatch log stream Amazon Resource Name (ARN).

Parameter conditionalToken : A value you use to implement strong concurrency for application updates. You must provide the CurrentApplicationVersionId or the ConditionalToken. You get the application's current ConditionalToken using DescribeApplication. For better concurrency support, use the ConditionalToken parameter instead of CurrentApplicationVersionId.

Parameter currentApplicationVersionId : The version ID of the SQL-based Kinesis Data Analytics application. You must provide the CurrentApplicationVersionId or the ConditionalToken.You can retrieve the application version ID using DescribeApplication. For better concurrency support, use the ConditionalToken parameter instead of CurrentApplicationVersionId.

Implementation

Future<AddApplicationCloudWatchLoggingOptionResponse>
    addApplicationCloudWatchLoggingOption({
  required String applicationName,
  required CloudWatchLoggingOption cloudWatchLoggingOption,
  String? conditionalToken,
  int? currentApplicationVersionId,
}) async {
  _s.validateNumRange(
    'currentApplicationVersionId',
    currentApplicationVersionId,
    1,
    999999999,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'KinesisAnalytics_20180523.AddApplicationCloudWatchLoggingOption'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ApplicationName': applicationName,
      'CloudWatchLoggingOption': cloudWatchLoggingOption,
      if (conditionalToken != null) 'ConditionalToken': conditionalToken,
      if (currentApplicationVersionId != null)
        'CurrentApplicationVersionId': currentApplicationVersionId,
    },
  );

  return AddApplicationCloudWatchLoggingOptionResponse.fromJson(
      jsonResponse.body);
}