Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
836 changes: 542 additions & 294 deletions src/Compute/Compute.Autorest/Az.Compute.format.ps1xml

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions src/Compute/Compute.Autorest/Az.Compute.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@
}
}
if(-not $accountsModule) {
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.2.3' } | Measure-Object).Count -gt 0
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.7.5' } | Measure-Object).Count -gt 0
if($hasAdequateVersion) {
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.2.3 -Scope Global -PassThru
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.7.5 -Scope Global -PassThru
}
}
}

if(-not $accountsModule) {
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. For installation instructions, please see: https://docs.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
} elseif (($accountsModule.Version -lt [System.Version]'2.2.3') -and (-not $localAccounts)) {
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://docs.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
} elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) {
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
}
Write-Information "Loaded Module '$($accountsModule.Name)'"

Expand All @@ -50,6 +50,10 @@

# Tweaks the pipeline on module load
$instance.OnModuleLoad = $VTable.OnModuleLoad

# Following two delegates are added for telemetry
$instance.GetTelemetryId = $VTable.GetTelemetryId
$instance.Telemetry = $VTable.Telemetry


# Tweaks the pipeline per call
Expand Down
28 changes: 28 additions & 0 deletions src/Compute/Compute.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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.
// ----------------------------------------------------------------------------------

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

[assembly: AssemblyTitle("Microsoft Azure Powershell - Compute")]
[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]

[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: Guid("05e53bbe-85c7-4f90-b796-25b4d044090b")]
[assembly: AssemblyVersion("0.1.0")]
[assembly: AssemblyFileVersion("0.1.0")]
22 changes: 17 additions & 5 deletions src/Compute/Compute.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This directory contains the PowerShell module for the Compute service.
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.

## Module Requirements
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.2.3 or greater
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater

