Skip to content

Commit 2325694

Browse files
welovejv-jiaodiChenxiJiang333v-huizhu2weidongxu-microsoft
authored
Tyespec migration for Commerce (#39248)
* converted * could compile * Update models.tsp * update * Update routes.tsp * update * update * update * update * update * Update routes.tsp * Create client.tsp * delete before relocate * relocate to conform v2 structure * feat(commerce): add Java client customizations and update emitter options - Add @clientName decorator for UsageManager in Java - Add @alternateType mapping for UsageSample infoFields to ClientCustomizations.InfoField - Configure tspconfig.yaml with Azure-specific options: - Enable object usage for unknown types - Enable client-side validations - Set UUID as number instead of string - Set float32 as double instead of float * Update routes.tsp * Update client.tsp * Remove Java client and alternate type from client.tsp Removed Java client name and alternate type definition. * Add stream-style-serialization option to tspconfig * Update client.tsp * update * Revert "update" This reverts commit 4a1289a. * update * Update specification/commerce/resource-manager/Microsoft.Commerce/Commerce/tspconfig.yaml * add go config * revert go config * Update tspconfig.yaml by removing unused properties Removed service-dir and is-modular-library properties. * update client name * Enable compatibility-lro in tspconfig.yaml * Remove compatibility-lro from tspconfig.yaml Removed compatibility-lro setting from TypeSpec configuration. * update --------- 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: Hui Zhu <v-huizhu2@microsoft.com> Co-authored-by: Weidong Xu <weidxu@microsoft.com> Co-authored-by: Judy Liu <v-liujudy@microsoft.com> Co-authored-by: Jiao Di (MSFT) <v-jiaodi@microsoft.com> Co-authored-by: Pan Shao <97225342+pshao25@users.noreply.github.com>
1 parent 00266ca commit 2325694

12 files changed

Lines changed: 1101 additions & 354 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import "@azure-tools/typespec-client-generator-core";
2+
3+
using Azure.ClientGenerator.Core;
4+
using Microsoft.Commerce;
5+
6+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
7+
@@Legacy.flattenProperty(UsageAggregation.properties);
8+
9+
@@clientLocation(UsageAggregatesOperationGroup.list, "UsageAggregates");
10+
11+
@@clientLocation(RateCardOperationGroup.get, "RateCard");
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import "./main.tsp";
2+
import "@azure-tools/typespec-client-generator-core";
3+
4+
using Azure.ClientGenerator.Core;
5+
using Microsoft.Commerce;
6+
7+
@@clientName(Microsoft.Commerce, "UsageManagementClient", "python, javascript");
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"parameters": {
3+
"$filter": "OfferDurableId eq 'MS-AZR-0003P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'",
4+
"api-version": "2015-06-01-preview",
5+
"subscriptionId": "6d61cc05-8f8f-4916-b1b9-f1d9c25aae27"
6+
},
7+
"title": "GetRateCard",
8+
"responses": {
9+
"200": {
10+
"body": {
11+
"Meters": [
12+
{
13+
"EffectiveDate": "2017-09-01T00:00:00Z",
14+
"IncludedQuantity": 0,
15+
"MeterCategory": "Test Category",
16+
"MeterId": "1d7518e5-bc2f-4a93-9057-1b3047856645",
17+
"MeterName": "Test Meter",
18+
"MeterRates": {
19+
"0": 1.99,
20+
"100": 0.99
21+
},
22+
"MeterRegion": "US West",
23+
"MeterSubCategory": "Test Subcategory",
24+
"MeterTags": [
25+
"Third Party"
26+
],
27+
"Unit": "Hours"
28+
}
29+
],
30+
"OfferTerms": []
31+
}
32+
}
33+
},
34+
"operationId": "RateCard_Get"
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"parameters": {
3+
"aggregationGranularity": "Daily",
4+
"api-version": "2015-06-01-preview",
5+
"reportedEndTime": "2015-06-01T00:00:00+00:00",
6+
"reportedStartTime": "2014-05-01T00:00:00+00:00",
7+
"showDetails": "true",
8+
"subscriptionId": "f68815e6-3c41-45ef-bbd8-5f83303c396b"
9+
},
10+
"title": "GetUsageAggregatesList",
11+
"responses": {
12+
"200": {
13+
"body": {
14+
"value": [
15+
{
16+
"name": "Daily_BRSDT_20140501_0000",
17+
"type": "Microsoft.Commerce/UsageAggregate",
18+
"id": "/subscriptions/f68815e6-3c41-45ef-bbd8-5f83303c396b/providers/Microsoft.Commerce/UsageAggregates/Daily_BRSDT_20140501_0000",
19+
"properties": {
20+
"infoFields": {},
21+
"meterCategory": "Storage",
22+
"meterId": "0e9d0c9b-ab6d-4312-9c7e-3794e22af9c4",
23+
"meterName": "Standard IO – Page Blob/Disk (GB)",
24+
"meterSubCategory": "Geo Redundant",
25+
"quantity": 0.057865,
26+
"subscriptionId": "f68815e6-3c41-45ef-bbd8-5f83303c396b",
27+
"unit": "GB",
28+
"usageEndTime": "2015-03-04T00:00:00+00:00",
29+
"usageStartTime": "2015-03-03T00:00:00+00:00"
30+
}
31+
}
32+
]
33+
}
34+
},
35+
"202": {
36+
"body": {
37+
"error": {
38+
"code": "aaaaaaaaaaaaaaaaaaaaaa",
39+
"message": "aaaaaaaaaaaaaaaaaaaa"
40+
}
41+
}
42+
}
43+
},
44+
"operationId": "UsageAggregates_List"
45+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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.11.12
8+
* Date: 2025-12-12T02:06:35.769Z
9+
*/
10+
import "@typespec/rest";
11+
import "@typespec/versioning";
12+
import "@azure-tools/typespec-azure-core";
13+
import "@azure-tools/typespec-azure-resource-manager";
14+
import "./models.tsp";
15+
import "./back-compatible.tsp";
16+
import "./routes.tsp";
17+
18+
using TypeSpec.Rest;
19+
using TypeSpec.Http;
20+
using Azure.ResourceManager.Foundations;
21+
using Azure.Core;
22+
using Azure.ResourceManager;
23+
using TypeSpec.Versioning;
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: "UsageManagementClient" })
28+
@versioned(Versions)
29+
// FIXME: Common type version not set. Set to v3.
30+
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3)
31+
namespace Microsoft.Commerce;
32+
33+
/**
34+
* The available API versions.
35+
*/
36+
enum Versions {
37+
/**
38+
* The 2015-06-01-preview API version.
39+
*/
40+
v2015_06_01_preview: "2015-06-01-preview",
41+
}

0 commit comments

Comments
 (0)