createMetricAttribution method

Future<CreateMetricAttributionResponse> createMetricAttribution({
  1. required String datasetGroupArn,
  2. required List<MetricAttribute> metrics,
  3. required MetricAttributionOutput metricsOutputConfig,
  4. required String name,
})

Creates a metric attribution. A metric attribution creates reports on the data that you import into Amazon Personalize. Depending on how you imported the data, you can view reports in Amazon CloudWatch or Amazon S3. For more information, see Measuring impact of recommendations.

May throw InvalidInputException. May throw LimitExceededException. May throw ResourceAlreadyExistsException. May throw ResourceInUseException. May throw ResourceNotFoundException.

Parameter datasetGroupArn : The Amazon Resource Name (ARN) of the destination dataset group for the metric attribution.

Parameter metrics : A list of metric attributes for the metric attribution. Each metric attribute specifies an event type to track and a function. Available functions are SUM() or SAMPLECOUNT(). For SUM() functions, provide the dataset type (either Interactions or Items) and column to sum as a parameter. For example SUM(Items.PRICE).

Parameter metricsOutputConfig : The output configuration details for the metric attribution.

Parameter name : A name for the metric attribution.

Implementation

Future<CreateMetricAttributionResponse> createMetricAttribution({
  required String datasetGroupArn,
  required List<MetricAttribute> metrics,
  required MetricAttributionOutput metricsOutputConfig,
  required String name,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonPersonalize.CreateMetricAttribution'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'datasetGroupArn': datasetGroupArn,
      'metrics': metrics,
      'metricsOutputConfig': metricsOutputConfig,
      'name': name,
    },
  );

  return CreateMetricAttributionResponse.fromJson(jsonResponse.body);
}