- 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.
ListMetricsCommand
Lists the metrics that can be exported.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { ResiliencehubClient, ListMetricsCommand } from "@aws-sdk/client-resiliencehub"; // ES Modules import
// const { ResiliencehubClient, ListMetricsCommand } = require("@aws-sdk/client-resiliencehub"); // CommonJS import
const client = new ResiliencehubClient(config);
const input = { // ListMetricsRequest
nextToken: "STRING_VALUE",
maxResults: Number("int"),
fields: [ // FieldList
{ // Field
name: "STRING_VALUE", // required
aggregation: "Min" || "Max" || "Sum" || "Avg" || "Count",
},
],
dataSource: "STRING_VALUE",
conditions: [ // ConditionList
{ // Condition
field: "STRING_VALUE", // required
operator: "Equals" || "NotEquals" || "GreaterThen" || "GreaterOrEquals" || "LessThen" || "LessOrEquals", // required
value: "STRING_VALUE",
},
],
sorts: [ // SortList
{ // Sort
field: "STRING_VALUE", // required
ascending: true || false,
},
],
};
const command = new ListMetricsCommand(input);
const response = await client.send(command);
// { // ListMetricsResponse
// rows: [ // RowList // required
// [ // Row
// "STRING_VALUE",
// ],
// ],
// nextToken: "STRING_VALUE",
// };
ListMetricsCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
conditions | Condition[] | undefined | Indicates the list of all the conditions that were applied on the metrics. |
dataSource | string | undefined | Indicates the data source of the metrics. |
fields | Field[] | undefined | Indicates the list of fields in the data source. |
maxResults | number | undefined | Maximum number of results to include in the response. If more results exist than the specified |
nextToken | string | undefined | Null, or the token from a previous call to get the next set of results. |
sorts | Sort[] | undefined | (Optional) Indicates the order in which you want to sort the fields in the metrics. By default, the fields are sorted in the ascending order. |
ListMetricsCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
rows Required | string[][] | undefined | Specifies all the list of metric values for each row of metrics. |
nextToken | string | undefined | Token for the next set of results, or null if there are no more results. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDeniedException | client | You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. |
InternalServerException | server | This exception occurs when there is an internal failure in the Resilience Hub service. |
ThrottlingException | client | This exception occurs when you have exceeded the limit on the number of requests per second. |
ValidationException | client | This exception occurs when a request is not valid. |
ResiliencehubServiceException | Base exception class for all service exceptions from Resiliencehub service. |