All Products
Search
Document Center

CloudMonitor:DescribeMetricRuleTemplateList

Last Updated:Jul 26, 2024

Queries alert templates.

Operation description

This topic provides an example on how to query alert templates. In this example, the following alert templates are returned in the response: ECS_Template1 and ECS_Template2.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cms:DescribeMetricRuleTemplateListget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
NamestringNo

The name of the alert template.

ECS_Template1
KeywordstringNo

The keyword of the alert template name.

ECS
TemplateIdlongNo

The ID of the alert template.

70****
PageNumberlongNo

The page number.

Default value: 1.

1
PageSizelongNo

The number of entries per page.

10
HistorybooleanNo

Specifies whether to display the history of applying the alert templates to application groups. Valid values:

  • true
  • false (default)
false
OrderbooleanNo

The sorting order. Valid values:

  • true (default): ascending order
  • false: descending order
true
OrderBystringNo

The sorting basis. Valid values:

  • gmtMotified: sorts alert templates by modification time
  • gmtCreate (default): sorts alert templates by creation time
gmtCreate

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeDescriptionExample
object
Codeinteger

The status code.

Note The status code 200 indicates that the request was successful.
200
Messagestring

The error message.

The Request is not authorization.
RequestIdstring

The request ID.

659401C0-6214-5C02-972A-CFA929D717B7
Totallong

The total number of entries returned.

2
Successboolean

Indicates whether the request was successful. Valid values:

  • true
  • false
true
Templatesarray<object>

The queried alert templates.

object

None

Descriptionstring

The description of the alert template.

GmtCreatelong

The timestamp when the alert template was created.

Unit: milliseconds.

1646018798000
Namestring

The name of the alert template.

ECS_Template1
RestVersionlong

The version of the alert template.

Default value: 0.

0
GmtModifiedlong

The timestamp when the alert template was modified.

Unit: milliseconds.

1646054798000
TemplateIdlong

The ID of the alert template.

70****
ApplyHistoriesarray<object>

The history of applying the alert templates to application groups.

object

None

GroupIdlong

The ID of the application group.

3607****
GroupNamestring

The name of the application group.

ECS_Group
ApplyTimelong

The timestamp when the alert template was applied to the application group.

Unit: milliseconds.

1646055898000

Examples

Sample success responses

JSONformat

{
  "Code": 200,
  "Message": "The Request is not authorization.",
  "RequestId": "659401C0-6214-5C02-972A-CFA929D717B7",
  "Total": 2,
  "Success": true,
  "Templates": {
    "Template": [
      {
        "Description": "",
        "GmtCreate": 1646018798000,
        "Name": "ECS_Template1",
        "RestVersion": 0,
        "GmtModified": 1646054798000,
        "TemplateId": 0,
        "ApplyHistories": {
          "ApplyHistory": [
            {
              "GroupId": 0,
              "GroupName": "ECS_Group",
              "ApplyTime": 1646055898000
            }
          ]
        }
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400ParameterInvalidIllegal parameters.-
403AccessForbiddenUser not authorized to operate on the specified resource.-
404ResourceNotFoundThe specified resource is not found.The specified resource is not found.
500InternalErrorThe request processing has failed due to some unknown error.-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2022-03-22The Error code has changed. The request parameters of the API has changedView Change Details