ListNotifyPolicies

Updated at:

Lists notification policies.

Operation description

Queries notification policies in a specified workspace by using paging and supports fuzzy filtering by name. The response contains a list of NotifyPolicySummary lightweight views.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

cms:ListNotifyPolicies

list

*Workspace

acs:cms:{#regionId}:{#accountId}:workspace/{#WorkspaceName}

None None

Request syntax

GET /api/eventbase/notify-policies HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

workspace

string

Yes

The workspace ID, which is used to isolate notification policy resources across different business workspaces.

default-cms-xxxx-cn-hangzhou

maxResults

integer

No

The maximum number of entries to return for this request.

10

nextToken

string

No

The pagination token. Leave this parameter empty for the first request. For subsequent requests, pass the nextToken value returned from the previous response.

eyJjdXJzb3IiOjEwfQ==

name

string

No

The keyword for fuzzy filtering by policy name.

prod-alert

orderBy

string

No

The field by which to sort the results. Valid values: createTime, updateTime, and name.

createTime

orderDesc

string

No

Specifies whether to sort the results in descending order. A value of true indicates descending order, and a value of false indicates ascending order.

true

The workspace parameter is required. The maxResults and nextToken parameters are used for pagination. The name parameter supports fuzzy filtering by policy name.

Response elements

Element

Type

Description

Example

object

Schema of Response

requestId

string

The unique ID of the request, which is used for troubleshooting and ticket tracking.

0B9377D9-C56B-5C2E-A8A4-A01D6CC3F4B8

notifyPolicyList

array

The list of notification policies. Each item is of the NotifyPolicySummary type, which represents a lightweight view.

[{"uuid":"np-12345678-1234-1234-1234-123456789012","name":"prod-alert","description":"Production environment alert policy","enabled":true,"version":1,"workspace":"default-cms-xxxx-cn-hangzhou","userId":"107640","createTime":"1711792800000","updateTime":"1711792800000"}]

NotifyPolicySummary

The notification policy summary element, which is of the NotifyPolicySummary type.

nextToken

string

The pagination token for the next page. This parameter is empty if no more data is available.

eyJjdXJzb3IiOjEwfQ==

maxResults

integer

The maximum number of entries returned for this request.

10

totalCount

integer

The total number of entries. The actual total count is returned for the first page, and -1 is returned for subsequent pages.

100

The notifyPolicyList parameter is a list of policy summaries. The totalCount parameter returns the actual total count for the first page and -1 for subsequent pages.

Examples

Success response

JSON format

{
  "requestId": "0B9377D9-C56B-5C2E-A8A4-A01D6CC3F4B8",
  "notifyPolicyList": [
    {
      "uuid": "ns-uuid-001",
      "name": "Sample notification policy",
      "description": "A notification policy for testing",
      "enabled": true,
      "version": 1,
      "workspace": "default",
      "userId": "1234567890",
      "createTime": "1700000000000",
      "updateTime": "1700000000000",
      "notifyStrategy": {
        "description": "Production environment alert notification policy",
        "ignoreRestoredNotification": true,
        "groupingSetting": {
          "groupingKeys": [
            "alertname"
          ],
          "periodMin": 0,
          "silenceSec": 0,
          "times": 0
        },
        "routes": [
          {
            "channels": [
              {
                "channelType": "DING",
                "enabledSubChannels": [
                  "EMAIL"
                ],
                "receivers": [
                  "webhook-uuid-xxx"
                ]
              }
            ],
            "effectTimeRange": {
              "dayInWeek": [
                0
              ],
              "startTimeInMinute": 0,
              "endTimeInMinute": 1439,
              "timeZone": "Asia/Shanghai"
            },
            "filterSetting": {
              "conditions": [
                {
                  "field": "labels.alertname\t",
                  "op": "EQ",
                  "value": "CRITICAL"
                }
              ],
              "expression": "1 and 2 or 3",
              "relation": "AND"
            },
            "digitalEmployeeName": "Digital employee name",
            "enableRca": false
          }
        ],
        "customTemplateEntries": [
          {
            "templateUuid": "template-uuid-xxx"
          }
        ]
      }
    }
  ],
  "nextToken": "eyJjdXJzb3IiOjEwfQ==",
  "maxResults": 10,
  "totalCount": 100
}

Error codes

HTTP status code

Error code

Error message

Description

400 ParameterInvalid The parameter is missing or invalid. %s The parameter is missing or invalid.
500 InternalUnknownError The request processing has failed due to some unknown error. A service runtime error occurred.
403 Forbidden You are not authorized to operate the specified resource. No permission, please use RAM to authorize

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.