Skip to content

Commit 5786577

Browse files
Elina-Lmelina5656weidongxu-microsoftmikeharderqiaozha
authored
RecommenderRP TypeSpec Conversion for version 20250605 (#36039)
* Splitting RecommenderRP to individual package, initial commit Rename SpotPlacementScores.json to GenerateSpotPlacementScores.json Remove openapi-subtype: rpaas from readme.md Adding suppression for RecommenderRP Update suppressions file name from diagnostic.json to RecommenderRP.json Add required APIVersion to GetSpotPlacementScores.json [Monitor] Rename Ingestion TypeSpec directory (#35991) Signed-off-by: Paul Van Eck <[email protected]> [DevTestLabs] Convert existing OpenAPI spec to TypeSpec spec (#35346) Stable Version 2025-07-15 for Microsoft.Quota (#35765) * Copy files from stable/2025-03-01 Copied the files in a separate commit. This allows reviewers to easily diff subsequent changes against the previous spec. * Update version to stable/2025-07-15 Updated the API version from stable/2025-03-01 to stable/2025-07-15. * Added tag for 2025-07-15 in readme file * creates a new stable version for the enforcement endpoints * Adds the enforcement examples * adds GroupQuotaUsages folder * Adds enforcement definitions * Modifies the api version in the enforcement examples * adds proper api version for usages example * changes the retry after type and fixes typos * changes another description * renames GroupQuotasEnforcementResponse to GroupQuotaEnforcementStatus * formats object * Changes GroupQuotaEnforcementResponse to GroupQuotaEnforcementStatus. reverts unneccessary change in 2023-06-01 preview * ran prettier on 2023-06-01-preview for prettier check violation * changes object definition in preview version as well * resolves retry after issue * reverts the preview file objects Adding api-version input into GetSpotPlacementScores.json Run prettier Use forward slash [spec-model] Add cache in ctor, to re-use objects for the same path (#36008) [Monitor Query Logs] Add Java customizations (#36007) * [Monitor Query Logs] Add Java customizations * format [EngSys] Remove unnecessary workflow_dispatch triggers (#36019) [dashboard] Remove properties order fix and fix location to be optional (#36017) * remove properties order fix and fix location to be optional * remove needless suppression fix the back compatible for csharp (#35965) * Tsp Migration * Removing -only tag and unneeded suppression * Update types.json path * Run prettier on example files * Run prettier * Revery noop change to Microsoft.Compute/suppressions.yaml * Modify tspconfig and title * Remove Code generation section * Update tspconfig.yaml * Remove unused models * Update tspconfig.yaml naming to computerecommender * Update tspconfig.yaml * Revert change to readme.md * Increment main.tsp common types version to v6, change RecommenderRP.json title and description * Run tsv on files * add clientName * Update specification/compute/resource-manager/Microsoft.Compute/RecommenderRP/main.tsp Co-authored-by: catalinaperalta <[email protected]> * Remove some suppressions, remove some redundant imports * Adding Operations_List to RecommenderRP.json and also adding Operations interface to main.tsp * Remove examples from operations_list and also update references to type defs * Adding computeRPCommonExamples/Operations_List_MaximumSet_Gen computeRPCommonExamples/Operations_List_MinimumSet_Gen examples * Update API version to 2025-06-05 * Readd missing parenthesis * Readding no-openapi suppression back to ComputeDiagnosticBase.tsp * Readd provisioning state suppression in models.tsp * Remove the operationId decorator and run the TSP compile command * Update arm-resource-provisioning-state Fix me justification * Adding FIXME justifications for missing-x-ms-identifiers suppressions in models.tsp * Readd examples for operations_list * Run npm and npx on RecommenderRP.json * Revert "Run npm and npx on RecommenderRP.json" This reverts commit a3dc356. * Modify the example file to the correct folder * Move Operations_List_MaximumSet_Gen.json and Operations_List_MinimumSet_Gen.json out of computeRPcommon * Move Operations_List_MaximumSet_Gen.json and Operations_List_MinimumSet_Gen.json out of computeRPcommon --------- Co-authored-by: melina5656 <[email protected]> Co-authored-by: Weidong Xu <[email protected]> Co-authored-by: Mike Harder <[email protected]> Co-authored-by: Qiaoqiao Zhang <[email protected]> Co-authored-by: catalinaperalta <[email protected]>
1 parent fa5c04c commit 5786577

15 files changed

+647
-118
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/openapi";
4+
import "@typespec/rest";
5+
import "./models.tsp";
6+
7+
using TypeSpec.Rest;
8+
using Azure.ResourceManager;
9+
using TypeSpec.Http;
10+
using TypeSpec.OpenAPI;
11+
12+
namespace Microsoft.Compute;
13+
/**
14+
* Contains metadata of a diagnostic type
15+
*/
16+
@singleton("spot")
17+
@subscriptionResource
18+
@parentResource(SubscriptionLocationResource)
19+
model ComputeDiagnosticBase
20+
is Azure.ResourceManager.ProxyResource<DiagnosticProperties> {
21+
...ResourceNameParameter<
22+
Resource = ComputeDiagnosticBase,
23+
KeyName = "placementScore",
24+
SegmentName = "placementScores",
25+
NamePattern = ""
26+
>;
27+
}
28+
29+
@armResourceOperations
30+
interface ComputeDiagnosticBases {
31+
/**
32+
* Gets Spot Placement Scores metadata.
33+
*/
34+
get is ArmResourceRead<
35+
ComputeDiagnosticBase,
36+
BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters
37+
>;
38+
39+
/**
40+
* Generates placement scores for Spot VM skus.
41+
*/
42+
@action("generate")
43+
post is ArmResourceActionSync<
44+
ComputeDiagnosticBase,
45+
SpotPlacementScoresInput,
46+
ArmResponse<SpotPlacementScoresResponse>,
47+
BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters
48+
>;
49+
}
50+
51+
@@doc(ComputeDiagnosticBase.name, "");
52+
@@doc(ComputeDiagnosticBase.properties,
53+
"Contains additional properties of a diagnostic"
54+
);
55+
@@doc(ComputeDiagnosticBases.post::parameters.body,
56+
"SpotPlacementScores object supplied in the body of the Post spot placement scores operation."
57+
);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import "@azure-tools/typespec-client-generator-core";
2+
3+
using Azure.ClientGenerator.Core;
4+
using Microsoft.Compute;
5+
6+
@@clientLocation(ComputeDiagnosticBases.get, "SpotPlacementScores");
7+
@@clientLocation(ComputeDiagnosticBases.post, "SpotPlacementScores");
8+
@@clientName(ComputeDiagnosticBases.post::parameters.body,
9+
"spotPlacementScoresInput"
10+
);
11+
@@clientName(SpotPlacementScoresResponse,
12+
"SpotPlacementScoresResult",
13+
"csharp"
14+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"parameters": {
3+
"api-version": "2025-06-05",
4+
"location": "eastus",
5+
"spotPlacementScoresInput": {
6+
"availabilityZones": true,
7+
"desiredCount": 1,
8+
"desiredLocations": [
9+
"eastus",
10+
"eastus2"
11+
],
12+
"desiredSizes": [
13+
{
14+
"sku": "Standard_D2_v2"
15+
}
16+
]
17+
},
18+
"subscriptionId": "00000000-0000-0000-0000-000000000000"
19+
},
20+
"responses": {
21+
"200": {
22+
"body": {
23+
"availabilityZones": true,
24+
"desiredCount": 1,
25+
"desiredLocations": [
26+
"eastus",
27+
"eastus2"
28+
],
29+
"desiredSizes": [
30+
{
31+
"sku": "Standard_D2_v2"
32+
}
33+
],
34+
"placementScores": [
35+
{
36+
"availabilityZone": "1",
37+
"isQuotaAvailable": true,
38+
"region": "eastus",
39+
"score": "High",
40+
"sku": "Standard_D2_v2"
41+
},
42+
{
43+
"availabilityZone": "2",
44+
"isQuotaAvailable": true,
45+
"region": "eastus",
46+
"score": "High",
47+
"sku": "Standard_D2_v2"
48+
},
49+
{
50+
"availabilityZone": "3",
51+
"isQuotaAvailable": true,
52+
"region": "eastus",
53+
"score": "High",
54+
"sku": "Standard_D2_v2"
55+
},
56+
{
57+
"availabilityZone": "1",
58+
"isQuotaAvailable": true,
59+
"region": "eastus2",
60+
"score": "DataNotFoundOrStale",
61+
"sku": "Standard_D2_v2"
62+
},
63+
{
64+
"availabilityZone": "2",
65+
"isQuotaAvailable": true,
66+
"region": "eastus2",
67+
"score": "High",
68+
"sku": "Standard_D2_v2"
69+
},
70+
{
71+
"availabilityZone": "3",
72+
"isQuotaAvailable": true,
73+
"region": "eastus2",
74+
"score": "High",
75+
"sku": "Standard_D2_v2"
76+
}
77+
]
78+
},
79+
"headers": {
80+
"location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/placementScores/spot/generate?api-version=2025-06-05",
81+
"x-ms-request-id": "57b891ab-1fb7-4f5a-b002-71eb6854961f"
82+
}
83+
}
84+
},
85+
"operationId": "SpotPlacementScores_Post",
86+
"title": "Returns spot VM placement scores for given configurations."
87+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"parameters": {
3+
"api-version": "2025-06-05",
4+
"location": "eastus",
5+
"subscriptionId": "00000000-0000-0000-0000-000000000000"
6+
},
7+
"responses": {
8+
"200": {
9+
"body": {
10+
"name": "spotPlacementScores",
11+
"type": "Microsoft.Compute/placementScores",
12+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/placementScores/spot?api-version=2025-06-05",
13+
"properties": {
14+
"supportedResourceTypes": [
15+
"Microsoft.Compute/virtualMachines"
16+
]
17+
}
18+
},
19+
"headers": {
20+
"x-ms-request-id": "27b7c568-16ec-46f3-bcf1-5bea3f2529b1"
21+
}
22+
}
23+
},
24+
"operationId": "SpotPlacementScores_Get",
25+
"title": "Gets the metadata of Spot Placement Scores."
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"parameters": {
3+
"api-version": "2025-06-05"
4+
},
5+
"responses": {
6+
"200": {
7+
"body": {
8+
"value": [
9+
{
10+
"origin": "aaaaa",
11+
"name": "aaaaaaaaaaaa",
12+
"display": {
13+
"operation": "aaaaaaaaaaaaaaaaaaaaaa",
14+
"resource": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
15+
"description": "aaaaaaaaaaaaaaaaaaaaaa",
16+
"provider": "aaaaaaaaaaaaaaaaaa"
17+
}
18+
}
19+
]
20+
}
21+
}
22+
},
23+
"operationId": "Operations_List",
24+
"title": "Operations_List_MaximumSet_Gen"
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"parameters": {
3+
"api-version": "2025-06-05"
4+
},
5+
"responses": {
6+
"200": {
7+
"body": {}
8+
}
9+
},
10+
"operationId": "Operations_List",
11+
"title": "Operations_List_MinimumSet_Gen"
12+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* PLEASE DO NOT REMOVE - USED FOR CONVERTER METRICS
3+
* Generated by package: @autorest/openapi-to-typespec
4+
* Parameters used:
5+
* isFullCompatible: true
6+
* guessResourceKey: false
7+
* Version: 0.10.14
8+
* Date: 2025-07-18T08:45:04.778Z
9+
*/
10+
import "@typespec/rest";
11+
import "@typespec/versioning";
12+
import "./models.tsp";
13+
import "./ComputeDiagnosticBase.tsp";
14+
import "./back-compatible.tsp";
15+
16+
using TypeSpec.Rest;
17+
using TypeSpec.Http;
18+
using Azure.ResourceManager.Foundations;
19+
using Azure.Core;
20+
using Azure.ResourceManager;
21+
using TypeSpec.Versioning;
22+
/**
23+
* The Compute Recommender Resource Provider Client
24+
*/
25+
#suppress "@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
26+
@armProviderNamespace
27+
@service(#{ title: "ComputeRecommenderResourceProviderClient" })
28+
@versioned(Versions)
29+
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v6)
30+
namespace Microsoft.Compute;
31+
32+
interface Operations extends Azure.ResourceManager.Operations {}
33+
34+
/**
35+
* The available API versions.
36+
*/
37+
enum Versions {
38+
/**
39+
* The 2025-06-05 API version.
40+
*/
41+
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
42+
@useDependency(Azure.Core.Versions.v1_0_Preview_2)
43+
v2025_06_05: "2025-06-05",
44+
}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import "@typespec/rest";
2+
import "@typespec/http";
3+
import "@azure-tools/typespec-azure-resource-manager";
4+
5+
using TypeSpec.Rest;
6+
using TypeSpec.Http;
7+
using Azure.ResourceManager;
8+
using Azure.ResourceManager.Foundations;
9+
10+
namespace Microsoft.Compute;
11+
12+
/**
13+
* Contains additional properties of a diagnostic
14+
*/
15+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "This resource does not involve long-running operations and does not require provisioningState."
16+
model DiagnosticProperties {
17+
/**
18+
* Describes what are the supported resource types for a diagnostic.
19+
*/
20+
supportedResourceTypes?: string[];
21+
}
22+
23+
/**
24+
* SpotPlacementScores API Input.
25+
*/
26+
model SpotPlacementScoresInput {
27+
/**
28+
* The desired regions
29+
*/
30+
desiredLocations?: string[];
31+
32+
/**
33+
* The desired virtual machine SKU sizes.
34+
*/
35+
#suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "ResourceSize is a non-resource data structure representing SKU metadata; it is not individually addressable and does not require identifiers."
36+
desiredSizes?: ResourceSize[];
37+
38+
/**
39+
* Desired instance count per region/zone based on the scope.
40+
*/
41+
desiredCount?: int32;
42+
43+
/**
44+
* Defines if the scope is zonal or regional.
45+
*/
46+
availabilityZones?: boolean;
47+
}
48+
49+
/**
50+
* SpotPlacementRecommender API response.
51+
*/
52+
model ResourceSize {
53+
/**
54+
* The resource's CRP virtual machine SKU size.
55+
*/
56+
sku?: string;
57+
}
58+
59+
/**
60+
* SpotPlacementScores API response.
61+
*/
62+
model SpotPlacementScoresResponse {
63+
/**
64+
* The desired regions
65+
*/
66+
desiredLocations?: string[];
67+
68+
/**
69+
* The desired virtual machine SKU sizes.
70+
*/
71+
#suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "ResourceSize is a non-resource data structure representing SKU metadata; it is not individually addressable and does not require identifiers."
72+
desiredSizes?: ResourceSize[];
73+
74+
/**
75+
* Desired instance count per region/zone based on the scope.
76+
*/
77+
desiredCount?: int32;
78+
79+
/**
80+
* Defines if the scope is zonal or regional.
81+
*/
82+
availabilityZones?: boolean;
83+
84+
/**
85+
* A placement score indicating the likelihood of successfully allocating the specified Spot VM(s), as well as the expected lifetimes of the Spot VM(s) after allocation.
86+
*/
87+
#suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "PlacementScore is a non-resource data model used for telemetry and scoring; items are not uniquely addressable and do not require x-ms-identifiers."
88+
placementScores?: PlacementScore[];
89+
}
90+
91+
/**
92+
* The spot placement score for sku/region/zone combination.
93+
*/
94+
model PlacementScore {
95+
/**
96+
* The resource's CRP virtual machine SKU size.
97+
*/
98+
sku?: string;
99+
100+
/**
101+
* The region.
102+
*/
103+
region?: string;
104+
105+
/**
106+
* The availability zone.
107+
*/
108+
availabilityZone?: string;
109+
110+
/**
111+
* A placement score indicating the likelihood of successfully allocating the specified Spot VM(s), as well as the expected lifetimes of the Spot VM(s) after allocation.
112+
*/
113+
score?: string;
114+
115+
/**
116+
* Whether the desired quota is available.
117+
*/
118+
isQuotaAvailable?: boolean;
119+
}

0 commit comments

Comments
 (0)