ListInsightsCommand

Returns a list of insights in your Amazon Web Services account. You can specify which insights are returned by their start time and status (ONGOING, CLOSED, or ANY).

Example Syntax

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

import { DevOpsGuruClient, ListInsightsCommand } from "@aws-sdk/client-devops-guru"; // ES Modules import
// const { DevOpsGuruClient, ListInsightsCommand } = require("@aws-sdk/client-devops-guru"); // CommonJS import
const client = new DevOpsGuruClient(config);
const input = { // ListInsightsRequest
  StatusFilter: { // ListInsightsStatusFilter
    Ongoing: { // ListInsightsOngoingStatusFilter
      Type: "REACTIVE" || "PROACTIVE", // required
    },
    Closed: { // ListInsightsClosedStatusFilter
      Type: "REACTIVE" || "PROACTIVE", // required
      EndTimeRange: { // EndTimeRange
        FromTime: new Date("TIMESTAMP"),
        ToTime: new Date("TIMESTAMP"),
      },
    },
    Any: { // ListInsightsAnyStatusFilter
      Type: "REACTIVE" || "PROACTIVE", // required
      StartTimeRange: { // StartTimeRange
        FromTime: new Date("TIMESTAMP"),
        ToTime: new Date("TIMESTAMP"),
      },
    },
  },
  MaxResults: Number("int"),
  NextToken: "STRING_VALUE",
};
const command = new ListInsightsCommand(input);
const response = await client.send(command);
// { // ListInsightsResponse
//   ProactiveInsights: [ // ProactiveInsights
//     { // ProactiveInsightSummary
//       Id: "STRING_VALUE",
//       Name: "STRING_VALUE",
//       Severity: "LOW" || "MEDIUM" || "HIGH",
//       Status: "ONGOING" || "CLOSED",
//       InsightTimeRange: { // InsightTimeRange
//         StartTime: new Date("TIMESTAMP"), // required
//         EndTime: new Date("TIMESTAMP"),
//       },
//       PredictionTimeRange: { // PredictionTimeRange
//         StartTime: new Date("TIMESTAMP"), // required
//         EndTime: new Date("TIMESTAMP"),
//       },
//       ResourceCollection: { // ResourceCollection
//         CloudFormation: { // CloudFormationCollection
//           StackNames: [ // StackNames
//             "STRING_VALUE",
//           ],
//         },
//         Tags: [ // TagCollections
//           { // TagCollection
//             AppBoundaryKey: "STRING_VALUE", // required
//             TagValues: [ // TagValues // required
//               "STRING_VALUE",
//             ],
//           },
//         ],
//       },
//       ServiceCollection: { // ServiceCollection
//         ServiceNames: [ // ServiceNames
//           "API_GATEWAY" || "APPLICATION_ELB" || "AUTO_SCALING_GROUP" || "CLOUD_FRONT" || "DYNAMO_DB" || "EC2" || "ECS" || "EKS" || "ELASTIC_BEANSTALK" || "ELASTI_CACHE" || "ELB" || "ES" || "KINESIS" || "LAMBDA" || "NAT_GATEWAY" || "NETWORK_ELB" || "RDS" || "REDSHIFT" || "ROUTE_53" || "S3" || "SAGE_MAKER" || "SNS" || "SQS" || "STEP_FUNCTIONS" || "SWF",
//         ],
//       },
//       AssociatedResourceArns: [ // AssociatedResourceArns
//         "STRING_VALUE",
//       ],
//     },
//   ],
//   ReactiveInsights: [ // ReactiveInsights
//     { // ReactiveInsightSummary
//       Id: "STRING_VALUE",
//       Name: "STRING_VALUE",
//       Severity: "LOW" || "MEDIUM" || "HIGH",
//       Status: "ONGOING" || "CLOSED",
//       InsightTimeRange: {
//         StartTime: new Date("TIMESTAMP"), // required
//         EndTime: new Date("TIMESTAMP"),
//       },
//       ResourceCollection: {
//         CloudFormation: {
//           StackNames: [
//             "STRING_VALUE",
//           ],
//         },
//         Tags: [
//           {
//             AppBoundaryKey: "STRING_VALUE", // required
//             TagValues: [ // required
//               "STRING_VALUE",
//             ],
//           },
//         ],
//       },
//       ServiceCollection: {
//         ServiceNames: [
//           "API_GATEWAY" || "APPLICATION_ELB" || "AUTO_SCALING_GROUP" || "CLOUD_FRONT" || "DYNAMO_DB" || "EC2" || "ECS" || "EKS" || "ELASTIC_BEANSTALK" || "ELASTI_CACHE" || "ELB" || "ES" || "KINESIS" || "LAMBDA" || "NAT_GATEWAY" || "NETWORK_ELB" || "RDS" || "REDSHIFT" || "ROUTE_53" || "S3" || "SAGE_MAKER" || "SNS" || "SQS" || "STEP_FUNCTIONS" || "SWF",
//         ],
//       },
//       AssociatedResourceArns: [
//         "STRING_VALUE",
//       ],
//     },
//   ],
//   NextToken: "STRING_VALUE",
// };

ListInsightsCommand Input

See ListInsightsCommandInput for more details

Parameter
Type
Description
StatusFilter
Required
ListInsightsStatusFilter | undefined

A filter used to filter the returned insights by their status. You can specify one status filter.

MaxResults
number | undefined

The maximum number of results to return with a single call. To retrieve the remaining results, make another call with the returned nextToken value.

NextToken
string | undefined

The pagination token to use to retrieve the next page of results for this operation. If this value is null, it retrieves the first page.

ListInsightsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
NextToken
string | undefined

The pagination token to use to retrieve the next page of results for this operation. If there are no more pages, this value is null.

ProactiveInsights
ProactiveInsightSummary[] | undefined

The returned list of proactive insights.

ReactiveInsights
ReactiveInsightSummary[] | undefined

The returned list of reactive insights.

Throws

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. For more information, see Access Management  in the IAM User Guide.

InternalServerException
server

An internal failure in an Amazon service occurred.

ThrottlingException
client

The request was denied due to a request throttling.

ValidationException
client

Contains information about data passed in to a field during a request that is not valid.

DevOpsGuruServiceException
Base exception class for all service exceptions from DevOpsGuru service.