PutEventRuleTargets

更新时间:
复制 MD 格式

Adds or modifies the notification channels of an event-triggered alert rule by calling the PutEventRuleTargets operation.

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:PutEventRuleTargets

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

RuleName

string

Yes

The name of the alert rule.

testEventRule

FcParameters

array<object>

No

The Function Compute notification method.

object

No

None.

FunctionName

string

No

The name of the function. Valid values of N: 1 to 5.

fc-test

Region

string

No

The region where the Function Compute service resides. Valid values of N: 1 to 5.

cn-hangzhou

ServiceName

string

No

The service name of the Function Compute service. Valid values of N: 1 to 5.

fc-test

Id

string

No

The unique identifier of the rule target. Valid values of N: 1 to 5.

1

ContactParameters

array<object>

No

The alert contact group notification method.

object

No

None.

ContactGroupName

string

No

The name of the alert contact group. Valid values of N: 1 to 5.

Default alert contact group

Id

string

No

The unique identifier of the rule target. Valid values of N: 1 to 5.

2

Level

string

No

The alert notification level. Valid values of N: 1 to 5. Valid values:

  • 2: phone call, text message, DingTalk, and email

  • 3: text message, DingTalk, and email

  • 4: DingTalk and email

.

4

MnsParameters

array<object>

No

The Simple Message Queue (formerly MNS) notification method.

object

No

None.

Region

string

No

The region where Simple Message Queue (formerly MNS) resides. Valid values of N: 1 to 5.

cn-hangzhou

Queue

string

No

The name of the queue. Valid values of N: 1 to 5.

queue1

Id

string

No

The unique identifier of the rule target. Valid values of N: 1 to 5.

3

Topic

string

No

The topic of Simple Message Queue (formerly MNS).

topic_sample

WebhookParameters

array<object>

No

The URL callback notification method.

object

No

None.

Protocol

string

No

The protocol name. Valid values of N: 1 to 5. Valid values:

  • http

  • telnet

  • ping.

http

Url

string

No

The callback URL. Valid values of N: 1 to 5.

http://www.aliyun.com

Method

string

No

The request method of the HTTP callback. Valid values of N: 1 to 5.

Only GET and POST are supported.

GET

Id

string

No

The unique identifier of the rule target. Valid values of N: 1 to 5.

4

SlsParameters

array<object>

No

The Simple Log Service notification method.

object

No

None.

LogStore

string

No

The Logstore of Simple Log Service. Valid values of N: 1 to 5.

testlogstore

Region

string

No

The region where Simple Log Service resides. Valid values of N: 1 to 5.

cn-hangzhou

Project

string

No

The project of Simple Log Service. Valid values of N: 1 to 5.

testproject

Id

string

No

The unique identifier of the rule target. Valid values of N: 1 to 5.

5

OpenApiParameters

array<object>

No

The list of API callback notification parameters.

object

No

None.

Action

string

No

The API name.

PutLogs

Arn

string

No

The Alibaba Cloud Resource Name (ARN) of the resource. Valid values of N: 1 to 5. Format: arn:acs:${Service}:${Region}:${Account}:${ResourceType}/${ResourceId}. The fields are described as follows:

  • Service: the Alibaba Cloud service.

  • Region: the region ID.

  • Account: the Alibaba Cloud account ID.

  • ResourceType: the resource type.

  • ResourceId: the resource ID.

acs:log:cn-hangzhou::project/cms-log-mon***/logstore/cxxxx***

Id

string

No

The unique identifier of the API callback notification method.

3

Product

string

No

The ID of the Alibaba Cloud service to which the API belongs.

log

Region

string

No

The region where the resource resides.

cn-hangzhou

Role

string

No

The role name.

MyRole

Version

string

No

The API version.

2019-01-01

JsonParams

string

No

The JSON-formatted parameters of the alert callback.

{"customField1":"value1","customField2":"$.name"}

Response elements

Element

Type

Description

Example

object

Code

string

The status code.

Note

The value 200 indicates success.

200

Message

string

The error message.

The Request is not authorization.

RequestId

string

The request ID.

409C64DA-CF14-45DF-B463-471C790DD15A

Success

boolean

Indicates whether the operation was successful. The value true indicates success. The value false indicates failure.

true

FailedParameterCount

string

The number of failed parameters.

2

FailedContactParameters

object

ContactParameter

array<object>

This parameter is returned if the rule targets contain an alert contact group that failed to be created.

object

None.

ContactGroupName

string

The name of the alert contact group.

Default alert contact group

Id

integer

The ID of the recipient.

2

Level

string

The alert notification methods. Valid values:

4: Alert notifications are sent by using DingTalk and emails.

4

FailedMnsParameters

object

MnsParameter

array<object>

This parameter is returned if the rule targets contain a Simple Message Queue (formerly MNS) instance that failed to be created.

object

None.

Queue

string

The name of the MNS queue.

testQueue

Id

integer

The ID of the recipient.

2

Region

string

The region ID.

cn-hangzhou

FailedFcParameters

object

FcParameter

array<object>

This parameter is returned if the rule targets contain a Function Compute service that failed to be created.

object

None.

ServiceName

string

The name of the Function Compute service.

serviceTest1

FunctionName

string

The name of the function.

functionTest1

Id

integer

The ID of the recipient.

1

Region

string

The region ID.

cn-hangzhou

Examples

Success response

JSON format

{
  "Code": "200",
  "Message": "The Request is not authorization.",
  "RequestId": "409C64DA-CF14-45DF-B463-471C790DD15A",
  "Success": true,
  "FailedParameterCount": "2",
  "FailedContactParameters": {
    "ContactParameter": [
      {
        "ContactGroupName": "Default alert contact group",
        "Id": 2,
        "Level": "4"
      }
    ]
  },
  "FailedMnsParameters": {
    "MnsParameter": [
      {
        "Queue": "testQueue",
        "Id": 2,
        "Region": "cn-hangzhou"
      }
    ]
  },
  "FailedFcParameters": {
    "FcParameter": [
      {
        "ServiceName": "serviceTest1",
        "FunctionName": "functionTest1",
        "Id": 1,
        "Region": "cn-hangzhou"
      }
    ]
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 %s %s
500 %s %s
500 InternalError The request processing has failed due to some unknown error.
403 %s %s
404 %s %s

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.