Skip to content

[PS] Migrate LabServices module to autorest v4 #27877

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
26 changes: 26 additions & 0 deletions src/LabServices/LabServices.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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 - LabServices")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.2")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.1.2")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
63 changes: 43 additions & 20 deletions src/LabServices/LabServices.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,46 @@ subject-prefix: $(service-name)

inlining-threshold: 50

# 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:
verb: (.*)
set:
breaking-change:
deprecated-by-version: 0.2.0
deprecated-by-azversion: 18.2.0
change-effective-date: 2027/06/28
change-description: Azure Lab Services will be retired on June 28, 2027, please see details on https://azure.microsoft.com/en-us/updates?id=azure-lab-services-is-being-retired.

# reset vm password / New Lab / Update lab to set securestring passwords
- from: swagger-document
where: $.definitions.ResetPasswordBody.properties.password
transform: >-
return {
"description": "The password",
"type": "string",
"x-ms-secret": true,
"x-ms-mutability": [
"create"
],
"format": "password"
}
- from: swagger-document
where: $.definitions.Credentials.properties.password
transform: >-
return {
"description": "The password for the user. This is required for the TemplateVM createOption.",
"type": "string",
"x-ms-secret": true,
"x-ms-mutability": [
"create"
],
"format": "password"
}
# Fix bug that the words of create or update will be replaced
- from: source-file-csharp
where: $
transform: $ = $.replace(/"Publish or re-publish a lab. This will publish all lab resources, such as virtual machines."/g, '"Publish or re-publish a lab. This will create or update all lab resources, such as virtual machines."');
# change VirtualMachine to VM
- where:
subject: ^(.*)(VirtualMachine)(.*)$
Expand Down Expand Up @@ -136,10 +171,6 @@ directive:
- where:
verb: Set
remove: true
# remove the Identity variants
- where:
variant: ^(.*)ViaIdentity(.*)$
remove: true
# Change LabImage to LabPlanImage
- where:
verb: Get
Expand Down Expand Up @@ -170,20 +201,12 @@ directive:
verb: Update
subject: $1VMReimage
- where:
variant: ^Create$|^Update$|^Reset$|^Save$|^Invite$
variant: ^(Create|Update|Reset|Save|Invite)(?!.*?(Expanded|JsonFilePath|JsonString))
remove: true
# Hide reset vm password / New Lab / Update lab to set securestring passwords
- where:
verb: Reset
hide: true
- where:
verb: New
subject: Lab
hide: true
- where:
verb: Update
subject: Lab
hide: true
variant: ^CreateViaIdentityExpanded$
remove: true
# Custom new variant (rename parameter)
- where:
verb: Get
subject: Lab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ API to add additional user quota.
API to add additional user quota.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.IUser
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.IUser
.Link
https://learn.microsoft.com/powershell/module/az.labservices/add-azlabservicesuserquota
#>
function Add-AzLabServicesUserQuota_Email {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.IUser])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.IUser])]
Copy link
Preview

Copilot AI May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the trailing whitespace after the OutputType attribute to adhere to formatting standards and avoid diff noise.

Copilot uses AI. Check for mistakes.

