Skip to content

Commit 3b150d8

Browse files
Add C# client customizations for Compute TypeSpec migration (#41351)
1 parent 37e9272 commit 3b150d8

6 files changed

Lines changed: 2781 additions & 37 deletions

File tree

specification/compute/resource-manager/Microsoft.Compute/Compute/Compute/VirtualMachineExtensionImage.tsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ model VirtualMachineExtensionImage
2727
alias ImageTypePath = {
2828
...ApiVersionParameter;
2929
...SubscriptionIdParameter;
30-
...LocationParameter;
30+
...LocationResourceParameter;
3131
#suppress "@azure-tools/typespec-azure-core/documentation-required"
3232
@path @segment("publishers") publisherName: string;
3333
};

specification/compute/resource-manager/Microsoft.Compute/Compute/Compute/back-compatible.tsp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ using Common;
2525
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "@flattenProperty decorator is not recommended to use."
2626
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Back compatibility"
2727
@@Azure.ClientGenerator.Core.Legacy.flattenProperty(
28-
VirtualMachineScaleSetUpdate.properties
28+
VirtualMachineScaleSetUpdate.properties,
29+
"!csharp"
2930
);
3031

3132
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "@flattenProperty decorator is not recommended to use."
@@ -206,7 +207,8 @@ using Common;
206207
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "@flattenProperty decorator is not recommended to use."
207208
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Back compatibility"
208209
@@Azure.ClientGenerator.Core.Legacy.flattenProperty(
209-
VirtualMachineScaleSet.properties
210+
VirtualMachineScaleSet.properties,
211+
"!csharp"
210212
);
211213

