updateRumMetricDefinition method

Future<void> updateRumMetricDefinition({
  1. required String appMonitorName,
  2. required MetricDestination destination,
  3. required MetricDefinitionRequest metricDefinition,
  4. required String metricDefinitionId,
  5. String? destinationArn,
})

Modifies one existing metric definition for CloudWatch RUM extended metrics. For more information about extended metrics, see BatchCreateRumMetricsDefinitions.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter appMonitorName : The name of the CloudWatch RUM app monitor that sends these metrics.

Parameter destination : The destination to send the metrics to. Valid values are CloudWatch and Evidently. If you specify Evidently, you must also specify the ARN of the CloudWatchEvidently experiment that will receive the metrics and an IAM role that has permission to write to the experiment.

Parameter metricDefinition : A structure that contains the new definition that you want to use for this metric.

Parameter metricDefinitionId : The ID of the metric definition to update.

Parameter destinationArn : This parameter is required if Destination is Evidently. If Destination is CloudWatch, do not use this parameter.

This parameter specifies the ARN of the Evidently experiment that is to receive the metrics. You must have already defined this experiment as a valid destination. For more information, see PutRumMetricsDestination.

Implementation

Future<void> updateRumMetricDefinition({
  required String appMonitorName,
  required MetricDestination destination,
  required MetricDefinitionRequest metricDefinition,
  required String metricDefinitionId,
  String? destinationArn,
}) async {
  final $payload = <String, dynamic>{
    'Destination': destination.value,
    'MetricDefinition': metricDefinition,
    'MetricDefinitionId': metricDefinitionId,
    if (destinationArn != null) 'DestinationArn': destinationArn,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri: '/rummetrics/${Uri.encodeComponent(appMonitorName)}/metrics',
    exceptionFnMap: _exceptionFns,
  );
}