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

Conversation

JoyerJin
Copy link
Contributor

@JoyerJin JoyerJin commented May 30, 2025

Description

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

@Copilot Copilot AI review requested due to automatic review settings May 30, 2025 10:24
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the LabServices PowerShell module to AutoRest v4 by updating model namespaces, unifying command implementations, and refreshing generation directives and assembly metadata.

  • Updated cmdlet scripts to use the new Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models types instead of Api20211001Preview variants.
  • Adjusted internal invocations in list commands to point at private helper functions.
  • Refreshed UX JSON descriptions, updated autorest directives, and added an AssemblyInfo.cs for module metadata.

Reviewed Changes

Copilot reviewed 142 out of 142 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/LabServices/.../custom/*.ps1 Swapped out Api20211001Preview model types for Models.*; updated OutputType and parameter type references.
src/LabServices/.../Get-AzLabServicesLab_ListBySubscription.ps1 Changed internal call from internal\Get-AzLabServicesLab to private\Get-AzLabServicesLab_List.
src/LabServices/.../Get-AzLabServicesLab_ListByResourceGroup.ps1 Changed internal call to private\Get-AzLabServicesLab_List1.
src/LabServices/.../UX/Microsoft.LabServices/labs.json Revised the “Publish-AzLabServicesLab” description text.
src/LabServices/.../README.md Updated AutoRest directives for deprecation, password handling, and command variants.
src/LabServices/.../AssemblyInfo.cs Added assembly metadata file with version and licensing.
Comments suppressed due to low confidence (2)

src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesLab_ListBySubscription.ps1:86

  • [nitpick] The helper function name Get-AzLabServicesLab_List is too generic and may confuse readers. Consider renaming it to reflect the context (e.g., Get-AzLabServicesLab_ListBySubscriptionPrivate) for clarity.
        return Az.LabServices.private\Get-AzLabServicesLab_List @PSBoundParameters

src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesLab_ListByResourceGroup.ps1:90

  • [nitpick] The numeric suffix in Get-AzLabServicesLab_List1 is unclear. A more descriptive name matching the cmdlet (e.g., Get-AzLabServicesLab_ListByResourceGroupPrivate) would improve maintainability.
        return Az.LabServices.private\Get-AzLabServicesLab_List1 @PSBoundParameters

.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.

Copy link

github-actions bot commented Jun 3, 2025

‼️ DO NOT MERGE THIS PR ‼️
This PR was labeled "Do Not Merge" because it contains code change that cannot be merged. Please contact the reviewer for more information.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the LabServices PowerShell module to use AutoRest v4 schemas and updated codegen artifacts.

  • Updated all cmdlet scripts to reference the general Microsoft.Azure.PowerShell.Cmdlets.LabServices.Models.* interfaces instead of the versioned Api20211001Preview types
  • Swapped internal invocation namespace to Az.LabServices.private and adjusted private helper names in list cmdlets
  • Refreshed Autorest directives in README.md and added a new AssemblyInfo.cs with metadata

Reviewed Changes

Copilot reviewed 141 out of 141 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesUserVM_Get.ps1 Updated .Outputs and OutputType to use Models.IVirtualMachine
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesTemplateVM_Lab.ps1 Updated .Outputs and OutputType to use Models.IVirtualMachine and reference Models.Lab
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesTemplateVM_Get.ps1 Updated .Outputs and OutputType to use Models.IVirtualMachine
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesSchedule_ResourceId.ps1 Updated .Outputs and OutputType to use Models.ISchedule
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesSchedule_Lab.ps1 Updated .Outputs and OutputType to use Models.ISchedule and reference Models.Lab
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesPlanImage_ResourceId.ps1 Updated .Outputs and OutputType to use Models.IImage
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesPlanImage_ListByDisplayName.ps1 Updated .Outputs and OutputType to use Models.IImage
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesPlanImage_LabPlan.ps1 Updated .Outputs and OutputType to use Models.IImage and reference Models.LabPlan
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesLabforVM.ps1 Updated .Outputs and OutputType to use Models.ILab
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesLab_ResourceId.ps1 Updated .Outputs and OutputType to use Models.ILab
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesLab_ListBySubscription.ps1 Updated .Outputs, OutputType, and switched to Az.LabServices.private\Get-AzLabServicesLab_List
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesLab_ListByResourceGroup.ps1 Updated .Outputs, OutputType, and switched to Az.LabServices.private\Get-AzLabServicesLab_List1
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesLab_ListByLabName.ps1 Updated .Outputs and OutputType to use Models.ILab
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesLab_LabPlan.ps1 Updated .Outputs and OutputType to use Models.ILab and reference Models.LabPlan
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesLabPlan_ResourceId.ps1 Updated .Outputs and OutputType to use Models.ILabPlan
src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesLabPlan_ListByLabPlanName.ps1 Updated .Outputs and OutputType to use Models.ILabPlan
src/LabServices/LabServices.Autorest/custom/Add-AzLabServicesUserQuota_User.ps1 Updated .Outputs and OutputType to use Models.IUser and reference Models.User
src/LabServices/LabServices.Autorest/custom/Add-AzLabServicesUserQuota_Email.ps1 Updated .Outputs and OutputType to use Models.IUser
src/LabServices/LabServices.Autorest/README.md Refreshed Autorest v4 directives, deprecation notices, transforms, and removed old extension block
src/LabServices/LabServices.Autorest/Properties/AssemblyInfo.cs Added new AssemblyInfo with license header and assembly metadata
Comments suppressed due to low confidence (2)

src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesSchedule_ResourceId.ps1:26

  • The function name Get-AzLabServicesSchedule_LabObject does not match the file name Get-AzLabServicesSchedule_ResourceId.ps1. Rename the function to Get-AzLabServicesSchedule_ResourceId for consistency.
function Get-AzLabServicesSchedule_LabObject {

src/LabServices/LabServices.Autorest/custom/Get-AzLabServicesLab_ListByResourceGroup.ps1:90

  • The helper invocation references Get-AzLabServicesLab_List1, which is an unexpected suffix. Verify and correct the function name (e.g., Get-AzLabServicesLab_ListByResourceGroup or a consistent private helper) to prevent runtime errors.
        return Az.LabServices.private\Get-AzLabServicesLab_List1 @PSBoundParameters

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants