- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
CreateMetricAttributionCommand
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 .
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { PersonalizeClient, CreateMetricAttributionCommand } from "@aws-sdk/client-personalize"; // ES Modules import
// const { PersonalizeClient, CreateMetricAttributionCommand } = require("@aws-sdk/client-personalize"); // CommonJS import
const client = new PersonalizeClient(config);
const input = { // CreateMetricAttributionRequest
name: "STRING_VALUE", // required
datasetGroupArn: "STRING_VALUE", // required
metrics: [ // MetricAttributes // required
{ // MetricAttribute
eventType: "STRING_VALUE", // required
metricName: "STRING_VALUE", // required
expression: "STRING_VALUE", // required
},
],
metricsOutputConfig: { // MetricAttributionOutput
s3DataDestination: { // S3DataConfig
path: "STRING_VALUE", // required
kmsKeyArn: "STRING_VALUE",
},
roleArn: "STRING_VALUE", // required
},
};
const command = new CreateMetricAttributionCommand(input);
const response = await client.send(command);
// { // CreateMetricAttributionResponse
// metricAttributionArn: "STRING_VALUE",
// };
CreateMetricAttributionCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
datasetGroupArn Required | string | undefined | The Amazon Resource Name (ARN) of the destination dataset group for the metric attribution. |
metrics Required | MetricAttribute[] | undefined | A list of metric attributes for the metric attribution. Each metric attribute specifies an event type to track and a function. Available functions are |
metricsOutputConfig Required | MetricAttributionOutput | undefined | The output configuration details for the metric attribution. |
name Required | string | undefined | A name for the metric attribution. |
CreateMetricAttributionCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
metricAttributionArn | string | undefined | The Amazon Resource Name (ARN) for the new metric attribution. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
InvalidInputException | client | Provide a valid value for the field or parameter. |
LimitExceededException | client | The limit on the number of requests per second has been exceeded. |
ResourceAlreadyExistsException | client | The specified resource already exists. |
ResourceInUseException | client | The specified resource is in use. |
ResourceNotFoundException | client | Could not find the specified resource. |
PersonalizeServiceException | Base exception class for all service exceptions from Personalize service. |