UpdateCustomMetricCommand

Updates a Device Defender detect custom metric.

Requires permission to access the UpdateCustomMetric  action.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { IoTClient, UpdateCustomMetricCommand } from "@aws-sdk/client-iot"; // ES Modules import
// const { IoTClient, UpdateCustomMetricCommand } = require("@aws-sdk/client-iot"); // CommonJS import
const client = new IoTClient(config);
const input = { // UpdateCustomMetricRequest
  metricName: "STRING_VALUE", // required
  displayName: "STRING_VALUE", // required
};
const command = new UpdateCustomMetricCommand(input);
const response = await client.send(command);
// { // UpdateCustomMetricResponse
//   metricName: "STRING_VALUE",
//   metricArn: "STRING_VALUE",
//   metricType: "string-list" || "ip-address-list" || "number-list" || "number",
//   displayName: "STRING_VALUE",
//   creationDate: new Date("TIMESTAMP"),
//   lastModifiedDate: new Date("TIMESTAMP"),
// };

UpdateCustomMetricCommand Input

See UpdateCustomMetricCommandInput for more details

Parameter
Type
Description
displayName
Required
string | undefined

Field represents a friendly name in the console for the custom metric, it doesn't have to be unique. Don't use this name as the metric identifier in the device metric report. Can be updated.

metricName
Required
string | undefined

The name of the custom metric. Cannot be updated.

UpdateCustomMetricCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
creationDate
Date | undefined

The creation date of the custom metric in milliseconds since epoch.

displayName
string | undefined

A friendly name in the console for the custom metric

lastModifiedDate
Date | undefined

The time the custom metric was last modified in milliseconds since epoch.

metricArn
string | undefined

The Amazon Resource Number (ARN) of the custom metric.

metricName
string | undefined

The name of the custom metric.

metricType
CustomMetricType | undefined

The type of the custom metric.

The type number only takes a single metric value as an input, but while submitting the metrics value in the DeviceMetrics report, it must be passed as an array with a single value.

Throws

Name
Fault
Details
InternalFailureException
server

An unexpected error has occurred.

InvalidRequestException
client

The request is not valid.

ResourceNotFoundException
client

The specified resource does not exist.

ThrottlingException
client

The rate exceeds the limit.

IoTServiceException
Base exception class for all service exceptions from IoT service.