SearchInsightsCommand

Returns a list of insights in your Amazon Web Services account. You can specify which insights are returned by their start time, one or more statuses (ONGOING or CLOSED), one or more severities (LOW, MEDIUM, and HIGH), and type (REACTIVE or PROACTIVE).

Use the Filters parameter to specify status and severity search parameters. Use the Type parameter to specify REACTIVE or PROACTIVE in your search.

Example Syntax

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

import { DevOpsGuruClient, SearchInsightsCommand } from "@aws-sdk/client-devops-guru"; // ES Modules import
// const { DevOpsGuruClient, SearchInsightsCommand } = require("@aws-sdk/client-devops-guru"); // CommonJS import
const client = new DevOpsGuruClient(config);
const input = { // SearchInsightsRequest
  StartTimeRange: { // StartTimeRange
    FromTime: new Date("TIMESTAMP"),
    ToTime: new Date("TIMESTAMP"),
  },
  Filters: { // SearchInsightsFilters
    Severities: [ // InsightSeverities
      "LOW" || "MEDIUM" || "HIGH",
    ],
    Statuses: [ // InsightStatuses
      "ONGOING" || "CLOSED",
    ],
    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",
      ],
    },
  },
  MaxResults: Number("int"),
  NextToken: "STRING_VALUE",
  Type: "REACTIVE" || "PROACTIVE", // required
};
const command = new SearchInsightsCommand(input);
const response = await client.send(command);
// { // SearchInsightsResponse
//   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",
// };

SearchInsightsCommand Input

See SearchInsightsCommandInput for more details

Parameter
Type
Description
StartTimeRange
Required
StartTimeRange | undefined

The start of the time range passed in. Returned insights occurred after this time.

Type
Required
InsightType | undefined

The type of insights you are searching for (REACTIVE or PROACTIVE).

Filters
SearchInsightsFilters | undefined

A SearchInsightsFilters object that is used to set the severity and status filters on your insight search.

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.

SearchInsightsCommand 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 proactive insights.

ReactiveInsights
ReactiveInsightSummary[] | undefined

The returned 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.