Document navigation

SNS

The Simple Notification System (SNS) is composed of three major parts: topic, application platform, and application endpoint.

  • Topic: a logical access point that acts as a communication channel to receive messages. For example, ZWatch can send alarm messages to a topic, and then the topic distributes the messages to the corresponding subscribed endpoints.
  • Application platform: the platform through which messages are sent to specific endpoints. For example, an email server is needed if you want to send messages to an email endpoint. The email server mentioned above is an application platform. Currently, two platforms are available: email server and system platform. The system platform is used to send messages to endpoints that do not need a platform, such as DingTalk and HTTP webhook.
  • Application endpoint: the endpoint used to receive messages. Currently, the following application endpoints are available: system endpoint, email, DingTalk, HTTP application, and short message service, and Microsoft Service. Before an endpoint can receive messages from a topic, the endpoint must be subscribed to the topic.
Note: Topic has a many-to-many relationship with endpoint. That is, a topic can be subscribed by multiple endpoints, and an endpoint can also subscribe to multiple topics.

When an external system (such as ZWatch) sends a message to a topic, the topic will find all the endpoints that subscribed to the topic, and then send the message through the platform to which the endpoints belong. Assume that you subscribed an email endpoint (an email address) to a topic. When the topic receives an alarm message, it will send an alarm email to the endpoint represented by the email address through the platform (an email server) to which the email endpoint belongs.

Basic Workflow

The basic workflow of SNS is as follows:
  1. Create an SNS topic to receive alarm messages from external systems such as ZWatch.
  2. Create an application platform (an email server) if you use the email endpoint.
  3. Create an endpoint and subscribe the endpoint to the SNS topic you created in Step 1.

CreateSNSTopic

Creates a topic. For example,
CreateSNSTopic name=alarm-topic
{
    "inventory": {
        "createDate": "Jan 25, 2018 8:28:01 PM",
        "lastOpDate": "Jan 25, 2018 8:28:01 PM",
        "name": "alarm-topic",
        "state": "Enabled",
        "uuid": "e034cef9ad3d43e0b3f9c0a316a0f25a"
    },
    "success": true
}

Parameters

Name Description Optional Valid Value Starting Version
name The resource name. 2.3
description The detailed description of the resource. Yes 2.3
resourceUuid Yes 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

DeleteSNSTopic

Deletes a topic. After a topic is deleted, the associated endpoint will be automatically unsubscribed from the topic. For example,
DeleteSNSTopic uuid=e034cef9ad3d43e0b3f9c0a316a0f25a

Parameters

Name Description Optional Valid Value Starting Version
uuid The resource UUID. 2.3
deleteMode Yes 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

ChangeSNSTopicState

Enables or disables a topic. After a topic is disabled, messages sent to the topic are automatically ignored and will not be distributed to the subscribed endpoint.

ChangeSNSTopicState uuid=e034cef9ad3d43e0b3f9c0a316a0f25a stateEvent=disable

Parameters

Name Description Optional Valid Value Starting Version
uuid The resource UUID. 2.3
stateEvent The state event.
  • enable
  • disable
2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

UpdateSNSTopic

Changes the name of a topic, or modifies the topic description. For example,
UpdateSNSTopic name=new-topic-name uuid=e034cef9ad3d43e0b3f9c0a316a0f25a

Parameters

Name Description Optional Valid Value Starting Version
uuid The resource UUID. 2.3
name The resource name. Yes 2.3
description The detailed description of the resource. Yes 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

QuerySNSTopic

Queries a topic. For example,

QuerySNSTopic uuid=b86c9016b4f24953a9edefb53ca0678c

Primitive Fields of Query

Name Description Optional Valid Value Starting Version
uuid The UUID. For more information, see Resource Property. 2.3
name The name. For more information, see Resource Property. 2.3
description The description. For more information, see Resource Property. Yes 2.3
state The state. 2.3
groupBy Groups rows into subgroups based on values of columns or expressions. This field is equivalent to the Group By clause in MySQL, such as groupBy=type. Yes 2.3
createDate The creation date. For more information, see Resource Property. 2.3
lastOpDate The last operation date. For more information, see Resource Property. 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3

Nested and Expanded Fields of Query

Field Inventory Description Starting Version
endpoints Endpoints Inventory 2.3

CreateSNSEmailPlatform

Creates an email platform (email server). For example,

CreateSNSEmailPlatform name=my-sftp-server smtpServer=mail.zstack.org smtpPort=25 username=support@cloud.io password=password
{
    "inventory": {
        "createDate": "Jan 25, 2018 8:43:32 PM",
        "lastOpDate": "Jan 25, 2018 8:43:32 PM",
        "name": "my-sftp-server",
        "smtpPort": 25,
        "smtpServer": "mail.zstack.org",
        "state": "Enabled",
        "type": "Email",
        "username": "support@cloud.io",
        "uuid": "bec03e2d93224c7381782833e8b685ca"
    },
    "success": true
}

Parameters

Name Description Optional Valid Value Starting Version
smtpServer The SMTP server address. 2.3
smtpPort The SMTP port. 2.3
username The username. 2.3
password The password. Yes 2.3
name The resource name. 2.3
description The detailed description of the resource. Yes 2.3
resourceUuid Yes 2.3
encryptType Yes
  • SSL
  • STARTTLS
  • NONE
2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The user tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes
Note:
  • When you add an email server, the system will automatically detect whether the username, password, email server address, email server port, and encryption type are correct. The waiting time does not exceed 5 seconds.

ValidateSNSEmailPlatform

Tests whether an email platform (email server) is available. For example,

ValidateSNSEmailPlatform uuid=bec03e2d93224c7381782833e8b685ca

Parameters

Name Description Optional Valid Value Starting Version
uuid The resource UUID. 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

DeleteSNSApplicationPlatform

Deletes an application platform. For example,
DeleteSNSApplicationPlatform uuid=bec03e2d93224c7381782833e8b685ca

Parameters

Name Description Optional Valid Value Starting Version
uuid The resource UUID. 2.3
deleteMode Yes 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

QuerySNSEmailPlatform

Queries an email platform (email server). For example,
QuerySNSEmailPlatform smtpServer=mail.zstack.org

UpdateSNSApplicationPlatform

Updates an application platform. For example,
UpdateSNSApplicationPlatform uuid=b86c9016b4f24953a9edefb53ca0678c

Parameters

Name Description Optional Valid Value Starting Version
uuid The resource UUID. 2.3
name The resource name. Yes 2.3
description The detailed description of the resource. Yes 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

QuerySNSApplicationPlatform

Queries an application platform. For example,

QuerySNSApplicationPlatform uuid=b3454k6ll687h23345jh24hk5

Primitive Fields of Query

Name Description Optional Valid Value Starting Version
uuid The UUID. For more information, see Resource Property. 2.3
name The name. For more information, see Resource Property. 2.3
description The description. For more information, see Resource Property. Yes 2.3
type The type. 2.3
groupBy Groups rows into subgroups based on values of columns or expressions. This field is equivalent to the Group By clause in MySQL, such as groupBy=type. Yes 2.3
createDate The creation date. For more information, see Resource Property. 2.3
lastOpDate The last operation date. For more information, see Resource Property. 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3

Nested and Expanded Fields of Query

Field Inventory Description Starting Version
endpoints Endpoints Inventory 2.3

ChangeSNSApplicationPlatformState

Enables or disables an application platform. After the platform is disabled, you can no longer send emails to an endpoint through this platform.

ChangeSNSApplicationPlatformState uuid=bec03e2d93224c7381782833e8b685ca stateEvent=disable

Parameters

Name Description Optional Valid Value Starting Version
uuid The resource UUID. 2.3
stateEvent The state event.
  • enable
  • disable
2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

CreateSNSEmailEndpoint

Creates an email endpoint. For example,

CreateSNSEmailEndpoint name=operator email=operator@zstack.org

Parameters

Name Description Optional Valid Value Starting Version
email The email address. 2.3.0
emails Yes 3.7.0
name The resource name. 2.3.0
description The detailed description of the resource. Yes 2.3.0
platformUuid The application platform UUID. Yes 2.3.0
resourceUuid Yes 2.3.0
tagUuids The tag UUID list. Yes 3.7.0
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes
{
    "inventory": {
        "createDate": "Jan 25, 2018 8:57:14 PM",
        "email": "operator@zstack.org",
        "lastOpDate": "Jan 25, 2018 8:57:14 PM",
        "name": "operator",
        "platformUuid": "bec03e2d93224c7381782833e8b685ca",
        "state": "Enabled",
        "type": "Email",
        "uuid": "b03b125230b0406ea198919954ae3928"
    },
    "success": true
}
  • email: the email address to receive the email
  • platformUuid: the email server UUID

QuerySNSEmailEndpoint

Queries an email endpoint. For example,
QuerySNSEmailEndpoint email~="%@zstack.org"

CreateSNSHttpEndpoint

Creates an HTTP webhook endpoint. For example,

CreateSNSHttpEndpoint name=http url=http://localhost:8080/webhook-url username=url-username password=url-password

Parameters

Name Description Optional Valid Value Starting Version
url The HTTP webhook URL. 2.3
username The username of the URL. Yes 2.3
password The password of the URL. Yes 2.3
name The resource name. 2.3
description The detailed description of the resource. Yes 2.3
resourceUuid Yes 2.3
platformUuid Yes 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes
{
    "inventory": {
        "createDate": "Jan 25, 2018 9:01:30 PM",
        "lastOpDate": "Jan 25, 2018 9:01:30 PM",
        "name": "http",
        "platformUuid": "02d24b9b0a7f4ee1846f15cda248ceb7",
        "state": "Enabled",
        "type": "HTTP",
        "url": "http://localhost:8080/webhook-url",
        "username": "url-username",
        "uuid": "d9d8186eeed245e0b18ec8deef185fb7"
    },
    "success": true
}
  • url: the HTTP webhook URL
  • username: Optional. The username of the URL. This parameter uses the basic authentication mode of HTTP.
  • password: Optional. The password of the URL. This parameter uses the basic authentication mode of HTTP.

QuerySNSHttpEndpoint

Queries an HTTP webhook endpoint. For example,
QuerySNSHttpEndpoint url~=http%

CreateSNSDingTalkEndpoint

Creates a DingTalk endpoint, which is a DingTalk robot. For example,

CreateSNSDingTalkEndpoint name=dingding url=https://oapi.dingtalk.com/robot/send?access_token=128f268950234c6c2f065fe88be6cc26d780e9d9863d63eae12be831605345 atPersonPhoneNumbers=+86-12900010002,+86-13977889933

Parameters

Name Description Optional Valid Value Starting Version
url The webhook URL of the DingTalk robot. 2.3
atAll Whether to notify all (@All) members in a DingTalk group. Yes 2.3
atPersonPhoneNumbers The phone number of the group member to be notified (the @member). Yes 2.3
name The resource name. 2.3
description The detailed description of the resource. Yes 2.3
resourceUuid Yes 2.3
platformUuid Yes 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes
{
    "inventory": {
        "atAll": false,
        "atPersonPhoneNumbers": [
            "+86-12900010002",
            "+86-13977889933"
        ],
        "createDate": "Jan 25, 2018 9:11:00 PM",
        "lastOpDate": "Jan 25, 2018 9:11:00 PM",
        "name": "dingding",
        "platformUuid": "02d24b9b0a7f4ee1846f15cda248ceb7",
        "state": "Enabled",
        "type": "DingTalk",
        "url": "https://oapi.dingtalk.com/robot/send?access_token=128f268950234c6c2f065fe88be6cc26d780e9d9863d63eae12be831605345",
        "uuid": "2663ecb5356a4fbeb6cde202b2e6eaf1"
    },
    "success": true
}
  • url: the webhook URL of the DingTalk robot
  • atAll: If set to true, all members in the DingTalk group will be notified after a message is sent through DingTalk, and the atPersonPhoneNumbers parameter will be ignored.
  • atPersonPhoneNumbers: the phone number of the group member to be notified (the @member). DingTalk is registered with a phone number, through which you can notify (@) members in a target DingTalk group.
    Note: DingTalk displays phone numbers with country calling codes. You can check a complete phone number, such as +86-18977550789, by clicking the profile icon in DingTalk.

AddSNSDingTalkAtPerson

Adds the phone number of a user to be notified (@) to a DingTalk endpoint. For example,
AddSNSDingTalkAtPerson endpointUuid=2663ecb5356a4fbeb6cde202b2e6eaf1 phoneNumber=+86-18977550789

Parameters

Name Description Optional Valid Value Starting Version
phoneNumber The phone number of the DingTalk user. (Users register DingTalk with their phone numbers.) 2.3
endpointUuid The UUID of the DingTalk endpoint. 2.3
resourceUuid Yes 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

RemoveSNSDingTalkAtPerson

Removes the phone number of a user to be notified (@) from a DingTalk endpoint. For example,
RemoveSNSDingTalkAtPerson endpointUuid=2663ecb5356a4fbeb6cde202b2e6eaf1 phoneNumber=1897755078

Parameters

Name Description Optional Valid Value Starting Version
endpointUuid The UUID of the DingTalk endpoint. 2.3
phoneNumber The phone number of the user to be removed. 2.3
deleteMode 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

QuerySNSDingTalkEndpoint

Queries a DingTalk endpoint. For example,
QuerySNSDingTalkEndpoint atAll=false

DeleteSNSApplicationEndpoint

Deletes an application endpoint, including email, DingTalk, HTTP webhook, and SMS. For example,
DeleteSNSApplicationEndpoint uuid=2663ecb5356a4fbeb6cde202b2e6eaf1

Parameters

Name Description Optional Valid Value Starting Version
uuid The resource UUID. 2.3
deleteMode Yes 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The user tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

UpdateSNSApplicationEndpoint

Changes the name of an application endpoint, or modifies the endpoint description. If you want to update specific fields (such as url and email) of the endpoint, the endpoint will be deleted and then rebuilt. For example,

UpdateSNSApplicationEndpoint uuid=2663ecb5356a4fbeb6cde202b2e6eaf1 name=my-endpoint

Parameters

Name Description Optional Valid Value Starting Version
uuid The resource UUID. 2.3
name The resource name. Yes 2.3
description The detailed description of the resource. Yes 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

QuerySNSApplicationEndpoint

Queries an application endpoint. For example,

QuerySNSApplicationEndpoint

ChangeSNSApplicationEndpointState

Changes the state of an application endpoint. For example,
ChangeSNSApplicationEndpointState uuid=b86c9016b4f24953a9edefb53ca0678c stateEvent=enable

Parameters

Name Description Optional Valid Value Starting Version
uuid The resource UUID. 2.3
stateEvent The state event.
  • enable
  • disable
2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

CreateSNSAliyunSmsEndpoint

Creates an Aliyun SMS endpoint. For example,
CreateSNSAliyunSmsEndpoint accessKeyUuid=4eb00e2bf95bp5s505e6eccd647d9k35 name=AliyunSms

Parameters

Name Description Optional Valid Value Starting Version
accessKeyUuid The UUID of Aliyun access key. 3.7.0
receivers The SMS message receiver. Yes 3.7.0
name The endpoint name. 3.7.0
description The detailed description of the endpoint. Yes 3.7.0
platformUuid Yes 3.7.0
resourceUuid Yes 3.7.0
tagUuids The tag UUID list. Yes 3.7.0
userTags The user tags. For more information, see CreateUserTag. Yes 3.7.0
systemTags The system tags. For more information, see CreateSystemTag. Yes 3.7.0
timeout Yes

ValidateSNSAliyunSmsEndpoint

Validates an Aliyun SMS endpoint. For example,
ValidateSNSAliyunSmsEndpoint uuid=56304854f10730adac30a81c1e8e8de4 phoneNumbers=13456788765

Parameters

Name Description Optional Valid Value Starting Version
uuid The endpoint UUID. 3.7.0
phoneNumbers The phone number of the validation SMS message receiver. 3.7.0
userTags The user tags. For more information, see CreateUserTag. Yes 3.7.0
systemTags The system tags. For more information, see CreateSystemTag. Yes 3.7.0
timeout Yes

