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 3 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
27 changes: 27 additions & 0 deletions src/LabServices/LabServices.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 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])]
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess)]
param(
[Parameter()]
Expand All @@ -37,18 +37,20 @@ function Add-AzLabServicesUserQuota_Email {
[Parameter(Mandatory)]
[System.String]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Category('Path')]
# The name of the resource group.
# The name is case insensitive.
${ResourceGroupName},

[Parameter(Mandatory)]
[System.String]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Category('Path')]
# The name of the lab.
${LabName},

[Parameter(Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Category('Path')]
[System.String]
# The name of the user that uniqely identifies it within containing lab.
# Used in resource URIs.
# Email address of the user.
${Email},

[Parameter(Mandatory)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ 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 of a lab that can register for and use virtual machines within the lab.
${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 All @@ -37,6 +37,8 @@ param(
[Parameter(Mandatory)]
[SupportsWildcards()]
[System.String]
# The name of the user that uniquely identifies it within containing lab.
# Used in resource URIs.
${Name},

[Parameter()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ 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)]
[System.String]
# The resource Id of the lab plan that uniquely identifies it.
${ResourceId},

[Parameter()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,25 @@ 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]
# The object of Lab Plans.
# Acted as a permission container for creating labs via labs.azure.com.
${LabPlan},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Category('Path')]
[System.String]
# The name of the user that uniquely identifies it within containing lab.
# Used in resource URIs.
${Name},

[Parameter()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,25 @@ 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(

[Parameter()]
[System.String]
# The name of the resource group.
# The name is case insensitive.
${ResourceGroupName},

[Parameter(Mandatory)]
[SupportsWildcards()]
[System.String]
# The name of the lab that uniquely identifies it.
${Name},

[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_ListByResourceGroup {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.Api20211001Preview.ILab])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.ILab])]
[CmdletBinding(PositionalBinding=$false)]
param(
[Parameter()]
Expand All @@ -36,6 +36,8 @@ function Get-AzLabServicesLab_ListByResourceGroup {

[Parameter(Mandatory)]
[System.String]
# The name of the resource group.
# The name is case insensitive.
${ResourceGroupName},

[Parameter()]
Expand Down Expand Up @@ -87,7 +89,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,17 +19,18 @@ 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},
# The resource Id of the lab that uniquely identifies it.
${ResourceId},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Category('Path')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ 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)]
[System.String]
${ResourceId},
# The resource Id of the VM that uniquely identifies it.
${ResourceId},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.LabServices.Category('Path')]
Expand Down
Loading