Associates resources with a specified event-triggered alert rule or modifies the resources that are associated with the event-triggered alert rule.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes PutEventRuleTargets

The operation that you want to perform. Set the value to PutEventRuleTargets.

RuleName String Yes testEventRule

The name of the event-triggered alert rule.

For information about how to obtain the name of an event-triggered alert rule, see DescribeEventRuleList.

FcParameters.N.FunctionName String No fc-test

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

FcParameters.N.Region String No cn-hangzhou

The region where Function Compute is deployed. Valid values of N: 1 to 5.

FcParameters.N.ServiceName String No fc-test

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

FcParameters.N.Id String No 1

The ID of the recipient that receives alert notifications. Valid values of N: 1 to 5.

ContactParameters.N.ContactGroupName String No ECS_Group

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

ContactParameters.N.Id String No 2

The ID of the recipient that receives alert notifications. Valid values of N: 1 to 5.

ContactParameters.N.Level String No 3

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

  • 4: Alert notifications are sent by using DingTalk chatbots and emails.
MnsParameters.N.Region String No cn-hangzhou

The region where Message Service (MNS) is deployed. Valid values of N: 1 to 5.

MnsParameters.N.Queue String No queue1

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

MnsParameters.N.Id String No 3

The ID of the recipient that receives alert notifications. Valid values of N: 1 to 5.

WebhookParameters.N.Protocol String No HTTP

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

  • HTTP
  • Telnet
  • Ping
WebhookParameters.N.Url String No http://www.aliyun.com

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

WebhookParameters.N.Method String No GET

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

Valid values: GET and POST.

WebhookParameters.N.Id String No 4

The ID of the recipient that receives alert notifications. Valid values of N: 1 to 5.

SlsParameters.N.LogStore String No testlogstore

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

SlsParameters.N.Region String No cn-hangzhou

The region where Log Service is deployed. Valid values of N: 1 to 5.

SlsParameters.N.Project String No testproject

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

SlsParameters.N.Id String No 5

The ID of the recipient that receives alert notifications. Valid values of N: 1 to 5.

OpenApiParameters.N.Action String No PutLogs

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

OpenApiParameters.N.Arn String No acs:log:cn-hangzhou::project/cms-log-mon***/logstore/cxxxx***

The Alibaba Cloud Resource Name (ARN) of the resource. Valid values of N: 1 to 5.

Format: arn:acs:${Service}:${Region}:${Account}:${ResourceType}/${ResourceId}. Fields:

  • Service: the code of a cloud service
  • Region: the region ID
  • Account: the ID of an Alibaba Cloud account
  • ResourceType: the resource type
  • ResourceId: the resource ID
OpenApiParameters.N.Id String No 3

The ID of the recipient that receives alert notifications sent by an API callback. Valid values of N: 1 to 5.

OpenApiParameters.N.Product String No log

The ID of the cloud service to which the API operation belongs. Valid values of N: 1 to 5.

OpenApiParameters.N.Region String No cn-hangzhou

The region where the resource resides. Valid values of N: 1 to 5.

OpenApiParameters.N.Role String No MyRole

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

OpenApiParameters.N.Version String No 2019-01-01

The version of the API. Valid values of N: 1 to 5.

OpenApiParameters.N.JsonParams String No {"customField1":"value1","customField2":"$.name"}

The parameters of the alert callback. The parameters are in the JSON format. Valid values of N: 1 to 5.

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

Response parameters

Parameter Type Example Description
RequestId String 409C64DA-CF14-45DF-B463-471C790DD15A

The ID of the request.

Code String 200

The HTTP status code.

Note The status code 200 indicates that the call was successful.
Success Boolean true

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.
FailedParameterCount String 2

The number of resources that failed to be created or modified.

FailedFcParameters Array of FcParameter

This parameter is returned if the specified functions in the request failed to be created or modified in Function Compute.

FcParameter
FunctionName String functionTest1

The name of the function.

Id Integer 1

The ID of the recipient.

Region String cn-hangzhou

The ID of the region.

ServiceName String serviceTest1

The name of the Function Compute service.

FailedMnsParameters Array of MnsParameter

This parameter is returned if the specified queues in the request failed to be created or modified in MNS.

MnsParameter
Id Integer 2

The ID of the recipient.

Queue String testQueue

The name of the MNS queue.

Region String cn-hangzhou

The ID of the region.

FailedContactParameters Array of ContactParameter

This parameter is returned if the specified alert contact groups in the request failed to be created or modified.

ContactParameter
ContactGroupName String Default alert group

The name of the alert contact group.

Id Integer 2

The ID of the recipient.

Level String 3

The alert notification methods. Valid value:

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

Message String The request processing has failed due to some unknown error.

The error message.

Examples

Sample requests

http(s)://[Endpoint]/?Action=PutEventRuleTargets
&RuleName=testEventRule
&<Common request parameters>

Sample success responses

XML format

<DeleteCustomMetricResponse>
		  <RequestId>681CC49A-DD28-4D11-B86F-19D3F71E0EAE</RequestId>
		  <Code>200</Code>
		  <Success>true</Success>
</DeleteCustomMetricResponse>

JSON format

{
	"RequestId": "681CC49A-DD28-4D11-B86F-19D3F71E0EAE",
	"Code": "200",
	"Success": true
}

Error codes

For a list of error codes, visit the API Error Center.