AddSNSSmsReceiver

Adds an SMS message receiver. For example,
AddSNSSmsReceiver phoneNumber=18912345678 endpointUuid=e0a8e9de43774027a486f3a47fa0b46c type=AliyunSms 

Parameters

Name Description Optional Valid Value Starting Version
phoneNumber The phone number to receive SMS messages. 3.7.0
endpointUuid The UUID of the SMS endpoint. 3.7.0
type The type of the SMS endpoint.
  • AliyunSms
3.7.0
description The description of the SMS message receiver. Yes 3.7.0
resourceUuid Yes 3.7.0
tagUuids The tag UUID list. Yes 3.7.0
userTags The user tags. For more information, see CreateUserTag. Yes 3.7.0
systemTags The system tags. For more information, see CreateSystemTag. Yes 3.7.0
timeout Yes

RemoveSNSSmsReceiver

Removes an SMS message receiver. For example,
RemoveSNSSmsReceiver endpointUuid=196b91815e983d1397cb336a4fc9d054 phoneNumber=18812345678

Parameters

Name Description Optional Valid Value Starting Version
endpointUuid The UUID of the SMS endpoint. 3.7.0
phoneNumber The phone number to receive SMS messages. 3.7.0
deleteMode Yes 3.7.0
userTags The user tags. For more information, see CreateUserTag. Yes 3.7.0
systemTags The system tags. For more information, see CreateSystemTag. Yes 3.7.0
timeout Yes

QuerySNSSmsEndpoint

Queries an SMS endpoint. For example,
QuerySNSSmsEndpoint 

Primitive Fields of Query

Name Description Optional Valid Value Starting Version
uuid The UUID. For more information, see Resource Property. 3.7.0
name The name. For more information, see Resource Property. 3.7.0
description The description. For more information, see Resource Property. Yes 3.7.0
type 3.7.0
platformUuid 3.7.0
groupBy Groups rows into subgroups based on values of columns or expressions. This field is equivalent to the Group By clause in MySQL, such as groupBy=type. Yes 3.7.0
createDate The creation date. For more information, see Resource Property. 3.7.0
lastOpDate The last operation date. For more information, see Resource Property. 3.7.0
userTags The user tags. For more information, see CreateUserTag. Yes 3.7.0

Nested and Expanded Fields of Query

Field Inventory Description Starting Version
platform 3.7.0
receivers 3.7.0
topics Primitive Fields of Query 3.7.0

AddEmailAddressToSNSEmailEndpoint

Adds an email address to an email endpoint. For example,
AddEmailAddressToSNSEmailEndpoint emailAddress=example@cloud.io endpointUuid=74220bbf0d8b3c6b943a294c2679ca69

Parameters

Name Description Optional Valid Value Starting Version
emailAddress The email address. 3.7.0
endpointUuid The endpoint UUID. 3.7.0
resourceUuid Yes 3.7.0
tagUuids The tag UUID list. Yes 3.7.0
userTags The user tags. For more information, see CreateUserTag. Yes 3.7.0
systemTags The system tags. For more information, see CreateSystemTag. Yes 3.7.0
timeout Yes

UpdateEmailAddressOfSNSEmailEndpoint

Updates the email address of an email endpoint. For example,
UpdateEmailAddressOfSNSEmailEndpoint emailAddressUuid=cb2b3d85e0da3a299c52c23510ba15dd endpointUuid=f305528eb6773a73beac3f94f79d3017

Parameters

Name Description Optional Valid Value Starting Version
emailAddressUuid The email address UUID. 3.7.0
endpointUuid The endpoint UUID. 3.7.0
emailAddress The address of the new email. Yes 3.7.0
userTags The user tags. For more information, see CreateUserTag. Yes 3.7.0
systemTags The system tags. For more information, see CreateSystemTag. Yes 3.7.0
timeout Yes

DeleteEmailAddressOfSNSEmailEndpoint

Deletes the email address of an email endpoint. For example,
DeleteEmailAddressOfSNSEmailEndpoint emailAddressUuid=c9d1789432133840862986db31a8e3fb endpointUuid=7671c40279e23d1cba927a5726957fcb