## Authentication
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
Expand All @@ -29,16 +29,16 @@ For information on how to develop for `Az.Compute`, see [how-to.md](how-to.md).
### AutoRest Configuration
> see https://aka.ms/autorest
``` yaml
branch: 0c887b0c35f6f19468a16e660bba2a9eb5f4a330
branch: 4640dfc655f8641962814663fd03fd667e5c1a88
require:
# readme.azure.noprofile.md is the common configuration file
- $(this-folder)/../../readme.azure.noprofile.md
input-file:
# You need to specify your swagger files here.
- $(repo)/specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/gallery.json
- $(repo)/specification/compute/resource-manager/Microsoft.Compute/stable/2022-01-03/GalleryRP/gallery.json
- $(repo)/specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/runCommands.json
# If the swagger has not been put in the repo, you may uncomment the following line and refer to it locally
module-version: 0.1.0
module-version: 0.2.0
# Normally, title is the service name
title: Compute
subject-prefix: ""
Expand Down Expand Up @@ -149,6 +149,18 @@ directive:
parameter-name: PublishingProfileTargetRegion
set:
parameter-name: TargetRegion
- where:
verb: New|Update
subject: GalleryApplicationVersion
parameter-name: SettingConfigFileName
set:
parameter-name: ConfigFileName
- where:
verb: New|Update
subject: GalleryApplicationVersion
parameter-name: SettingPackageFileName
set:
parameter-name: PackageFileName
### END # change parameter names for GalleryApplicationVersion
# hide parameters for New, Update Gallery Application
- where:
Expand All @@ -166,7 +178,7 @@ directive:
- where:
verb: Update|New
subject: GalleryApplicationVersion$
parameter-name: PublishingProfileEnableHealthCheck|PublishingProfileStorageAccountType|PublishingProfileReplicationMode
parameter-name: PublishingProfileEnableHealthCheck|PublishingProfileStorageAccountType|PublishingProfileReplicationMode|PublishingProfileTargetExtendedLocation|PublishingProfileAdvancedSetting
hide: true
- where:
verb: Update
Expand Down
4 changes: 2 additions & 2 deletions src/Compute/Compute.Autorest/check-dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if(-not $Isolated) {
function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum, [string]$requiredVersion) {
if($predicate) {
$module = Get-Module -ListAvailable -Name $moduleName
if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0)) {
if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0) -or ($requiredVersion -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -eq [System.Version]$requiredVersion } | Measure-Object).Count -eq 0)) {
$null = New-Item -ItemType Directory -Force -Path $path
Write-Host -ForegroundColor Green "Installing local $moduleName module into '$path'..."
if ($requiredVersion) {
Expand All @@ -47,7 +47,7 @@ if(Test-Path -Path $localModulesPath) {
$env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath"
}

DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.2.3'
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.7.5'
DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -requiredVersion '4.10.1'

$tools = Join-Path $PSScriptRoot 'tools'
Expand Down
21 changes: 15 additions & 6 deletions src/Compute/Compute.Autorest/create-model-cmdlets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function CreateModelCmdlet {
}

$ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models'
$ModuleName = 'Az.Compute'.Split(".")[1]
$ModuleName = ''
$OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets'
$null = New-Item -ItemType Directory -Force -Path $OutputDir

Expand Down Expand Up @@ -112,13 +112,22 @@ function CreateModelCmdlet {
$ParameterDefinePropertyList.Add("HelpMessage=`"${Description}.`"")
}
$ParameterDefineProperty = [System.String]::Join(", ", $ParameterDefinePropertyList)
# check whether completer is needed
$completer = '';
if($Type.Split('.').Split('.')[-2] -eq 'Support') {
# If Type is an array, need to strip []
$strippedType = $Type.Replace('[]', '')
$completer += "`n [ArgumentCompleter([${strippedType}])]"
}
$ParameterDefineScript = "
[Parameter($ParameterDefineProperty)]
[Parameter($ParameterDefineProperty)]${completer}
[${Type}]
`$${Identifier}"
$ParameterDefineScriptList.Add($ParameterDefineScript)
$ParameterAssignScriptList.Add("
`$Object.${Identifier} = `$${Identifier}")
if (`$PSBoundParameters.ContainsKey('${Identifier}')) {
`$Object.${Identifier} = `$${Identifier}
}")
}
}
$ParameterDefineScript = $ParameterDefineScriptList | Join-String -Separator ","
Expand All @@ -142,9 +151,9 @@ function CreateModelCmdlet {

<#
.Synopsis
Create a in-memory object for ${ObjectType}
Create an in-memory object for ${ObjectType}.
.Description
Create a in-memory object for ${ObjectType}
Create an in-memory object for ${ObjectType}.

.Outputs
${ObjectTypeWithNamespace}
Expand All @@ -167,4 +176,4 @@ ${ParameterAssignScript}
"
Set-Content -Path $OutputPath -Value $Script
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Create or update a gallery Application Definition.
#>

function New-AzGalleryApplication {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IGalleryApplication])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20220103.IGalleryApplication])]
[CmdletBinding(PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
param(
[Parameter(Mandatory)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Create or update a gallery Application Version.
Create or update a gallery Application Version.
#>
function New-AzGalleryApplicationVersion {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IGalleryApplicationVersion])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20220103.IGalleryApplicationVersion])]
[CmdletBinding(DefaultParameterSetName = 'CreateExpanded', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
param(
[Parameter(Mandatory)]
Expand Down Expand Up @@ -120,7 +120,7 @@ function New-AzGalleryApplicationVersion {
[Parameter()]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.ITargetRegion[]]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20220103.ITargetRegion[]]
# The target regions where the Image Version is going to be replicated to.
# This property is updatable.
# To construct, see NOTES section for TARGETREGION properties and create a hash table.
Expand Down Expand Up @@ -192,7 +192,25 @@ function New-AzGalleryApplicationVersion {
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Use the default credentials for the proxy
${ProxyUseDefaultCredentials}
${ProxyUseDefaultCredentials},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Body')]
[System.String]
# Optional.
# The name to assign the downloaded package file on the VM.
# This is limited to 4096 characters.
# If not specified, the package file will be named the same as the Gallery Application name.
${PackageFileName},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Body')]
[System.String]
# Optional.
# The name to assign the downloaded config file on the VM.
# This is limited to 4096 characters.
# If not specified, the config file will be named the Gallery Application name appended with "_config".
${ConfigFileName}
)
process {
Az.Compute.internal\New-AzGalleryApplicationVersion @PSBoundParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Update a gallery Application Version.
#>

function Update-AzGalleryApplicationVersion {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IGalleryApplicationVersion])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20220103.IGalleryApplicationVersion])]
[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(ParameterSetName='UpdateExpanded', Mandatory)]
Expand Down Expand Up @@ -98,15 +98,15 @@ function Update-AzGalleryApplicationVersion {

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IUpdateResourceDefinitionTags]))]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20220103.IUpdateResourceDefinitionTags]))]
[System.Collections.Hashtable]
# Resource tags
${Tag},

