Skip to content

migrate LoadTesting to autorest v4 #28284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
32 changes: 32 additions & 0 deletions src/LoadTesting/LoadTesting.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the ""License"");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an ""AS IS"" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - LoadTesting")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.1.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.1.0")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]






35 changes: 12 additions & 23 deletions src/LoadTesting/LoadTesting.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ input-file:
title: LoadTesting
module-version: 0.1.0
subject-prefix: ""

resourcegroup-append: true
nested-object-to-string: true
inlining-threshold: 200

# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
use-extension:
"@autorest/powershell": "3.x"

directive:
- where:
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
remove: true

- where:
variant: ^CreateViaIdentityExpanded$|^UpdateViaIdentityExpanded$|^GetViaIdentity$|^DeleteViaIdentity$
remove: true

# https://stackoverflow.microsoft.com/questions/333196
- where:
subject: .*Quota.*
Expand All @@ -61,10 +62,6 @@ directive:
set:
subject: Load

- where:
variant: ^Create$|^Update$|.*ViaIdentity$|.*ViaIdentityExpanded$
remove: true

# Removing Set command
- where:
verb: Set
Expand All @@ -80,7 +77,7 @@ directive:
- where:
parameter-name: IdentityUserAssignedIdentity
set:
parameter-name: IdentityUserAssigned
parameter-name: UserAssignedIdentity

# Renaming encryption key parameter
- where:
Expand Down Expand Up @@ -142,7 +139,7 @@ directive:
# Hiding redundant SystemData property
- from: source-file-csharp
where: $
transform: $ = $.replace('public Microsoft.Azure.PowerShell.Cmdlets.LoadTesting.Models.Api30.ISystemData SystemData', 'private Microsoft.Azure.PowerShell.Cmdlets.LoadTesting.Models.Api30.ISystemData SystemData');
transform: $ = $.replace('public Microsoft.Azure.PowerShell.Cmdlets.LoadTesting.Models.ISystemData SystemData', 'private Microsoft.Azure.PowerShell.Cmdlets.LoadTesting.Models.ISystemData SystemData');

- from: source-file-csharp
where: $
Expand Down Expand Up @@ -252,20 +249,12 @@ directive:
- where:
verb: New
subject: Load
variant: ^CreateExpanded$
hide: true

- where:
verb: Update
subject: Load
hide: true

- where:
verb: Get
subject: Load
hide: true

- where:
verb: Remove
subject: Load
variant: ^UpdateExpanded$
hide: true
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"resourceType": "loadTests",
"apiVersion": "2022-12-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.loadtesting"
},
"commands": [
{
"name": "Get-AzLoad",
"description": "Get a LoadTest resource.",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.loadtesting/get-azload"
},
"parameterSets": [
{
"parameters": [
"-Name <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String[]>]"
]
}
]
},
"examples": [
{
"description": "Get a LoadTest resource.",
"parameters": [
{
"name": "-Name",
"value": "[Path.loadTestName]"
},
{
"name": "-ResourceGroupName",
"value": "[Path.resourceGroupName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
},
{
"name": "Remove-AzLoad",
"description": "Delete a LoadTest resource.",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.loadtesting/remove-azload"
},
"parameterSets": [
{
"parameters": [
"-Name <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String>]"
]
}
]
},
"examples": [
{
"description": "Delete a LoadTest resource.",
"parameters": [
{
"name": "-Name",
"value": "[Path.loadTestName]"
},
{
"name": "-ResourceGroupName",
"value": "[Path.resourceGroupName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
}
]
}
114 changes: 0 additions & 114 deletions src/LoadTesting/LoadTesting.Autorest/custom/Get-AzLoad.ps1

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

namespace Microsoft.Azure.PowerShell.Cmdlets.LoadTesting.Models.Api20221201
namespace Microsoft.Azure.PowerShell.Cmdlets.LoadTesting.Models
{
using static Microsoft.Azure.PowerShell.Cmdlets.LoadTesting.Runtime.Extensions;

public partial class EncryptionPropertiesIdentity
{
partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.LoadTesting.Runtime.Json.JsonObject container){
if(string.Empty.Equals(this.ResourceId))
if(string.IsNullOrEmpty(this.ResourceId))
{
container.Remove("resourceId");
container.Add("resourceId", Runtime.Json.XNull.Instance);
// Don't add null value back - completely remove the field for SystemAssigned identity
}
}
}
Expand Down
Loading