Skip to content

Commit

Permalink
Review request v3 for Microsoft.Portal to onboard to TypeSpec (#29796)
Browse files Browse the repository at this point in the history
* 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 <saalam@microsoft.com>
  • Loading branch information
sayeedalam-microsoft and Sayeed Alam authored Aug 5, 2024
1 parent 3f3d26f commit 38865af
Show file tree
Hide file tree
Showing 37 changed files with 2,198 additions and 823 deletions.
74 changes: 74 additions & 0 deletions specification/portal/Dashboard.Management/Dashboard.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@azure-tools/typespec-client-generator-core";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";

using Azure.ClientGenerator.Core;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;

namespace Microsoft.Portal;
/**
* The shared dashboard resource definition.
*/
@doc("The shared dashboard resource definition.")
model Dashboard
is Azure.ResourceManager.TrackedResource<DashboardPropertiesWithProvisioningState> {
...ResourceNameParameter<Resource = Dashboard>;
}

@armResourceOperations
interface Dashboards {
/**
* Gets the Dashboard.
*/
get is ArmResourceRead<Dashboard>;

/**
* Creates or updates a Dashboard.
*/
createOrUpdate is ArmResourceCreateOrReplaceSync<Dashboard>;

/**
* Updates an existing Dashboard.
*/
@parameterVisibility
update is ArmCustomPatchSync<Dashboard, PatchableDashboard>;

/**
* Deletes the Dashboard.
*/
delete is ArmResourceDeleteSync<Dashboard>;

/**
* Gets all the Dashboards within a resource group.
*/
listByResourceGroup is ArmResourceListByParent<Dashboard>;

/**
* Gets all the dashboards within a subscription.
*/
listBySubscription is ArmListBySubscription<Dashboard>;
}

@@maxLength(Dashboard.name, 64);
@@minLength(Dashboard.name, 3);
@@doc(Dashboard.name, "The name of the dashboard.");
@@doc(Dashboards.createOrUpdate::parameters.resource,
"The parameters required to create or update a dashboard."
);
@@doc(Dashboards.update::parameters.properties,
"The updatable fields of a Dashboard."
);
@@encodedName(Dashboards.createOrUpdate::parameters.resource,
"application/json",
"dashboard"
);
@@encodedName(Dashboards.update::parameters.properties,
"application/json",
"dashboard"
);
8 changes: 8 additions & 0 deletions specification/portal/Dashboard.Management/client.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import "./main.tsp";
import "@azure-tools/typespec-client-generator-core";

using Azure.ClientGenerator.Core;
using Microsoft.Portal;

#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(PatchableDashboard.properties);
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
{
"parameters": {
"dashboardName": "testDashboard",
"resourceGroupName": "testRG",
"api-version": "2020-09-01-preview",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"dashboard": {
"location": "eastus",
"properties": {
"lenses": [
{
"order": 1,
"parts": [
{
"position": {
"x": 1,
"y": 2,
"colSpan": 3,
"rowSpan": 4,
"colSpan": 3
"x": 1,
"y": 2
}
},
{
"position": {
"x": 5,
"y": 5,
"colSpan": 6,
"rowSpan": 6,
"colSpan": 6
"x": 5,
"y": 5
}
}
]
Expand All @@ -35,42 +33,48 @@
],
"metadata": {
"metadata": {
"X": 4,
"Y": 3,
"ColSpan": 2,
"RowSpan": 1,
"ColSpan": 2
"X": 4,
"Y": 3
}
}
},
"location": "eastus",
"tags": {
"aKey": "aValue",
"anotherKey": "anotherValue"
}
}
},
"dashboardName": "testDashboard",
"resourceGroupName": "testRG",
"subscriptionId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"201": {
"200": {
"body": {
"name": "testDashboard",
"type": "Microsoft.Portal/dashboards",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard",
"location": "eastus",
"properties": {
"lenses": [
{
"order": 1,
"parts": [
{
"position": {
"x": 1,
"y": 2,
"colSpan": 3,
"rowSpan": 4,
"colSpan": 3
"x": 1,
"y": 2
}
},
{
"position": {
"x": 5,
"y": 5,
"colSpan": 6,
"rowSpan": 6,
"colSpan": 6
"x": 5,
"y": 5
}
}
]
Expand All @@ -82,44 +86,44 @@
],
"metadata": {
"metadata": {
"X": 4,
"Y": 3,
"ColSpan": 2,
"RowSpan": 1,
"ColSpan": 2
"X": 4,
"Y": 3
}
}
},
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard",
"name": "testDashboard",
"type": "Microsoft.Portal/dashboards",
"location": "eastus",
"tags": {
"aKey": "aValue",
"anotherKey": "anotherValue"
}
}
},
"200": {
"201": {
"body": {
"name": "testDashboard",
"type": "Microsoft.Portal/dashboards",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard",
"location": "eastus",
"properties": {
"lenses": [
{
"order": 1,
"parts": [
{
"position": {
"x": 1,
"y": 2,
"colSpan": 3,
"rowSpan": 4,
"colSpan": 3
"x": 1,
"y": 2
}
},
{
"position": {
"x": 5,
"y": 5,
"colSpan": 6,
"rowSpan": 6,
"colSpan": 6
"x": 5,
"y": 5
}
}
]
Expand All @@ -131,22 +135,20 @@
],
"metadata": {
"metadata": {
"X": 4,
"Y": 3,
"ColSpan": 2,
"RowSpan": 1,
"ColSpan": 2
"X": 4,
"Y": 3
}
}
},
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard",
"name": "testDashboard",
"type": "Microsoft.Portal/dashboards",
"location": "eastus",
"tags": {
"aKey": "aValue",
"anotherKey": "anotherValue"
}
}
}
}
},
"operationId": "Dashboards_CreateOrUpdate",
"title": "Create or update a Dashboard"
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"parameters": {
"api-version": "2020-09-01-preview",
"dashboardName": "testDashboard",
"resourceGroupName": "testRG",
"api-version": "2020-09-01-preview",
"subscriptionId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {},
"204": {}
}
},
"operationId": "Dashboards_Delete",
"title": "Delete a Dashboard"
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
{
"parameters": {
"api-version": "2020-09-01-preview",
"dashboardName": "testDashboard",
"resourceGroupName": "testRG",
"api-version": "2020-09-01-preview",
"subscriptionId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {
"body": {
"name": "testDashboard",
"type": "Microsoft.Portal/dashboards",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard",
"location": "eastus",
"properties": {
"lenses": [
{
"order": 1,
"parts": [
{
"position": {
"x": 1,
"y": 2,
"colSpan": 3,
"rowSpan": 4,
"colSpan": 3
"x": 1,
"y": 2
}
},
{
"position": {
"x": 5,
"y": 5,
"colSpan": 6,
"rowSpan": 6,
"colSpan": 6
"x": 5,
"y": 5
}
}
]
Expand All @@ -38,23 +42,20 @@
],
"metadata": {
"metadata": {
"X": 4,
"Y": 3,
"ColSpan": 2,
"RowSpan": 1,
"ColSpan": 2
"X": 4,
"Y": 3
}
}
},
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard",
"name": "testDashboard",
"type": "Microsoft.Portal/dashboards",
"location": "eastus",
"tags": {
"aKey": "aValue",
"anotherKey": "anotherValue"
}
}
},
"404": {}
}
}
},
"operationId": "Dashboards_Get",
"title": "Get a Dashboard"
}
Loading

0 comments on commit 38865af

Please sign in to comment.