Skip to content
Open
13 changes: 4 additions & 9 deletions src/Compute/Compute.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,15 @@ module-version: 0.3.0
title: Compute
subject-prefix: ""

# If there are post APIs for some kinds of actions in the RP, you may need to
# uncomment following line to support viaIdentity for these post APIs
# identity-correction-for-post: true

# 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:
# Following is two common directive which are normally required in all the RPs
# 1. Remove the unexpanded parameter set
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
- where:
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
Copy link

Copilot AI Aug 22, 2025

Choose a reason for hiding this comment

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

[nitpick] The regex pattern uses a negative lookahead which may be difficult to understand and maintain. Consider documenting this pattern or using a more explicit approach to specify which variants should be removed.

Copilot uses AI. Check for mistakes.
remove: true
- where:
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$
remove: true
# Remove following verbs
- select: command
Expand Down

This file was deleted.

69 changes: 49 additions & 20 deletions src/Compute/Compute.Autorest/custom/New-AzGalleryApplication.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ Create or update a gallery Application Definition.
#>

function New-AzGalleryApplication {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20220103.IGalleryApplication])]
[CmdletBinding(PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.IGalleryApplication])]
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(Mandatory)]
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
[Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)]
[Parameter(ParameterSetName='CreateViaJsonString', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Path')]
[System.String]
# The name of the Shared Application Gallery in which the Application Definition is to be created.
Expand All @@ -32,60 +34,87 @@ function New-AzGalleryApplication {
# The maximum length is 80 characters.
${Name},

[Parameter(Mandatory)]
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
[Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)]
[Parameter(ParameterSetName='CreateViaJsonString', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Path')]
[System.String]
# The name of the resource group.
${ResourceGroupName},

[Parameter()]
[Parameter(ParameterSetName='CreateExpanded')]
[Parameter(ParameterSetName='CreateViaJsonFilePath')]
[Parameter(ParameterSetName='CreateViaJsonString')]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String]
# Subscription credentials which uniquely identify Microsoft Azure subscription.
# The subscription ID forms part of the URI for every service call.
${SubscriptionId},

[Parameter(Mandatory)]
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
[Parameter(ParameterSetName='CreateViaIdentityGalleryExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Body')]
[System.String]
# Resource location
${Location},

[Parameter(Mandatory)]
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Compute.Support.OperatingSystemTypes])]
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
[Parameter(ParameterSetName='CreateViaIdentityGalleryExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.PSArgumentCompleterAttribute("Windows", "Linux")]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Support.OperatingSystemTypes]
[System.String]
Copy link

Copilot AI Aug 22, 2025

Choose a reason for hiding this comment

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

The change from strongly-typed OperatingSystemTypes enum to string reduces type safety and removes IntelliSense support. The PSArgumentCompleter attribute helps but doesn't provide the same compile-time validation as the original enum type.

Copilot uses AI. Check for mistakes.
# This property allows you to specify the supported type of the OS that application is built for.
#
#
# Possible values are:
#
# **Windows**
#
#
#
# Possible values are:
#
# **Windows**
#
# **Linux**
${SupportedOSType},

[Parameter()]
[Parameter(ParameterSetName='CreateExpanded')]
[Parameter(ParameterSetName='CreateViaIdentityGalleryExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Body')]
[System.String]
# The description of this gallery Application Definition resource.
# This property is updatable.
${Description},

[Parameter()]
[Parameter(ParameterSetName='CreateExpanded')]
[Parameter(ParameterSetName='CreateViaIdentityGalleryExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Info(PossibleTypes = ([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api10.IResourceTags]))]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.IResourceTags]))]
[System.Collections.Hashtable]
# Resource tags
${Tag},

[Parameter(ParameterSetName='CreateViaIdentityGalleryExpanded', Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.IComputeIdentity]
# Identity Parameter
${GalleryInputObject},

[Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Body')]
[System.String]
# Path of Json file supplied to the Create operation
${JsonFilePath},

[Parameter(ParameterSetName='CreateViaJsonString', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Body')]
[System.String]
# Json string supplied to the Create operation
${JsonString},

[Parameter()]
[Alias('AzureRMContext', 'AzureCredential')]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Azure')]
[System.Management.Automation.PSObject]
# The credentials, account, tenant, and subscription used for communication with Azure.
# The DefaultProfile parameter is not functional.
# Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
${DefaultProfile},

[Parameter()]
Expand Down
Loading