putRumMetricsDestination method
Creates or updates a destination to receive extended metrics from CloudWatch RUM. You can send extended metrics to CloudWatch or to a CloudWatch Evidently experiment.
For more information about extended metrics, see BatchCreateRumMetricDefinitions.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter appMonitorName :
The name of the CloudWatch RUM app monitor that will send the metrics.
Parameter destination :
Defines 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 is to be the destination and an IAM
role that has permission to write to the experiment.
Parameter destinationArn :
Use this parameter only if Destination is
Evidently. This parameter specifies the ARN of the Evidently
experiment that will receive the extended metrics.
Parameter iamRoleArn :
This parameter is required if Destination is
Evidently. If Destination is
CloudWatch, don't use this parameter.
This parameter specifies the ARN of an IAM role that RUM will assume to write to the Evidently experiment that you are sending metrics to. This role must have permission to write to that experiment.
If you specify this parameter, you must be signed on to a role that has PassRole
permissions attached to it, to allow the role to be passed. The
CloudWatchAmazonCloudWatchRUMFullAccess policy doesn't include
PassRole permissions.
Implementation
Future<void> putRumMetricsDestination({
required String appMonitorName,
required MetricDestination destination,
String? destinationArn,
String? iamRoleArn,
}) async {
final $payload = <String, dynamic>{
'Destination': destination.value,
if (destinationArn != null) 'DestinationArn': destinationArn,
if (iamRoleArn != null) 'IamRoleArn': iamRoleArn,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/rummetrics/${Uri.encodeComponent(appMonitorName)}/metricsdestination',
exceptionFnMap: _exceptionFns,
);
}