Amazon CloudWatch

2022/08/18 - Amazon CloudWatch - 2 new 1 updated api methods

Changes  Add support for managed Contributor Insights Rules

PutManagedInsightRules (new) Link ¶

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.

See also: AWS API Documentation

Request Syntax

client.put_managed_insight_rules(
    ManagedRules=[
        {
            'TemplateName': 'string',
            'ResourceARN': 'string',
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ]
        },
    ]
)
type ManagedRules

list

param ManagedRules

[REQUIRED]

A list of ManagedRules to enable.

  • (dict) --

    Contains the information that's required to enable a managed Contributor Insights rule for an Amazon Web Services resource.

    • TemplateName (string) -- [REQUIRED]

      The template name for the managed Contributor Insights rule, as returned by ListManagedInsightRules .

    • ResourceARN (string) -- [REQUIRED]

      The ARN of an Amazon Web Services resource that has managed Contributor Insights rules.

    • Tags (list) --

      A list of key-value pairs that you can associate with a managed Contributor Insights rule. You can associate as many as 50 tags with a rule. Tags can help you organize and categorize your resources. You also can use them to scope user permissions by granting a user permission to access or change only the resources that have certain tag values. To associate tags with a rule, you must have the cloudwatch:TagResource permission in addition to the cloudwatch:PutInsightRule permission. If you are using this operation to update an existing Contributor Insights rule, any tags that you specify in this parameter are ignored. To change the tags of an existing rule, use TagResource .

      • (dict) --

        A key-value pair associated with a CloudWatch resource.

        • Key (string) -- [REQUIRED]

          A string that you can use to assign a value. The combination of tag keys and values can help you organize and categorize your resources.

        • Value (string) -- [REQUIRED]

          The value for the specified tag key.

rtype

dict

returns

Response Syntax

{
    'Failures': [
        {
            'FailureResource': 'string',
            'ExceptionType': 'string',
            'FailureCode': 'string',
            'FailureDescription': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • Failures (list) --

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

      • (dict) --

        This array is empty if the API operation was successful for all the rules specified in the request. If the operation could not process one of the rules, the following data is returned for each of those rules.

        • FailureResource (string) --

          The specified rule that could not be deleted.

        • ExceptionType (string) --

          The type of error.

        • FailureCode (string) --

          The code of the error.

        • FailureDescription (string) --

          A description of the error.

ListManagedInsightRules (new) Link ¶

Returns a list that contains the number of managed Contributor Insights rules in your account.

See also: AWS API Documentation

Request Syntax

client.list_managed_insight_rules(
    ResourceARN='string',
    NextToken='string',
    MaxResults=123
)
type ResourceARN

string

param ResourceARN

[REQUIRED]

The ARN of an Amazon Web Services resource that has managed Contributor Insights rules.

type NextToken

string

param NextToken

Include this value to get the next set of rules if the value was returned by the previous operation.

type MaxResults

integer

param MaxResults

The maximum number of results to return in one operation. If you omit this parameter, the default number is used. The default number is 100 .

rtype

dict

returns

Response Syntax

{
    'ManagedRules': [
        {
            'TemplateName': 'string',
            'ResourceARN': 'string',
            'RuleState': {
                'RuleName': 'string',
                'State': 'string'
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • ManagedRules (list) --

      The managed rules that are available for the specified Amazon Web Services resource.

      • (dict) --

        Contains information about managed Contributor Insights rules, as returned by ListManagedInsightRules .

        • TemplateName (string) --

          The template name for the managed rule. Used to enable managed rules using PutManagedInsightRules .

        • ResourceARN (string) --

          If a managed rule is enabled, this is the ARN for the related Amazon Web Services resource.

        • RuleState (dict) --

          Describes the state of a managed rule. If present, it contains information about the Contributor Insights rule that contains information about the related Amazon Web Services resource.

          • RuleName (string) --

            The name of the Contributor Insights rule that contains data for the specified Amazon Web Services resource.

          • State (string) --

            Indicates whether the rule is enabled or disabled.

    • NextToken (string) --

      Include this value to get the next set of rules if the value was returned by the previous operation.

DescribeInsightRules (updated) Link ¶
Changes (response)
{'InsightRules': {'ManagedRule': 'boolean'}}

Returns a list of all the Contributor Insights rules in your account.

For more information about Contributor Insights, see Using Contributor Insights to Analyze High-Cardinality Data .

See also: AWS API Documentation

Request Syntax

client.describe_insight_rules(
    NextToken='string',
    MaxResults=123
)
type NextToken

string

param NextToken

Include this value, if it was returned by the previous operation, to get the next set of rules.

type MaxResults

integer

param MaxResults

The maximum number of results to return in one operation. If you omit this parameter, the default of 500 is used.

rtype

dict

returns

Response Syntax

{
    'NextToken': 'string',
    'InsightRules': [
        {
            'Name': 'string',
            'State': 'string',
            'Schema': 'string',
            'Definition': 'string',
            'ManagedRule': True|False
        },
    ]
}

Response Structure

  • (dict) --

    • NextToken (string) --

      If this parameter is present, it is a token that marks the start of the next batch of returned results.

    • InsightRules (list) --

      The rules returned by the operation.

      • (dict) --

        This structure contains the definition for a Contributor Insights rule. For more information about this rule, see`Using Constributor Insights to analyze high-cardinality data <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContributorInsights.html>`__ in the Amazon CloudWatch User Guide .

        • Name (string) --

          The name of the rule.

        • State (string) --

          Indicates whether the rule is enabled or disabled.

        • Schema (string) --

          For rules that you create, this is always {"Name": "CloudWatchLogRule", "Version": 1} . For managed rules, this is {"Name": "ServiceLogRule", "Version": 1}

        • Definition (string) --

          The definition of the rule, as a JSON object. The definition contains the keywords used to define contributors, the value to aggregate on if this rule returns a sum instead of a count, and the filters. For details on the valid syntax, see Contributor Insights Rule Syntax .

        • ManagedRule (boolean) --

          An optional built-in rule that Amazon Web Services manages.