[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess)]
param(
[Parameter()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ API to add additional user quota.
API to add additional user quota.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.IUser
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.IUser
.Link
https://learn.microsoft.com/powershell/module/az.labservices/add-azlabservicesuserquota
#>
function Add-AzLabServicesUserQuota_User {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.IUser])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.IUser])]
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess)]
param(
[Parameter(Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.User]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.User]
${User},

[Parameter(Mandatory)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ API to get lab plans.
API to get lab plans.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILabPlan
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILabPlan
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabserviceslabplan
#>
function Get-AzLabServicesLabPlan_ListByLabPlanName {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILabPlan])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILabPlan])]
[CmdletBinding(PositionalBinding=$false)]
param(
[Parameter()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ API to get lab plans.
API to get lab plans.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILabPlan
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILabPlan
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabserviceslabplan
#>
function Get-AzLabServicesLabPlan_ResourceId {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILabPlan])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILabPlan])]
[CmdletBinding(PositionalBinding=$false)]
param(
[Parameter(Mandatory, ValueFromPipeline)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ API to get labs.
API to get labs.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILab
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILab
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabserviceslab
#>
function Get-AzLabServicesLab_LabPlan {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILab])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILab])]
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess)]
param(
[Parameter(Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.LabPlan]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.LabPlan]
${LabPlan},

[Parameter()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ API to get labs.
API to get labs.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILab
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILab
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabserviceslab
#>
function Get-AzLabServicesLab_ListByLabName {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILab])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILab])]
[CmdletBinding(PositionalBinding=$false)]
param(

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ API to get labs.
API to get labs.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILab
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILab
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabserviceslab
#>
function Get-AzLabServicesLab_ListByResourceGroup {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILab])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILab])]
[CmdletBinding(PositionalBinding=$false)]
param(
[Parameter()]
Expand Down Expand Up @@ -87,7 +87,7 @@ function Get-AzLabServicesLab_ListByResourceGroup {
)

process {
return Az.LabServices.internal\Get-AzLabServicesLab @PSBoundParameters
return Az.LabServices.private\Get-AzLabServicesLab_List1 @PSBoundParameters
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ API to get labs.
API to get labs.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILab
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILab
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabserviceslab
#>
function Get-AzLabServicesLab_ListBySubscription {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILab])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILab])]
[CmdletBinding(PositionalBinding=$false)]
param(
[Parameter()]
Expand Down Expand Up @@ -83,7 +83,7 @@ function Get-AzLabServicesLab_ListBySubscription {
)

process {
return Az.LabServices.internal\Get-AzLabServicesLab @PSBoundParameters
return Az.LabServices.private\Get-AzLabServicesLab_List @PSBoundParameters
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ API to get labs.
API to get labs.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILab
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILab
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabserviceslab
#>
function Get-AzLabServicesLab_ResourceId {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILab])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILab])]
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess)]
param(
param(
[Parameter(Mandatory)]
[System.String]
${ResourceId},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ API to return the lab for a specific VM.
API to return the lab for a specific VM.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILab
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILab
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabserviceslabforvm
#>
function Get-AzLabServicesLabForVM {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILab])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILab])]
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess)]
param(
[Parameter(Mandatory)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ API to get lab plan images.
API to get lab plan images.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.IImage
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.IImage
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabservicesplanimage
#>
function Get-AzLabServicesPlanImage_LabPlan {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.IImage])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.IImage])]
[CmdletBinding(PositionalBinding=$false)]
param(
[Parameter(Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.LabPlan]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.LabPlan]
${LabPlan},

[Parameter()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ API to get lab plan images.
API to get lab plan images.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.IImage
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.IImage
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabservicesplanimage
#>
function Get-AzLabServicesPlanImage_ListByDisplayName {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.IImage])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.IImage])]
[CmdletBinding(PositionalBinding=$false)]
param(
[Parameter()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ API to get lab plan images.
API to get lab plan images.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.IImage
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.IImage
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabservicesplanimage
#>
function Get-AzLabServicesPlanImage_ResourceId {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.IImage])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.IImage])]
[CmdletBinding(PositionalBinding=$false)]
param(
[Parameter(Mandatory)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ API to get lab schedule.
API to get lab schedule.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ISchedule
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ISchedule
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabservicesschedule
#>
function Get-AzLabServicesSchedule_Lab {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ISchedule])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ISchedule])]
[CmdletBinding(PositionalBinding=$false)]
param(
[Parameter(Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.Lab]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Lab]
${Lab},

[Parameter()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ API to get lab schedule.
API to get lab schedule.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ISchedule
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ISchedule
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabservicesschedule
#>
function Get-AzLabServicesSchedule_LabObject {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ISchedule])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ISchedule])]
[CmdletBinding(PositionalBinding=$false)]
param(
[Parameter(Mandatory)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ API to get the template vm for the lab.
API to get the template vm for the lab.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.IVirtualMachine
Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.IVirtualMachine
.Link
https://learn.microsoft.com/powershell/module/az.labservices/get-azlabservicestemplatevm
#>
function Get-AzLabServicesTemplateVM_Get {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.IVirtualMachine])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.IVirtualMachine])]
[CmdletBinding(PositionalBinding=$false)]
param(
[Parameter()]
Expand Down
Loading