[Parameter()]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.ITargetRegion[]]
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20220103.ITargetRegion[]]
# The target regions where the Image Version is going to be replicated to.
# This property is updatable.
# To construct, see NOTES section for TARGETREGION properties and create a hash table.
Expand Down
10 changes: 4 additions & 6 deletions src/Compute/Compute.Autorest/docs/Get-AzGalleryApplication.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,14 @@ Retrieves information about a gallery Application Definition.

### Example 1: Get a Gallery Application in a Gallery
```powershell
PS C:\> Get-AzGalleryApplication -ResourceGroupName $rgName -GalleryName $galleryName -name $galleryAppName

Get-AzGalleryApplication -ResourceGroupName $rgName -GalleryName $galleryName -name $galleryAppName
```

Retrieve a Gallery Application resource with the provided Resource Group, Gallery, and Gallery Application name.

### Example 2: Get all the Gallery Applications in a Gallery
```powershell
PS C:\> Get-AzGalleryApplication -GalleryName $GalleryName -ResourceGroupName $rgName

Get-AzGalleryApplication -GalleryName $GalleryName -ResourceGroupName $rgName
```

Retrieve all the Gallery Application resources in the provided Resource Group and Gallery.
Expand Down Expand Up @@ -153,7 +151,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IGalleryApplication
### Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20220103.IGalleryApplication

## NOTES

Expand All @@ -164,7 +162,7 @@ COMPLEX PARAMETER PROPERTIES
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.


INPUTOBJECT <IComputeIdentity>: Identity Parameter
`INPUTOBJECT <IComputeIdentity>`: Identity Parameter
- `[CommandId <String>]`: The command id.
- `[GalleryApplicationName <String>]`: The name of the gallery Application Definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters.
- `[GalleryApplicationVersionName <String>]`: The name of the gallery Application Version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@ Retrieves information about a gallery Application Version.

### Example 1: Get a Gallery Application Version
```powershell
PS C:\> Get-AzGalleryApplicationVersion -ResourceGroupName $rgName -GalleryName $galleryName -GalleryApplicationName $galleryAppName -Name $versionName

Get-AzGalleryApplicationVersion -ResourceGroupName $rgName -GalleryName $galleryName -GalleryApplicationName $galleryAppName -Name $versionName
```

Retrieve a Gallery Application Version resource with the provided Resource Group, Gallery, Gallery Application name, and version name.

### Example 2: Get all the Gallery Application Versions in a GalleryApplication
```powershell
PS C:\> Get-AzGalleryApplicationVersion -GalleryName $GalleryName -ResourceGroupName $rgName -GalleryApplicationName $galleryAppName

Get-AzGalleryApplicationVersion -GalleryName $GalleryName -ResourceGroupName $rgName -GalleryApplicationName $galleryAppName
```

Retrieve all the Gallery Application Version resources in the provided Resource Group, Gallery, and Gallery Application Name.
Expand Down Expand Up @@ -185,7 +183,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IGalleryApplicationVersion
### Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20220103.IGalleryApplicationVersion

## NOTES

Expand All @@ -196,7 +194,7 @@ COMPLEX PARAMETER PROPERTIES
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.


INPUTOBJECT <IComputeIdentity>: Identity Parameter
`INPUTOBJECT <IComputeIdentity>`: Identity Parameter
- `[CommandId <String>]`: The command id.
- `[GalleryApplicationName <String>]`: The name of the gallery Application Definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters.
- `[GalleryApplicationVersionName <String>]`: The name of the gallery Application Version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>
Expand Down
Loading