212214
@@clientName(
@@ -240,7 +242,8 @@ using Common;
240242
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "@flattenProperty decorator is not recommended to use."
241243
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Back compatibility"
242244
@@Azure.ClientGenerator.Core.Legacy.flattenProperty(
243-
VirtualMachineScaleSetVM.properties
245+
VirtualMachineScaleSetVM.properties,
246+
"!csharp"
244247
);
245248

246249
@@clientName(

specification/compute/resource-manager/Microsoft.Compute/Compute/Compute/routes.tsp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface UsageOperationGroup {
2929
list is ComputeProviderActionSync<
3030
Response = ListUsagesResult,
3131
Scope = SubscriptionActionScope,
32-
Parameters = LocationParameter
32+
Parameters = LocationResourceParameter
3333
>;
3434
}
3535

@@ -48,7 +48,7 @@ interface VirtualMachineSizesOperationGroup {
4848
list is ComputeProviderActionSync<
4949
Response = VirtualMachineSizeListResult,
5050
Scope = SubscriptionActionScope,
51-
Parameters = LocationParameter
51+
Parameters = LocationResourceParameter
5252
>;
5353
}
5454

@@ -67,7 +67,7 @@ interface VirtualMachineScaleSetsOperationGroup {
6767
listByLocation is ComputeProviderActionSync<
6868
Response = VirtualMachineScaleSetListResult,
6969
Scope = SubscriptionActionScope,
70-
Parameters = LocationParameter
70+
Parameters = LocationResourceParameter
7171
>;
7272
}
7373

@@ -86,7 +86,7 @@ interface VirtualMachinesOperationGroup {
8686
listByLocation is ComputeProviderActionSync<
8787
Response = VirtualMachineListResult,
8888
Scope = SubscriptionActionScope,
89-
Parameters = LocationParameter
89+
Parameters = LocationResourceParameter
9090
>;
9191
}
9292

@@ -105,7 +105,7 @@ interface VirtualMachineImagesEdgeZoneOperationGroup {
105105
Response = ArmResponse<VirtualMachineImageResource[]>,
106106
Scope = SubscriptionActionScope,
107107
Parameters = {
108-
...LocationParameter;
108+
...LocationResourceParameter;
109109

110110
/**
111111
* The name of the edge zone.
@@ -127,7 +127,7 @@ interface VirtualMachineImagesEdgeZoneOperationGroup {
127127
Response = ArmResponse<VirtualMachineImageResource[]>,
128128
Scope = SubscriptionActionScope,
129129
Parameters = {
130-
...LocationParameter;
130+
...LocationResourceParameter;
131131

132132
/**
133133
* The name of the edge zone.
@@ -156,7 +156,7 @@ interface VirtualMachineImagesEdgeZoneOperationGroup {
156156
Response = ArmResponse<VirtualMachineImageResource[]>,
157157
Scope = SubscriptionActionScope,
158158
Parameters = {
159-
...LocationParameter;
159+
...LocationResourceParameter;
160160

161161
/**
162162
* The name of the edge zone.
@@ -199,7 +199,7 @@ interface VirtualMachineImagesEdgeZoneOperationGroup {
199199
Response = ArmResponse<VirtualMachineImageResource[]>,
200200
Scope = SubscriptionActionScope,
201201
Parameters = {
202-
...LocationParameter;
202+
...LocationResourceParameter;
203203

204204
/**
205205
* The name of the edge zone.
@@ -315,7 +315,7 @@ interface VirtualMachineImagesOperationGroup {
315315
Response = VmImagesInEdgeZoneListResult,
316316
Scope = SubscriptionActionScope,
317317
Parameters = {
318-
...LocationParameter;
318+
...LocationResourceParameter;
319319

320320
/**
321321
* The name of the edge zone.
@@ -336,7 +336,7 @@ interface VirtualMachineImagesOperationGroup {
336336
listPublishers is ComputeProviderActionSync<
337337
Response = ArmResponse<VirtualMachineImageResource[]>,
338338
Scope = SubscriptionActionScope,
339-
Parameters = LocationParameter
339+
Parameters = LocationResourceParameter
340340
>;
341341
/**
342342
* Gets a list of virtual machine image offers for the specified location and publisher.
@@ -350,7 +350,7 @@ interface VirtualMachineImagesOperationGroup {
350350
Response = ArmResponse<VirtualMachineImageResource[]>,
351351
Scope = SubscriptionActionScope,
352352
Parameters = {
353-
...LocationParameter;
353+
...LocationResourceParameter;
354354

355355
/**
356356
* A valid image publisher.
@@ -372,7 +372,7 @@ interface VirtualMachineImagesOperationGroup {
372372
Response = ArmResponse<VirtualMachineImageResource[]>,
373373
Scope = SubscriptionActionScope,
374374
Parameters = {
375-
...LocationParameter;
375+
...LocationResourceParameter;
376376

377377
/**
378378
* A valid image publisher.
@@ -408,7 +408,7 @@ interface VirtualMachineImagesOperationGroup {
408408
Response = ArmResponse<VirtualMachineImageResource[]>,
409409
Scope = SubscriptionActionScope,
410410
Parameters = {
411-
...LocationParameter;
411+
...LocationResourceParameter;
412412

413413
/**
414414
* A valid image publisher.
@@ -461,7 +461,7 @@ interface VirtualMachineImagesOperationGroup {
461461
@get
462462
listWithProperties(
463463
...Azure.ResourceManager.Foundations.DefaultBaseParameters<SubscriptionActionScope>,
464-
...LocationParameter,
464+
...LocationResourceParameter,
465465

466466
/**
467467
* A valid image publisher.
@@ -555,7 +555,7 @@ interface LogAnalyticsOperationGroup {
555555
LroHeaders = ArmAsyncOperationHeader<FinalResult = LogAnalyticsOperationResult> &
556556
Azure.Core.Foundations.RetryAfterHeader,
557557
Scope = SubscriptionActionScope,
558-
Parameters = LocationParameter,
558+
Parameters = LocationResourceParameter,
559559
Request = RequestRateByIntervalInput
560560
>;
561561
/**
@@ -571,7 +571,7 @@ interface LogAnalyticsOperationGroup {
571571
LroHeaders = ArmAsyncOperationHeader<FinalResult = LogAnalyticsOperationResult> &
572572
Azure.Core.Foundations.RetryAfterHeader,
573573
Scope = SubscriptionActionScope,
574-
Parameters = LocationParameter,
574+
Parameters = LocationResourceParameter,
575575
Request = ThrottledRequestsInput
576576
>;
577577
}
@@ -591,7 +591,7 @@ interface VirtualMachineRunCommandsOperationGroup {
591591
list is ComputeProviderActionSync<
592592
Response = RunCommandListResult,
593593
Scope = SubscriptionActionScope,
594-
Parameters = LocationParameter
594+
Parameters = LocationResourceParameter
595595
>;
596596
/**
597597
* Gets specific run command for a subscription in a location.

specification/compute/resource-manager/Microsoft.Compute/Compute/ComputeGallery/models.tsp

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2740,17 +2740,12 @@ model LatestGalleryImageVersion {
27402740
*
27412741
* See more details on [different Azure Resource Manager resource type here.](https://azure.github.io/typespec-azure/docs/howtos/ARM/resource-type)
27422742
* @template Properties A model containing the provider-specific properties for this resource
2743-
* @template PropertiesOptional A boolean flag indicating whether the resource `Properties` field is marked as optional or required. Default true is optional and recommended.
27442743
*/
2745-
#suppress "@azure-tools/typespec-azure-core/no-private-usage"
2746-
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage"
2744+
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "Required to keep parentName out of the payload while preserving C# resource-key shape."
27472745
@doc("Concrete proxy resource types can be created by aliasing this type using a specific property type.")
27482746
@Http.Private.includeInapplicableMetadataInPayload(false)
2749-
@Azure.ResourceManager.Legacy.customAzureResource
2750-
model ProxyResourceCommunity<
2751-
Properties extends {},
2752-
PropertiesOptional extends valueof boolean = true
2753-
> extends PirCommunityGalleryResource {
2747+
model ProxyResourceCommunity<Properties extends {}>
2748+
extends PirCommunityGalleryResource {
27542749
@doc("The resource-specific properties for this resource.")
27552750
properties?: Properties;
27562751

@@ -2768,17 +2763,12 @@ model ProxyResourceCommunity<
27682763
*
27692764
* See more details on [different Azure Resource Manager resource type here.](https://azure.github.io/typespec-azure/docs/howtos/ARM/resource-type)
27702765
* @template Properties A model containing the provider-specific properties for this resource
2771-
* @template PropertiesOptional A boolean flag indicating whether the resource `Properties` field is marked as optional or required. Default true is optional and recommended.
27722766
*/
2773-
#suppress "@azure-tools/typespec-azure-core/no-private-usage"
2774-
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage"
2767+
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "Required to keep parentName out of the payload while preserving C# resource-key shape."
27752768
@doc("Concrete proxy resource types can be created by aliasing this type using a specific property type.")
27762769
@Http.Private.includeInapplicableMetadataInPayload(false)
2777-
@Azure.ResourceManager.Legacy.customAzureResource
2778-
model ProxyResourceShared<
2779-
Properties extends {},
2780-
PropertiesOptional extends valueof boolean = true
2781-
> extends PirSharedGalleryResource {
2770+
model ProxyResourceShared<Properties extends {}>
2771+
extends PirSharedGalleryResource {
27822772
@doc("The resource-specific properties for this resource.")
27832773
properties?: Properties;
27842774

0 commit comments

Comments
 (0)