enableEnhancedMonitoring method

Future<EnhancedMonitoringOutput> enableEnhancedMonitoring({
  1. required List<MetricsName> shardLevelMetrics,
  2. String? streamARN,
  3. String? streamId,
  4. String? streamName,
})

Enables enhanced Kinesis data stream monitoring for shard-level metrics.

May throw AccessDeniedException. May throw InvalidArgumentException. May throw LimitExceededException. May throw ResourceInUseException. May throw ResourceNotFoundException.

Parameter shardLevelMetrics : List of shard-level metrics to enable.

The following are the valid shard-level metrics. The value "ALL" enables every metric.

  • IncomingBytes
  • IncomingRecords
  • OutgoingBytes
  • OutgoingRecords
  • WriteProvisionedThroughputExceeded
  • ReadProvisionedThroughputExceeded
  • IteratorAgeMilliseconds
  • ALL
For more information, see Monitoring the Amazon Kinesis Data Streams Service with Amazon CloudWatch in the Amazon Kinesis Data Streams Developer Guide.

Parameter streamARN : The ARN of the stream.

Parameter streamId : Not Implemented. Reserved for future use.

Parameter streamName : The name of the stream for which to enable enhanced monitoring.

Implementation

Future<EnhancedMonitoringOutput> enableEnhancedMonitoring({
  required List<MetricsName> shardLevelMetrics,
  String? streamARN,
  String? streamId,
  String? streamName,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Kinesis_20131202.EnableEnhancedMonitoring'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ShardLevelMetrics': shardLevelMetrics.map((e) => e.value).toList(),
      if (streamARN != null) 'StreamARN': streamARN,
      if (streamId != null) 'StreamId': streamId,
      if (streamName != null) 'StreamName': streamName,
    },
  );

  return EnhancedMonitoringOutput.fromJson(jsonResponse.body);
}