Skip to content

Commit 7b82769

Browse files
welovejv-xutov-jiaodiChenxiJiang333weidongxu-microsoft
authored
Tyespec migration for alertsmanagement AlertsManagement (#39103)
* converted * could compile * update * update * remove @operationid * update * prettier * Update tspconfig.yaml * update * Refactor folder * Remove is-modular-library flag from tspconfig.yaml * Update client.tsp * Update client names and time range constants * Update client.tsp * Update client.tsp * Update client.tsp * Add statusUrl client name for Java * feat(alertsmanagement): add Java client name mappings and update tspconfig Add Java client name mappings for NotificationResult, AlertsMetaData, AlertsMetaDataProperties, and Essentials models in the client.tsp file. Also add use-object-for-unknown option to tspconfig.yaml to handle unknown properties properly. * add go config * fix: AlertModificationItem.details nullable --------- Co-authored-by: Tong Xu (MSFT) <v-xuto@microsoft.com> Co-authored-by: Jiao Di (MSFT) <80496810+v-jiaodi@users.noreply.github.com> Co-authored-by: ChenxiJiang333 <119990644+ChenxiJiang333@users.noreply.github.com> Co-authored-by: Weidong Xu <weidxu@microsoft.com> Co-authored-by: Chenjie Shi <tadelesh.shi@live.cn> Co-authored-by: v-huizhu2 <v-huizhu2@microsoft.com> Co-authored-by: judy.liu <v-liujudy@microsoft.com> Co-authored-by: Pan Shao <97225342+pshao25@users.noreply.github.com>
1 parent d0914ef commit 7b82769

34 files changed

Lines changed: 6461 additions & 1425 deletions

specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/AlertsManagement/Alert.tsp

Lines changed: 422 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import "@azure-tools/typespec-client-generator-core";
2+
3+
using Azure.ClientGenerator.Core;
4+
using Microsoft.AlertsManagement;
5+
6+
@@clientName(Alerts.changeStateTenant::parameters.body, "comment");
7+
@@clientLocation(AlertOperationGroup.getById, Alerts);
8+
@@clientLocation(AlertOperationGroup.getAll, Alerts);
9+
@@clientLocation(AlertOperationGroup.changeState, Alerts);
10+
@@clientName(AlertOperationGroup.changeState::parameters.body, "comment");
11+
@@clientLocation(AlertOperationGroup.getHistory, Alerts);
12+
@@clientLocation(AlertOperationGroup.getEnrichments, Alerts);
13+
14+
@@clientLocation(AlertsOperationGroup.metaData, Alerts);
15+
@@clientLocation(AlertsOperationGroup.getSummary, Alerts);
16+
@@clientLocation(AlertGetAllTenantOperation.getAllTenant, Alerts);
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import "@azure-tools/typespec-client-generator-core";
2+
import "./main.tsp";
3+
4+
using Azure.ClientGenerator.Core;
5+
using Microsoft.AlertsManagement;
6+
using Http;
7+
8+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
9+
model AlertsClientOptions {
10+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
11+
scope: string;
12+
}
13+
14+
@@Azure.ClientGenerator.Core.clientInitialization(Microsoft.AlertsManagement,
15+
{
16+
parameters: AlertsClientOptions,
17+
},
18+
"!(python,java)"
19+
);
20+
21+
@@clientName(Microsoft.AlertsManagement, "AlertsManagementClient", "python");
22+
@@clientName(ProxyResource, "ProxyResourceAutoGenerated", "python");
23+
@@clientName(TimeRange.`1h`, "ONE_H", "python");
24+
@@clientName(TimeRange.`1d`, "ONE_D", "python");
25+
@@clientName(TimeRange.`7d`, "SEVEN_D", "python");
26+
@@clientName(TimeRange.`30d`, "THIRTY_D", "python");
27+
28+
@@clientName(AlertsManagementErrorResponse,
29+
"ErrorResponseForAlertsManagement",
30+
"go"
31+
);
32+
33+
@@clientName(Microsoft.AlertsManagement.NotificationResult.statusURL,
34+
"statusUrl",
35+
"java"
36+
);
37+
38+
@@clientName(Microsoft.AlertsManagement.AlertsMetaData,
39+
"AlertsMetadata",
40+
"java"
41+
);
42+
@@clientName(Microsoft.AlertsManagement.AlertsMetaDataProperties,
43+
"AlertsMetadataProperties",
44+
"java"
45+
);
46+
@@clientName(Microsoft.AlertsManagement.Essentials.lastModifiedUserName,
47+
"lastModifiedUsername",
48+
"java"
49+
);
50+
51+
@@clientName(Microsoft.AlertsManagement, "AlertsManagementClient", "java");
52+
53+
@@clientName(TimeRange.`1h`, "OneH", "go");
54+
@@clientName(TimeRange.`1d`, "OneD", "go");
55+
@@clientName(TimeRange.`7d`, "SevenD", "go");
56+
@@clientName(TimeRange.`30d`, "ThirtyD", "go");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"parameters": {
3+
"api-version": "2025-05-25-preview",
4+
"identifier": "MonitorServiceList"
5+
},
6+
"responses": {
7+
"200": {
8+
"body": {
9+
"properties": {
10+
"data": [
11+
{
12+
"name": "ActivityLog Administrative",
13+
"displayName": "Activity Log - Administrative"
14+
},
15+
{
16+
"name": "ActivityLog Autoscale",
17+
"displayName": "Activity Log - Autoscale"
18+
},
19+
{
20+
"name": "ActivityLog Policy",
21+
"displayName": "Activity Log - Policy"
22+
},
23+
{
24+
"name": "ActivityLog Recommendation",
25+
"displayName": "Activity Log - Recommendation"
26+
},
27+
{
28+
"name": "ActivityLog Security",
29+
"displayName": "Activity Log - Security"
30+
},
31+
{
32+
"name": "Application Insights",
33+
"displayName": "Application Insights"
34+
},
35+
{
36+
"name": "Azure Backup",
37+
"displayName": "Azure Backup"
38+
},
39+
{
40+
"name": "Custom",
41+
"displayName": "Custom"
42+
},
43+
{
44+
"name": "Data Box Edge",
45+
"displayName": "Data Box Edge"
46+
},
47+
{
48+
"name": "VM Insights",
49+
"displayName": "VM Insights"
50+
},
51+
{
52+
"name": "Log Analytics",
53+
"displayName": "Log Analytics"
54+
},
55+
{
56+
"name": "Nagios",
57+
"displayName": "NAGIOS"
58+
},
59+
{
60+
"name": "Platform",
61+
"displayName": "Platform"
62+
},
63+
{
64+
"name": "Resource Health",
65+
"displayName": "Resource Health"
66+
},
67+
{
68+
"name": "SCOM",
69+
"displayName": "SCOM"
70+
},
71+
{
72+
"name": "ServiceHealth",
73+
"displayName": "Service Health"
74+
},
75+
{
76+
"name": "Smart Detector",
77+
"displayName": "SmartDetector"
78+
},
79+
{
80+
"name": "Zabbix",
81+
"displayName": "ZABBIX"
82+
}
83+
],
84+
"metadataIdentifier": "MonitorServiceList"
85+
}
86+
}
87+
}
88+
},
89+
"operationId": "Alerts_MetaData",
90+
"title": "MonService"
91+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"parameters": {
3+
"alertId": "66114d64-d9d9-478b-95c9-b789d6502100",
4+
"api-version": "2025-05-25-preview",
5+
"body": {
6+
"comment": "Acknowledging alert"
7+
},
8+
"newState": "Acknowledged",
9+
"scope": "subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight"
10+
},
11+
"responses": {
12+
"200": {
13+
"body": {
14+
"name": "cpu alert",
15+
"type": "Microsoft.AlertsManagement/alerts",
16+
"id": "/subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight/providers/Microsoft.AlertsManagement/alerts/66114d64-d9d9-478b-95c9-b789d6502100",
17+
"properties": {
18+
"context": {},
19+
"egressConfig": {},
20+
"essentials": {
21+
"description": "description of the alert",
22+
"actionStatus": {
23+
"isSuppressed": false
24+
},
25+
"alertRule": "https://servisdfsdfappinsight.portal.mms.microsoft.com/#Workspace/overview/settings/details/Edit Alert Rule/details/index?savedSearchId=&scheduleId=",
26+
"alertState": "Acknowledged",
27+
"lastModifiedDateTime": "2018-09-13T15:51:02Z",
28+
"lastModifiedUserName": "System",
29+
"monitorCondition": "Fired",
30+
"monitorConditionResolvedDateTime": "2018-09-13T15:51:02Z",
31+
"monitorService": "Application Insights",
32+
"severity": "Sev3",
33+
"signalType": "Log",
34+
"smartGroupId": "23d6b2ce-8c54-468f-aff0-sd32aebb7e56",
35+
"smartGroupingReason": "Occurred frequently with other alerts",
36+
"sourceCreatedId": "6cd6b2ce-8c54-468f-aff0-9d12aebb7e49",
37+
"startDateTime": "2018-09-13T15:51:02Z",
38+
"targetResource": "/subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight",
39+
"targetResourceGroup": "servicedeskresourcegroup",
40+
"targetResourceName": "servicedeskappinsight",
41+
"targetResourceType": "components"
42+
}
43+
}
44+
}
45+
}
46+
},
47+
"operationId": "Alerts_ChangeState",
48+
"title": "Resolve"
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"parameters": {
3+
"alertId": "66114d64-d9d9-478b-95c9-b789d6502100",
4+
"api-version": "2025-05-25-preview",
5+
"body": {
6+
"comment": "Acknowledging alert"
7+
},
8+
"newState": "Acknowledged",
9+
"scope": "subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight"
10+
},
11+
"responses": {
12+
"200": {
13+
"body": {
14+
"name": "cpu alert",
15+
"type": "Microsoft.AlertsManagement/alerts",
16+
"id": "/subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight/providers/Microsoft.AlertsManagement/alerts/66114d64-d9d9-478b-95c9-b789d6502100",
17+
"properties": {
18+
"context": {},
19+
"egressConfig": {},
20+
"essentials": {
21+
"description": "description of the alert",
22+
"actionStatus": {
23+
"isSuppressed": false
24+
},
25+
"alertRule": "https://servisdfsdfappinsight.portal.mms.microsoft.com/#Workspace/overview/settings/details/Edit Alert Rule/details/index?savedSearchId=&scheduleId=",
26+
"alertState": "Acknowledged",
27+
"lastModifiedDateTime": "2018-09-13T15:51:02Z",
28+
"lastModifiedUserName": "System",
29+
"monitorCondition": "Fired",
30+
"monitorConditionResolvedDateTime": "2018-09-13T15:51:02Z",
31+
"monitorService": "Application Insights",
32+
"severity": "Sev3",
33+
"signalType": "Log",
34+
"smartGroupId": "23d6b2ce-8c54-468f-aff0-sd32aebb7e56",
35+
"smartGroupingReason": "Occurred frequently with other alerts",
36+
"sourceCreatedId": "6cd6b2ce-8c54-468f-aff0-9d12aebb7e49",
37+
"startDateTime": "2018-09-13T15:51:02Z",
38+
"targetResource": "/subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight",
39+
"targetResourceGroup": "servicedeskresourcegroup",
40+
"targetResourceName": "servicedeskappinsight",
41+
"targetResourceType": "components"
42+
}
43+
}
44+
}
45+
}
46+
},
47+
"operationId": "Alerts_ChangeStateTenant",
48+
"title": "Resolve"
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"parameters": {
3+
"alertId": "66114d64-d9d9-478b-95c9-b789d6502100",
4+
"api-version": "2025-05-25-preview",
5+
"scope": "subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight"
6+
},
7+
"responses": {
8+
"200": {
9+
"body": {
10+
"name": "cpu alert",
11+
"type": "Microsoft.AlertsManagement/alerts",
12+
"id": "/subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight/providers/Microsoft.AlertsManagement/alerts/66114d64-d9d9-478b-95c9-b789d6502100",
13+
"properties": {
14+
"context": {},
15+
"customProperties": {
16+
"key1": "value1",
17+
"key2": "value2"
18+
},
19+
"egressConfig": {},
20+
"essentials": {
21+
"description": "description of the alert",
22+
"actionStatus": {
23+
"isSuppressed": false
24+
},
25+
"alertRule": "https://sersdfsdfinsight.portal.mms.microsoft.com/#Workspace/overview/settings/details/Edit Alert Rule/details/index?savedSearchId=&scheduleId=",
26+
"alertState": "Acknowledged",
27+
"lastModifiedDateTime": "2018-09-13T15:51:02Z",
28+
"lastModifiedUserName": "System",
29+
"monitorCondition": "Fired",
30+
"monitorConditionResolvedDateTime": "2018-09-13T15:51:02Z",
31+
"monitorService": "Application Insights",
32+
"severity": "Sev3",
33+
"signalType": "Log",
34+
"smartGroupId": "23d6b2ce-8c54-468f-aff0-sd32aebb7e56",
35+
"smartGroupingReason": "Occurred frequently with other alerts",
36+
"sourceCreatedId": "6cd6b2ce-8c54-468f-aff0-9d12aebb7e49",
37+
"startDateTime": "2018-09-13T15:51:02Z",
38+
"targetResource": "/subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight",
39+
"targetResourceGroup": "servicedeskresourcegroup",
40+
"targetResourceName": "servicedeskappinsight",
41+
"targetResourceType": "components"
42+
}
43+
}
44+
}
45+
}
46+
},
47+
"operationId": "Alerts_GetById",
48+
"title": "GetById"
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"parameters": {
3+
"alertId": "66114d64-d9d9-478b-95c9-b789d6502100",
4+
"api-version": "2025-05-25-preview",
5+
"scope": "subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight"
6+
},
7+
"responses": {
8+
"200": {
9+
"body": {
10+
"name": "cpu alert",
11+
"type": "Microsoft.AlertsManagement/alerts",
12+
"id": "/subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight/providers/Microsoft.AlertsManagement/alerts/66114d64-d9d9-478b-95c9-b789d6502100",
13+
"properties": {
14+
"context": {},
15+
"customProperties": {
16+
"key1": "value1",
17+
"key2": "value2"
18+
},
19+
"egressConfig": {},
20+
"essentials": {
21+
"description": "description of the alert",
22+
"actionStatus": {
23+
"isSuppressed": false
24+
},
25+
"alertRule": "https://sersdfsdfinsight.portal.mms.microsoft.com/#Workspace/overview/settings/details/Edit Alert Rule/details/index?savedSearchId=&scheduleId=",
26+
"alertState": "Acknowledged",
27+
"lastModifiedDateTime": "2018-09-13T15:51:02Z",
28+
"lastModifiedUserName": "System",
29+
"monitorCondition": "Fired",
30+
"monitorConditionResolvedDateTime": "2018-09-13T15:51:02Z",
31+
"monitorService": "Application Insights",
32+
"severity": "Sev3",
33+
"signalType": "Log",
34+
"smartGroupId": "23d6b2ce-8c54-468f-aff0-sd32aebb7e56",
35+
"smartGroupingReason": "Occurred frequently with other alerts",
36+
"sourceCreatedId": "6cd6b2ce-8c54-468f-aff0-9d12aebb7e49",
37+
"startDateTime": "2018-09-13T15:51:02Z",
38+
"targetResource": "/subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight",
39+
"targetResourceGroup": "servicedeskresourcegroup",
40+
"targetResourceName": "servicedeskappinsight",
41+
"targetResourceType": "components"
42+
}
43+
}
44+
}
45+
}
46+
},
47+
"operationId": "Alerts_GetByIdTenant",
48+
"title": "GetById"
49+
}

0 commit comments

Comments
 (0)