Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";

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

namespace Microsoft.Compute;
/**
* Contains metadata of a diagnostic type
*/
@singleton("spot")
@subscriptionResource
@parentResource(SubscriptionLocationResource)
model ComputeDiagnosticBase
is Azure.ResourceManager.ProxyResource<DiagnosticProperties> {
...ResourceNameParameter<
Resource = ComputeDiagnosticBase,
KeyName = "placementScore",
SegmentName = "placementScores",
NamePattern = ""
>;
}

@armResourceOperations
interface ComputeDiagnosticBases {
/**
* Gets Spot Placement Scores metadata.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@operationId("SpotPlacementScores_Get")
get is ArmResourceRead<
ComputeDiagnosticBase,
BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters
>;

/**
* Generates placement scores for Spot VM skus.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@action("generate")
@operationId("SpotPlacementScores_Post")
post is ArmResourceActionSync<
ComputeDiagnosticBase,
SpotPlacementScoresInput,
ArmResponse<SpotPlacementScoresResponse>,
BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters
>;
}

@@doc(ComputeDiagnosticBase.name, "");
@@doc(ComputeDiagnosticBase.properties,
"Contains additional properties of a diagnostic"
);
@@doc(ComputeDiagnosticBases.post::parameters.body,
"SpotPlacementScores object supplied in the body of the Post spot placement scores operation."
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import "@azure-tools/typespec-client-generator-core";

using Azure.ClientGenerator.Core;
using Microsoft.Compute;

@@clientName(ComputeDiagnosticBases.post::parameters.body,
"spotPlacementScoresInput"
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{

Check failure on line 1 in specification/compute/resource-manager/Microsoft.Compute/RecommenderRP/examples/2025-06-05/GenerateSpotPlacementScores.json

View check run for this annotation

Azure Pipelines / Swagger PrettierCheck

specification/compute/resource-manager/Microsoft.Compute/RecommenderRP/examples/2025-06-05/GenerateSpotPlacementScores.json#L1

specification/compute/resource-manager/Microsoft.Compute/RecommenderRP/examples/2025-06-05/GenerateSpotPlacementScores.json(1,1): error : Code style issues found, please run prettier. > npm install > npx prettier --write specification/compute/resource-manager/Microsoft.Compute/RecommenderRP/examples/2025-06-05/GenerateSpotPlacementScores.json
"parameters": {
"api-version": "2025-06-05",
"location": "eastus",
"spotPlacementScoresInput": {
"availabilityZones": true,
"desiredCount": 1,
"desiredLocations": [
"eastus",
"eastus2"
],
"desiredSizes": [
{
"sku": "Standard_D2_v2"
}
]
},
"subscriptionId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {
"body": {
"availabilityZones": true,
"desiredCount": 1,
"desiredLocations": [
"eastus",
"eastus2"
],
"desiredSizes": [
{
"sku": "Standard_D2_v2"
}
],
"placementScores": [
{
"availabilityZone": "1",
"isQuotaAvailable": true,
"region": "eastus",
"score": "High",
"sku": "Standard_D2_v2"
},
{
"availabilityZone": "2",
"isQuotaAvailable": true,
"region": "eastus",
"score": "High",
"sku": "Standard_D2_v2"
},
{
"availabilityZone": "3",
"isQuotaAvailable": true,
"region": "eastus",
"score": "High",
"sku": "Standard_D2_v2"
},
{
"availabilityZone": "1",
"isQuotaAvailable": true,
"region": "eastus2",
"score": "DataNotFoundOrStale",
"sku": "Standard_D2_v2"
},
{
"availabilityZone": "2",
"isQuotaAvailable": true,
"region": "eastus2",
"score": "High",
"sku": "Standard_D2_v2"
},
{
"availabilityZone": "3",
"isQuotaAvailable": true,
"region": "eastus2",
"score": "High",
"sku": "Standard_D2_v2"
}
]
},
"headers": {
"location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/placementScores/spot/generate?api-version=2025-06-05",
"x-ms-request-id": "57b891ab-1fb7-4f5a-b002-71eb6854961f"
}
}
},
"operationId": "SpotPlacementScores_Post",
"title": "Returns spot VM placement scores for given configurations."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{

Check failure on line 1 in specification/compute/resource-manager/Microsoft.Compute/RecommenderRP/examples/2025-06-05/GetSpotPlacementScores.json

View check run for this annotation

Azure Pipelines / Swagger PrettierCheck

specification/compute/resource-manager/Microsoft.Compute/RecommenderRP/examples/2025-06-05/GetSpotPlacementScores.json#L1

specification/compute/resource-manager/Microsoft.Compute/RecommenderRP/examples/2025-06-05/GetSpotPlacementScores.json(1,1): error : Code style issues found, please run prettier. > npm install > npx prettier --write specification/compute/resource-manager/Microsoft.Compute/RecommenderRP/examples/2025-06-05/GetSpotPlacementScores.json
"parameters": {
"api-version": "2025-06-05",
"location": "eastus",
"subscriptionId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {
"body": {
"name": "spotPlacementScores",
"type": "Microsoft.Compute/placementScores",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/placementScores/spot?api-version=2025-06-05",
"properties": {
"supportedResourceTypes": [
"Microsoft.Compute/virtualMachines"
]
}
},
"headers": {
"x-ms-request-id": "27b7c568-16ec-46f3-bcf1-5bea3f2529b1"
}
}
},
"operationId": "SpotPlacementScores_Get",
"title": "Gets the metadata of Spot Placement Scores."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* PLEASE DO NOT REMOVE - USED FOR CONVERTER METRICS
* Generated by package: @autorest/openapi-to-typespec
* Parameters used:
* isFullCompatible: true
* guessResourceKey: false
* Version: 0.10.14
* Date: 2025-07-18T08:45:04.778Z
*/
import "@typespec/rest";
import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "./models.tsp";
import "./ComputeDiagnosticBase.tsp";
import "./back-compatible.tsp";

using TypeSpec.Rest;
using TypeSpec.Http;
using Azure.ResourceManager.Foundations;
using Azure.Core;
using Azure.ResourceManager;
using TypeSpec.Versioning;
/**
* The Compute Recommender Resource Provider Client
*/
#suppress "@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@armProviderNamespace
@service(#{ title: "ComputeRecommenderResourceProviderClient" })
@versioned(Versions)
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5)
namespace Microsoft.Compute;

/**
* The available API versions.
*/
enum Versions {
/**
* The 2025-06-05 API version.
*/
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
@useDependency(Azure.Core.Versions.v1_0_Preview_1)
v2025_06_05: "2025-06-05",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import "@typespec/rest";
import "@typespec/http";
import "@azure-tools/typespec-azure-resource-manager";

using TypeSpec.Rest;
using TypeSpec.Http;
using Azure.ResourceManager;
using Azure.ResourceManager.Foundations;

namespace Microsoft.Compute;

/**
* Contains additional properties of a diagnostic
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
model DiagnosticProperties {
/**
* Describes what are the supported resource types for a diagnostic.
*/
supportedResourceTypes?: string[];
}

/**
* Common fields that are returned in the response for all Azure Resource Manager resources
*/
model Resource {
/**
* Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
*/
@visibility(Lifecycle.Read)
id?: Azure.Core.armResourceIdentifier;

/**
* The name of the resource
*/
@visibility(Lifecycle.Read)
name?: string;

/**
* The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
*/
@visibility(Lifecycle.Read)
type?: string;

/**
* Azure Resource Manager metadata containing createdBy and modifiedBy information.
*/
@visibility(Lifecycle.Read)
systemData?: SystemData;
}

/**
* SpotPlacementScores API Input.
*/
model SpotPlacementScoresInput {
/**
* The desired regions
*/
desiredLocations?: string[];

/**
* The desired virtual machine SKU sizes.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
desiredSizes?: ResourceSize[];

/**
* Desired instance count per region/zone based on the scope.
*/
desiredCount?: int32;

/**
* Defines if the scope is zonal or regional.
*/
availabilityZones?: boolean;
}

/**
* SpotPlacementRecommender API response.
*/
model ResourceSize {
/**
* The resource's CRP virtual machine SKU size.
*/
sku?: string;
}

/**
* SpotPlacementScores API response.
*/
model SpotPlacementScoresResponse {
/**
* The desired regions
*/
desiredLocations?: string[];

/**
* The desired virtual machine SKU sizes.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
desiredSizes?: ResourceSize[];

/**
* Desired instance count per region/zone based on the scope.
*/
desiredCount?: int32;

/**
* Defines if the scope is zonal or regional.
*/
availabilityZones?: boolean;

/**
* 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.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
placementScores?: PlacementScore[];
}

/**
* The spot placement score for sku/region/zone combination.
*/
model PlacementScore {
/**
* The resource's CRP virtual machine SKU size.
*/
sku?: string;

/**
* The region.
*/
region?: string;

/**
* The availability zone.
*/
availabilityZone?: string;

/**
* 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.
*/
score?: string;

/**
* Whether the desired quota is available.
*/
isQuotaAvailable?: boolean;
}
Loading
Loading