-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
246 changed files
with
22,743 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessKey = a4ba942c-ca4a-4b898ea0cf8c-0398-41a9 | ||
secretKey = 8ea0cf8c-0398-41a9-a231-5925cc9cf3fd | ||
orgId = o15520323695671 | ||
url = https://apim-ppe1.envisioniot.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/.idea/workspace.xml | ||
/.idea/inspectionProfiles/profiles_settings.xml | ||
/.idea | ||
.idea |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
""" | ||
* Copyright (C), 2015-2021, Envision | ||
* FileName: createAlertContent | ||
* Author: Dylan Yeo | ||
* Date: 15/02/22 | ||
* Description: Create a new alert content | ||
* History: | ||
* <author> <time> <version> <desc> | ||
* | ||
* https://support.envisioniot.com/docs/alert-api/en/2.3.0/create_alert_content.html | ||
""" | ||
|
||
import poseidon.poseidon | ||
from requests.models import PreparedRequest | ||
|
||
def createAlertContent(accessKey, secretKey, orgId, url): | ||
accessURL = url + '/event-service/v2.1/alert-contents' | ||
params = {"action": "create", "orgId": orgId} | ||
req = PreparedRequest() | ||
req.prepare_url(accessURL, params) | ||
print(req.url) | ||
|
||
body={"alertContent": {"contentId": "Python_Content_ID", | ||
"contentDesc": {"defaultValue": "Default_Contents", | ||
"i18nValue": {"en_US": "Contents", | ||
"zh_CN": "内容", | ||
"ja_JP":"コンテンツ", | ||
"es_ES":"Contenido"}}, | ||
"tags": {"ContentKey1": "ContentValue1", | ||
"ContentKey2": "ContentValue2", | ||
"ContentKey3": "ContentValue3"}, | ||
"modelId": "Python_Demo_Model", | ||
"alertTypeId": "Python_Type_ID"} | ||
} | ||
print(body) | ||
|
||
response = poseidon.poseidon.urlopen(accessKey, secretKey, req.url, body) | ||
print(response) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
* Copyright (C), 2015-2021, Envision | ||
* FileName: deleteAlertContent | ||
* Author: Dylan Yeo | ||
* Date: 15/02/22 | ||
* Description: Delete an alert content. It cannot be deleted if it is used by other rules | ||
* History: | ||
* <author> <time> <version> <desc> | ||
* | ||
* https://support.envisioniot.com/docs/alert-api/en/2.3.0/delete_alert_content.html | ||
""" | ||
|
||
import poseidon.poseidon | ||
from requests.models import PreparedRequest | ||
|
||
def deleteAlertContent(accessKey, secretKey, orgId, url): | ||
accessURL = url + '/event-service/v2.1/alert-contents' | ||
params = {"action": "delete", "orgId": orgId, "alertContentId": "Python_Content_ID"} | ||
req = PreparedRequest() | ||
req.prepare_url(accessURL, params) | ||
print(req.url) | ||
|
||
body={ | ||
} | ||
print(body) | ||
|
||
response = poseidon.poseidon.urlopen(accessKey, secretKey, req.url, body) | ||
print(response) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
* Copyright (C), 2015-2021, Envision | ||
* FileName: getAlertContent | ||
* Author: Dylan Yeo | ||
* Date: 15/02/22 | ||
* Description: Get an alert content based on orgId and contentId | ||
* History: | ||
* <author> <time> <version> <desc> | ||
* | ||
* https://support.envisioniot.com/docs/alert-api/en/2.3.0/get_alert_content.html | ||
""" | ||
|
||
import poseidon.poseidon | ||
from requests.models import PreparedRequest | ||
|
||
def getAlertContent(accessKey, secretKey, orgId, url): | ||
accessURL = url + '/event-service/v2.1/alert-contents' | ||
params = {"action": "get", "orgId": orgId, "contentId": "Python_Content_ID"} | ||
req = PreparedRequest() | ||
req.prepare_url(accessURL, params) | ||
print(req.url) | ||
|
||
body={ | ||
} | ||
print(body) | ||
|
||
response = poseidon.poseidon.urlopen(accessKey, secretKey, req.url, body) | ||
print(response) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
""" | ||
* Copyright (C), 2015-2021, Envision | ||
* FileName: searchAlertContent | ||
* Author: Dylan Yeo | ||
* Date: 15/02/22 | ||
* Description: Search for alert content based on the search criteria | ||
* History: | ||
* <author> <time> <version> <desc> | ||
* | ||
* https://support.envisioniot.com/docs/alert-api/en/2.3.0/search_alert_content.html | ||
""" | ||
|
||
import poseidon.poseidon | ||
from requests.models import PreparedRequest | ||
|
||
def searchAlertContent(accessKey, secretKey, orgId, url): | ||
accessURL = url + '/event-service/v2.1/alert-contents' | ||
params = {"action": "search", "orgId": orgId} | ||
req = PreparedRequest() | ||
req.prepare_url(accessURL, params) | ||
print(req.url) | ||
|
||
body={"pagination": {"pageNo": 1, | ||
"pageSize": 10} | ||
} | ||
print(body) | ||
|
||
response = poseidon.poseidon.urlopen(accessKey, secretKey, req.url, body) | ||
print(response) | ||
|
||
|
||
def searchAlertContent_modelId(accessKey, secretKey, orgId, url): | ||
accessURL = url + '/event-service/v2.1/alert-contents' | ||
params = {"action": "search", "orgId": orgId} | ||
req = PreparedRequest() | ||
req.prepare_url(accessURL, params) | ||
print(req.url) | ||
|
||
body={"modelId": "Python_Demo_Model" | ||
} | ||
print(body) | ||
|
||
response = poseidon.poseidon.urlopen(accessKey, secretKey, req.url, body) | ||
print(response) | ||
|
||
|
||
def searchAlertContent_alertTypeId(accessKey, secretKey, orgId, url): | ||
accessURL = url + '/event-service/v2.1/alert-contents' | ||
params = {"action": "search", "orgId": orgId} | ||
req = PreparedRequest() | ||
req.prepare_url(accessURL, params) | ||
print(req.url) | ||
|
||
body={"alertTypeId": "Python_Type_ID" | ||
} | ||
print(body) | ||
|
||
response = poseidon.poseidon.urlopen(accessKey, secretKey, req.url, body) | ||
print(response) | ||
|
||
|
||
def searchAlertContent_subAlertTypeId(accessKey, secretKey, orgId, url): | ||
accessURL = url + '/event-service/v2.1/alert-contents' | ||
params = {"action": "search", "orgId": orgId} | ||
req = PreparedRequest() | ||
req.prepare_url(accessURL, params) | ||
print(req.url) | ||
|
||
body={"subAlertTypeId": "Python_Type_ID" | ||
} | ||
print(body) | ||
|
||
response = poseidon.poseidon.urlopen(accessKey, secretKey, req.url, body) | ||
print(response) | ||
|
||
|
||
def searchAlertContent_Expression(accessKey, secretKey, orgId, url, Expression): | ||
accessURL = url + '/event-service/v2.1/alert-contents' | ||
params = {"action": "search", "orgId": orgId} | ||
req = PreparedRequest() | ||
req.prepare_url(accessURL, params) | ||
print(req.url) | ||
|
||
body={"expression": Expression | ||
} | ||
print(body) | ||
|
||
response = poseidon.poseidon.urlopen(accessKey, secretKey, req.url, body) | ||
print(response) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
""" | ||
* Copyright (C), 2015-2021, Envision | ||
* FileName: updateAlertContent | ||
* Author: Dylan Yeo | ||
* Date: 15/02/22 | ||
* Description: Update an alert content | ||
* History: | ||
* <author> <time> <version> <desc> | ||
* | ||
* https://support.envisioniot.com/docs/alert-api/en/2.3.0/update_alert_content.html | ||
""" | ||
|
||
import poseidon.poseidon | ||
from requests.models import PreparedRequest | ||
|
||
def updateAlertContent(accessKey, secretKey, orgId, url): | ||
accessURL = url + '/event-service/v2.1/alert-contents' | ||
params = {"action": "update", "orgId": orgId, "isPatchUpdate": "true"} | ||
req = PreparedRequest() | ||
req.prepare_url(accessURL, params) | ||
print(req.url) | ||
|
||
body={"alertContent": {"contentId": "Python_Content_ID", | ||
"contentDesc": {"defaultValue": "Updated_Default_Contents", | ||
"i18nValue": {"en_US": "Updated_Contents", | ||
"zh_CN": "更新内容", | ||
"ja_JP":"更新された内容", | ||
"es_ES":"Contenidos Actualizados"}}, | ||
"tags": {"NewContentKey1": "NewContentValue1", | ||
"NewContentKey2": "NewContentValue2", | ||
"NewContentKey3": "NewContentValue3"}, | ||
"modelId": "Python_Demo_Model", | ||
"alertTypeId": "Python_Type_ID"} | ||
} | ||
print(body) | ||
|
||
response = poseidon.poseidon.urlopen(accessKey, secretKey, req.url, body) | ||
print(response) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
* Copyright (C), 2015-2021, Envision | ||
* FileName: batchUpdateAlertTags | ||
* Author: Dylan Yeo | ||
* Date: 18/02/22 | ||
* Description: Batch update the tags for the specified history and active alerts. The returned structure describes the update results of each alert. If an error message occurs, the error message will be recorded and the rest of the update will continue | ||
* History: | ||
* <author> <time> <version> <desc> | ||
* | ||
* https://support.envisioniot.com/docs/alert-api/en/2.3.0/new_version/batch_update_alert_tags.html | ||
""" | ||
|
||
import poseidon.poseidon | ||
from requests.models import PreparedRequest | ||
|
||
def batchUpdateAlertTags(accessKey, secretKey, orgId, url, alertId_list): | ||
accessURL = url + '/alert-service/v2.1/alerts' | ||
params = {"action": "batchUpdateTags", "orgId": orgId} | ||
req = PreparedRequest() | ||
req.prepare_url(accessURL, params) | ||
print(req.url) | ||
|
||
body = {"alertIds": alertId_list, | ||
"isPatchUpdate": True, | ||
"tags": {"NewActiveAlert_newverKey1": "NewActiveAlert_newverValue1", | ||
"NewActiveAlert_newverKey2": "NewActiveAlert_newverValue2", | ||
"NewActiveAlert_newverKey3": "NewActiveAlert_newverValue3"}, | ||
} | ||
print(body) | ||
|
||
response = poseidon.poseidon.urlopen(accessKey, secretKey, req.url, body) | ||
print(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
""" | ||
* Copyright (C), 2015-2021, Envision | ||
* FileName: updateAlertTags | ||
* Author: Dylan Yeo | ||
* Date: 18/02/22 | ||
* Description: Update history and active alert tags | ||
* History: | ||
* <author> <time> <version> <desc> | ||
* | ||
* https://support.envisioniot.com/docs/alert-api/en/2.3.0/new_version/update_alert_tags.html | ||
""" | ||
|
||
import poseidon.poseidon | ||
from requests.models import PreparedRequest | ||
|
||
def updateAlertTags(accessKey, secretKey, orgId, url, alertId): | ||
accessURL = url + '/alert-service/v2.1/alerts' | ||
params = {"action": "updateTags", "orgId": orgId} | ||
req = PreparedRequest() | ||
req.prepare_url(accessURL, params) | ||
print(req.url) | ||
|
||
body = {"alertId": alertId, | ||
"isPatchUpdate": True, | ||
"tags": {"NewActiveAlert_newverKey1": "NewActiveAlert_newverValue1", | ||
"NewActiveAlert_newverKey2": "NewActiveAlert_newverValue2", | ||
"NewActiveAlert_newverKey3": "NewActiveAlert_newverValue3"}, | ||
} | ||
print(body) | ||
|
||
response = poseidon.poseidon.urlopen(accessKey, secretKey, req.url, body) | ||
print(response) | ||
|
Oops, something went wrong.