PutManagedInsightRulesCommand

Creates a managed Contributor Insights rule for a specified Amazon Web Services resource. When you enable a managed rule, you create a Contributor Insights rule that collects data from Amazon Web Services services. You cannot edit these rules with PutInsightRule. The rules can be enabled, disabled, and deleted using EnableInsightRules, DisableInsightRules, and DeleteInsightRules. If a previously created managed rule is currently disabled, a subsequent call to this API will re-enable it. Use ListManagedInsightRules to describe all available rules.

Example Syntax

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

import { CloudWatchClient, PutManagedInsightRulesCommand } from "@aws-sdk/client-cloudwatch"; // ES Modules import
// const { CloudWatchClient, PutManagedInsightRulesCommand } = require("@aws-sdk/client-cloudwatch"); // CommonJS import
const client = new CloudWatchClient(config);
const input = { // PutManagedInsightRulesInput
  ManagedRules: [ // ManagedRules // required
    { // ManagedRule
      TemplateName: "STRING_VALUE", // required
      ResourceARN: "STRING_VALUE", // required
      Tags: [ // TagList
        { // Tag
          Key: "STRING_VALUE", // required
          Value: "STRING_VALUE", // required
        },
      ],
    },
  ],
};
const command = new PutManagedInsightRulesCommand(input);
const response = await client.send(command);
// { // PutManagedInsightRulesOutput
//   Failures: [ // BatchFailures
//     { // PartialFailure
//       FailureResource: "STRING_VALUE",
//       ExceptionType: "STRING_VALUE",
//       FailureCode: "STRING_VALUE",
//       FailureDescription: "STRING_VALUE",
//     },
//   ],
// };

PutManagedInsightRulesCommand Input

Parameter
Type
Description
ManagedRules
Required
ManagedRule[] | undefined

A list of ManagedRules to enable.

PutManagedInsightRulesCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
Failures
PartialFailure[] | undefined

An array that lists the rules that could not be enabled.

Throws

Name
Fault
Details
InvalidParameterValueException
client

The value of an input parameter is bad or out-of-range.

MissingRequiredParameterException
client

An input parameter that is required is missing.

CloudWatchServiceException
Base exception class for all service exceptions from CloudWatch service.