Parameters

Name Description Optional Valid Value Starting Version
emailAddressUuid 3.7.0
endpointUuid 3.7.0
userTags The user tags. For more information, see CreateUserTag. Yes 3.7.0
systemTags The system tags. For more information, see CreateSystemTag. Yes 3.7.0
timeout Yes

QuerySNSEmailAddress

Queries the email address of an email endpoint. For example,
QuerySNSEmailAddress emailAddress=test@cloud.io

Primitive Fields of Query

Name Description Optional Valid Value Starting Version
uuid The UUID. For more information, see Resource Property. 3.7.0
emailAddress 3.7.0
endpointUuid 3.7.0
groupBy Groups rows into subgroups based on values of columns or expressions. This field is equivalent to the Group By clause in MySQL, such as groupBy=type. Yes 3.7.0
createDate The creation date. For more information, see Resource Property. 3.7.0
lastOpDate The last operation date. For more information, see Resource Property. 3.7.0
userTags The user tags. For more information, see CreateUserTag. Yes 3.7.0
systemTags The system tags. For more information, see CreateSystemTag. Yes 3.7.0
Sample response:
{
  "inventories": [
    {
      "uuid": "102431efdb133a70b7e04347de22e396",
      "emailAddress": "test@cloud.io",
      "endpointUuid": "4ff65a1d7762348495dd0c4da110d7cd",
      "createDate": "Oct 9, 2019 10:45:40 AM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}

CreateSNSMicrosoftTeamsEndpoint

Creates a Microsoft Teams endpoint. For example,
CreateSNSMicrosoftTeamsEndpoint url=http://teams-robot-url name=example

Parameters

Name Description Optional Valid Value Starting Version
url The connector URL. 3.10.0
name The resource name. For more information, see Resource Property. 3.10.0
description The detailed description of the resource. For more information, see Resource Property. Yes 3.10.0
platformUuid The platform UUID. Yes 3.10.0
resourceUuid The resource UUID. Yes 3.10.0
tagUuids The tag UUID list. Yes 3.10.0
userTags The user tags. For more information, see CreateUserTag. Yes 3.10.0
systemTags The system tags. For more information, see CreateSystemTag. Yes 3.10.0
timeout Yes

QuerySNSMicrosoftTeamsEndpoint

Queries a Microsoft Teams endpoint. For example,
QuerySNSMicrosoftTeamsEndpoint uuid=e18d0fd90b513f71889d4c2dd38879bf

Primitive Fields of Query

Name Description Optional Valid Value Starting Version
uuid The resource UUID. For more information, see Resource Property. Yes 3.10.0
createDate The creation date. For more information, see Resource Property. Yes 3.10.0
description The detailed description of the resource. For more information, see Resource Property. Yes 3.10.0
groupBy Groups rows into subgroups based on values of columns or expressions. This field is equivalent to the Group By clause in MySQL, such as groupBy=type. Yes 3.10.0
lastOpDate The last operation date. For more information, see Resource Property. Yes 3.10.0
name The resource name. For more information, see Resource Property. Yes 3.10.0
platformUuid The platform UUID. Yes 3.10.0
state The state. Yes 3.10.0
type The type. Yes 3.10.0
url The connector URL. Yes 3.10.0
userTags The user tags. For more information, see CreateUserTag. Yes 3.10.0
systemTags The system tags. For more information, see CreateSystemTag. Yes 3.10.0

Nested And Expanded Fields of Query

Field Inventory Description Starting Version
platform The platform inventory. 3.10.0
topics The topics. For more information, see Primitive Fields of Query. 3.10.0

SubscribeSNSTopic

Subscribes an endpoint to a topic. After subscription, messages sent to the topic will be automatically sent to the endpoint. For example,

SubscribeSNSTopic endpointUuid=b03b125230b0406ea198919954ae3928 topicUuid=e034cef9ad3d43e0b3f9c0a316a0f25a

Parameters

Name Description Optional Valid Value Starting Version
topicUuid The topic UUID. 2.3
endpointUuid The endpoint UUID. 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The user tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

QuerySNSTopicSubscriber

Queries a topic subscriber. That is, checks which endpoints are subscribed to a topic. For example,

QuerySNSTopicSubscriber topicUuid=71efab26b4f84a62b001ec9b222efe47

Primitive Fields of Query

Name Description Optional Valid Value Starting Version
topicUuid The topic UUID. 2.3.1
endpointUuid The endpoint UUID. 2.3.1
groupBy Groups rows into subgroups based on values of columns or expressions. This field is equivalent to the Group By clause in MySQL, such as groupBy=type. Yes 2.3.1
createDate The creation date. For more information, see Resource Property. 2.3.1
lastOpDate The last operation date. For more information, see Resource Property. 2.3.1
userTags The user tags. For more information, see CreateUserTag. Yes 2.3.1
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3.1

Nested and Expanded Fields of Query

Field Inventory Description Starting Version
endpoints Endpoints Inventory 2.3.1
topics Topics Inventory 2.3.1

UnsubscribeSNSTopic

Unsubscribes an endpoint from a topic. For example,

UnsubscribeSNSTopic endpointUuid=b03b125230b0406ea198919954ae3928 topicUuid=e034cef9ad3d43e0b3f9c0a316a0f25a

Parameters

Name Description Optional Valid Value Starting Version
topicUuid The topic UUID. 2.3
endpointUuid The endpoint UUID. 2.3
userTags The user tags. For more information, see CreateUserTag. Yes 2.3
systemTags The system tags. For more information, see CreateSystemTag. Yes 2.3
timeout Yes

System Topic

SNS has some built-in system topics. Some predefined messages are sent to the system topics. You can subscribe to these topics to obtain information of interest.

Note:
  • System topics cannot be deleted or changed. UUIDs of system topics are predefined constant values.
  • System topics can be hard coded.

System Alarm Topic

QuerySNSTopic  name=system-alarm
{
    "inventories": [
        {
            "createDate": "Jan 10, 2018 12:11:09 AM",
            "description": "topic for reporting system defined alarms",
            "lastOpDate": "Jan 10, 2018 12:11:09 AM",
            "name": "system-alarm",
            "state": "Enabled",
            "uuid": "e7d6f5e23bb74e99a2777126078b551c"
        }
    ],
    "success": true
}

Alarms predefined by ZWatch send alarm messages to system alarm topics. You can use a system alarm topic as a custom alarm topic.

Use System HTTP Endpoint to Receive Messages from System Alarm Topics

An internal system (usually the UI) needs a way to receive messages from system alarm topics. You can use a system HTTP endpoint to act as the way mentioned above by configuring the following fields in zstack.properties:

sns.systemTopic.endpoints.http.url = The HTTP URL to receive POST messages.
sns.systemTopic.endpoints.http.url.username = Optional. The username of the HTTP request.
sns.systemTopic.endpoints.http.url.password = Optional. The password of the HTTP request.

If you need to set the username or password, both fields need to be set at the same time. Otherwise, the setting will not take effect. The HTTP endpoint can receive messages no matter the system alarm topic is enabled or disabled.

Note:

You can use the zstack-configure command to configure the fields mentioned above.

API Topic

QuerySNSTopic  name=system-alarm
{
    "inventories": [
        {
            "createDate": "Jan 10, 2018 12:11:09 AM",
            "description": "the topic to publish API requests and responses",
            "lastOpDate": "Jan 10, 2018 12:11:09 AM",
            "name": "api",
            "state": "Enabled",
            "uuid": "7bfa0eb8555b3528ace936edfd1d74f1"
        }
    ],
    "success": true
}

ZStack will send all API requests and responses to an API topic. You can subscribe to this topic to obtain API call status. The API topic can only be subscribed by HTTP endpoints. The messages received by an HTTP endpoint is the API text in JSON format.

Note:

The API requests received by an API topic are bare requests. If the password field is included in a request (such as the API request for adding a host), this field will also be sent to an endpoint. For security reasons, API topics can only be subscribed by endpoints created by the administrator. The administrator must use API topics only for internal integration or debugging.

CLI Command Manual | 4.8.38 | ZStack Cloud · ZCF | ZStack Resource Center