Updated on 2023-11-15 GMT+08:00

Configuring Exception Notifications

Function

  • This API is used to set alarm information in batches. This parameter cannot be set for stopped tasks.
  • You can select an existing SMN topic or manually enter a mobile number or email address.

Debugging

You can debug the API in API Explorer to support automatic authentication. API Explorer can automatically generate and debug example SDK code.

URI

POST /v3/{project_id}/jobs/batch-set-smn

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

For details about how to obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM.

X-Language

No

String

Request language type.

Default value: en-us

Enumerated values:

  • en-us
  • zh-cn

Content-Type

Yes

String

Content type, which is application/json.

The default value is application/json.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

jobs

Yes

Array of objects

Task information.

For details, see Table 4.

alarm_notify_info

Yes

Object

Notification method and information.

For details, see Table 5.

Table 4 Data structure description of field jobs

Parameter

Mandatory

Type

Description

job_id

Yes

String

Task ID.

status

Yes

String

Task status.

engine_type

Yes

String

Engine type of a DRS task. The value can be:

  • mysql: used for migration and synchronization from MySQL to MySQL
  • mongodb: used for migration from MongoDB to DDS
  • cloudDataGuard-mysql: used for DR from MySQL to MySQL
  • gaussdbv5: used for GaussDB synchronization
  • mysql-to-kafka: used for synchronization from MySQL to Kafka
  • taurus-to-kafka: used for synchronization from GaussDB(for MySQL) to Kafka
  • gaussdbv5ha-to-kafka: used for synchronization from GaussDB primary/standby to Kafka
  • postgresql: used for synchronization from PostgreSQL to PostgreSQL

For details, see Engine Types.

Table 5 Data structure description of field alarm_notify_info

Parameter

Mandatory

Type

Description

subscriptions

No

Array of objects

Entered when the mobile number or email address is manually entered.

For details, see Table 6.

topic_urn

No

String

Topic resource ID.

delay_time

No

Long

Subscription delay.

rto_delay

No

Long

RTO delay.

rpo_delay

No

Long

RPO delay.

alarm_to_user

No

Boolean

Whether to notify users of abnormal alarms. If this parameter is not specified, the default value is false.

Table 6 Data structure description of field subscriptions

Parameter

Mandatory

Type

Description

endpoints

No

Array of strings

SMS or email list.

protocol

No

String

Notification methods. sms: SMS; email: Email.

Enumerated values:

  • sms
  • email

Response Parameters

Status code: 200

Table 7 Response body parameters

Parameter

Type

Description

results

Array of objects

Response body for inputting SMN.

For details, see Table 8.

count

Integer

Total number of input SMNs.

Table 8 Data structure description of field results

Parameter

Type

Description

id

String

Task ID.

status

String

Task status.

error_code

String

Error code.

error_msg

String

Error message.

Example Request

  • Associating an existing SMN topic with a MySQL task that is being configuring
    https://{endpoint}/v3/0ac6eb2c8000d2ee2fd9c006dededbe6/jobs/batch-set-smn
    
    {
      "jobs" : [ {
        "job_id" : "c7296a3b-0d9f-424c-8d74-816ca62jb2a2",
        "status" : "CONFIGURATION",
        "engine_type" : "mysql"
      } ],
      "alarm_notify_info" : {
        "topic_urn" : "urn:smn:cn-north-7:04f9aca88c00d3202fd4c01ed679daf0:drs-zw",
        "delay_time" : 1200
      }
    }
  • Manually entering the mobile number and email address for an incremental task
    https://{endpoint}/v3/0ac6eb2c8000d2ee2fd9c006dededbe6/jobs/batch-set-smn
    
    {
      "jobs" : [ {
        "job_id" : "2b36da5c-44a7-41af-8889-247b14djb2a2",
        "status" : "INCRE_TRANSFER_STARTED",
        "engine_type" : "oracle-to-dws"
      } ],
      "alarm_notify_info" : {
        "subscriptions" : [ {
          "protocol" : "sms",
          "endpoints" : [ "12345678910" ]
        }, {
          "protocol" : "email",
          "endpoints" : [ "123456@abc.com" ]
        } ],
        "delay_time" : 100
      }
    }

Example Response

Status code: 200

OK

{
  "count" : 1,
  "results" : [ {
    "id" : "ed3723ca-d34a-42b0-9829-0baef12jb20b",
    "status" : "success"
  } ]
}

Status Code

Status Code

Description

200

OK

Error Code

For details, see Error Code.