Skip to content

Commit 38865af

Browse files
sayeedalam-microsoftSayeed Alam
and
Sayeed Alam
authored
Review request v3 for Microsoft.Portal to onboard to TypeSpec (Azure#29796)
* Initial iteration: Exact copy of 2020-09-01-preview * Iteration#2: Adding the typespec * Reoved 2022-12-01preview api * Modified example files * Removed old files * Added tsp output * Reverted readme * Added new tsp project * Separated tenant config * Renamed configuration model name * Made changes to swagger * Fixed operation id * Renamed configuration properties * Renamed resource in body * Moved ConfigurationName union * Added back 404 * Revert "Added back 404" This reverts commit 36fb5e0. * Tenant Config set to singleton * Revert "Tenant Config set to singleton" This reverts commit 2ab8012. * Reapply "Added back 404" This reverts commit 0e83bb4. * Reverted 404 and singleton * Moving to v3 * Removed pattern from DashboardName * DashboardPartMetaData type to string * Added additional properties * Revert "Added additional properties" This reverts commit 01f9f32. * Revert "DashboardPartMetaData type to string" This reverts commit 575e290. * Revert "Moving to v3" This reverts commit a734912. * Revert "Reverted 404 and singleton" This reverts commit 862eafe. * Reapply "Reverted 404 and singleton" This reverts commit 43e5c42. * Revert "Added back 404" This reverts commit 36fb5e0. * Modified examples * Fixed examples * prettier * Removed the default segment name * Removed unncessary sections * Added common lib among * New line added * Revert "New line added" This reverts commit 683cab7. * Revert "Added common lib among" This reverts commit 6ddbd38. * Removed operation from Tenant config * Removed unnecessary operation list --------- Co-authored-by: Sayeed Alam <[email protected]>
1 parent 3f3d26f commit 38865af

37 files changed

+2198
-823
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@azure-tools/typespec-client-generator-core";
4+
import "@typespec/openapi";
5+
import "@typespec/rest";
6+
import "./models.tsp";
7+
8+
using Azure.ClientGenerator.Core;
9+
using Azure.ResourceManager;
10+
using TypeSpec.Http;
11+
using TypeSpec.OpenAPI;
12+
using TypeSpec.Rest;
13+
14+
namespace Microsoft.Portal;
15+
/**
16+
* The shared dashboard resource definition.
17+
*/
18+
@doc("The shared dashboard resource definition.")
19+
model Dashboard
20+
is Azure.ResourceManager.TrackedResource<DashboardPropertiesWithProvisioningState> {
21+
...ResourceNameParameter<Resource = Dashboard>;
22+
}
23+
24+
@armResourceOperations
25+
interface Dashboards {
26+
/**
27+
* Gets the Dashboard.
28+
*/
29+
get is ArmResourceRead<Dashboard>;
30+
31+
/**
32+
* Creates or updates a Dashboard.
33+
*/
34+
createOrUpdate is ArmResourceCreateOrReplaceSync<Dashboard>;
35+
36+
/**
37+
* Updates an existing Dashboard.
38+
*/
39+
@parameterVisibility
40+
update is ArmCustomPatchSync<Dashboard, PatchableDashboard>;
41+
42+
/**
43+
* Deletes the Dashboard.
44+
*/
45+
delete is ArmResourceDeleteSync<Dashboard>;
46+
47+
/**
48+
* Gets all the Dashboards within a resource group.
49+
*/
50+
listByResourceGroup is ArmResourceListByParent<Dashboard>;
51+
52+
/**
53+
* Gets all the dashboards within a subscription.
54+
*/
55+
listBySubscription is ArmListBySubscription<Dashboard>;
56+
}
57+
58+
@@maxLength(Dashboard.name, 64);
59+
@@minLength(Dashboard.name, 3);
60+
@@doc(Dashboard.name, "The name of the dashboard.");
61+
@@doc(Dashboards.createOrUpdate::parameters.resource,
62+
"The parameters required to create or update a dashboard."
63+
);
64+
@@doc(Dashboards.update::parameters.properties,
65+
"The updatable fields of a Dashboard."
66+
);
67+
@@encodedName(Dashboards.createOrUpdate::parameters.resource,
68+
"application/json",
69+
"dashboard"
70+
);
71+
@@encodedName(Dashboards.update::parameters.properties,
72+
"application/json",
73+
"dashboard"
74+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import "./main.tsp";
2+
import "@azure-tools/typespec-client-generator-core";
3+
4+
using Azure.ClientGenerator.Core;
5+
using Microsoft.Portal;
6+
7+
#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
8+
@@flattenProperty(PatchableDashboard.properties);
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
{
22
"parameters": {
3-
"dashboardName": "testDashboard",
4-
"resourceGroupName": "testRG",
53
"api-version": "2020-09-01-preview",
6-
"subscriptionId": "00000000-0000-0000-0000-000000000000",
74
"dashboard": {
5+
"location": "eastus",
86
"properties": {
97
"lenses": [
108
{
119
"order": 1,
1210
"parts": [
1311
{
1412
"position": {
15-
"x": 1,
16-
"y": 2,
13+
"colSpan": 3,
1714
"rowSpan": 4,
18-
"colSpan": 3
15+
"x": 1,
16+
"y": 2
1917
}
2018
},
2119
{
2220
"position": {
23-
"x": 5,
24-
"y": 5,
21+
"colSpan": 6,
2522
"rowSpan": 6,
26-
"colSpan": 6
23+
"x": 5,
24+
"y": 5
2725
}
2826
}
2927
]
@@ -35,42 +33,48 @@
3533
],
3634
"metadata": {
3735
"metadata": {
38-
"X": 4,
39-
"Y": 3,
36+
"ColSpan": 2,
4037
"RowSpan": 1,
41-
"ColSpan": 2
38+
"X": 4,
39+
"Y": 3
4240
}
4341
}
4442
},
45-
"location": "eastus",
4643
"tags": {
4744
"aKey": "aValue",
4845
"anotherKey": "anotherValue"
4946
}
50-
}
47+
},
48+
"dashboardName": "testDashboard",
49+
"resourceGroupName": "testRG",
50+
"subscriptionId": "00000000-0000-0000-0000-000000000000"
5151
},
5252
"responses": {
53-
"201": {
53+
"200": {
5454
"body": {
55+
"name": "testDashboard",
56+
"type": "Microsoft.Portal/dashboards",
57+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard",
58+
"location": "eastus",
5559
"properties": {
5660
"lenses": [
5761
{
5862
"order": 1,
5963
"parts": [
6064
{
6165
"position": {
62-
"x": 1,
63-
"y": 2,
66+
"colSpan": 3,
6467
"rowSpan": 4,
65-
"colSpan": 3
68+
"x": 1,
69+
"y": 2
6670
}
6771
},
6872
{
6973
"position": {
70-
"x": 5,
71-
"y": 5,
74+
"colSpan": 6,
7275
"rowSpan": 6,
73-
"colSpan": 6
76+
"x": 5,
77+
"y": 5
7478
}
7579
}
7680
]
@@ -82,44 +86,44 @@
8286
],
8387
"metadata": {
8488
"metadata": {
85-
"X": 4,
86-
"Y": 3,
89+
"ColSpan": 2,
8790
"RowSpan": 1,
88-
"ColSpan": 2
91+
"X": 4,
92+
"Y": 3
8993
}
9094
}
9195
},
92-
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard",
93-
"name": "testDashboard",
94-
"type": "Microsoft.Portal/dashboards",
95-
"location": "eastus",
9696
"tags": {
9797
"aKey": "aValue",
9898
"anotherKey": "anotherValue"
9999
}
100100
}
101101
},
102-
"200": {
102+
"201": {
103103
"body": {
104+
"name": "testDashboard",
105+
"type": "Microsoft.Portal/dashboards",
106+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard",
107+
"location": "eastus",
104108
"properties": {
105109
"lenses": [
106110
{
107111
"order": 1,
108112
"parts": [
109113
{
110114
"position": {
111-
"x": 1,
112-
"y": 2,
115+
"colSpan": 3,
113116
"rowSpan": 4,
114-
"colSpan": 3
117+
"x": 1,
118+
"y": 2
115119
}
116120
},
117121
{
118122
"position": {
119-
"x": 5,
120-
"y": 5,
123+
"colSpan": 6,
121124
"rowSpan": 6,
122-
"colSpan": 6
125+
"x": 5,
126+
"y": 5
123127
}
124128
}
125129
]
@@ -131,22 +135,20 @@
131135
],
132136
"metadata": {
133137
"metadata": {
134-
"X": 4,
135-
"Y": 3,
138+
"ColSpan": 2,
136139
"RowSpan": 1,
137-
"ColSpan": 2
140+
"X": 4,
141+
"Y": 3
138142
}
139143
}
140144
},
141-
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard",
142-
"name": "testDashboard",
143-
"type": "Microsoft.Portal/dashboards",
144-
"location": "eastus",
145145
"tags": {
146146
"aKey": "aValue",
147147
"anotherKey": "anotherValue"
148148
}
149149
}
150150
}
151-
}
151+
},
152+
"operationId": "Dashboards_CreateOrUpdate",
153+
"title": "Create or update a Dashboard"
152154
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
22
"parameters": {
3+
"api-version": "2020-09-01-preview",
34
"dashboardName": "testDashboard",
45
"resourceGroupName": "testRG",
5-
"api-version": "2020-09-01-preview",
66
"subscriptionId": "00000000-0000-0000-0000-000000000000"
77
},
88
"responses": {
99
"200": {},
1010
"204": {}
11-
}
11+
},
12+
"operationId": "Dashboards_Delete",
13+
"title": "Delete a Dashboard"
1214
}
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
11
{
22
"parameters": {
3+
"api-version": "2020-09-01-preview",
34
"dashboardName": "testDashboard",
45
"resourceGroupName": "testRG",
5-
"api-version": "2020-09-01-preview",
66
"subscriptionId": "00000000-0000-0000-0000-000000000000"
77
},
88
"responses": {
99
"200": {
1010
"body": {
11+
"name": "testDashboard",
12+
"type": "Microsoft.Portal/dashboards",
13+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard",
14+
"location": "eastus",
1115
"properties": {
1216
"lenses": [
1317
{
1418
"order": 1,
1519
"parts": [
1620
{
1721
"position": {
18-
"x": 1,
19-
"y": 2,
22+
"colSpan": 3,
2023
"rowSpan": 4,
21-
"colSpan": 3
24+
"x": 1,
25+
"y": 2
2226
}
2327
},
2428
{
2529
"position": {
26-
"x": 5,
27-
"y": 5,
30+
"colSpan": 6,
2831
"rowSpan": 6,
29-
"colSpan": 6
32+
"x": 5,
33+
"y": 5
3034
}
3135
}
3236
]
@@ -38,23 +42,20 @@
3842
],
3943
"metadata": {
4044
"metadata": {
41-
"X": 4,
42-
"Y": 3,
45+
"ColSpan": 2,
4346
"RowSpan": 1,
44-
"ColSpan": 2
47+
"X": 4,
48+
"Y": 3
4549
}
4650
}
4751
},
48-
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard",
49-
"name": "testDashboard",
50-
"type": "Microsoft.Portal/dashboards",
51-
"location": "eastus",
5252
"tags": {
5353
"aKey": "aValue",
5454
"anotherKey": "anotherValue"
5555
}
5656
}
57-
},
58-
"404": {}
59-
}
57+
}
58+
},
59+
"operationId": "Dashboards_Get",
60+
"title": "Get a Dashboard"
6061
}

0 commit comments

Comments
 (0)