Skip to content

Commit e5b6752

Browse files
Refresh autorest-selected modules Purview (#24698)
* Refresh autorest-selected modules from generation to main * Skip static analysis for example issues --------- Co-authored-by: Vincent Dai <[email protected]>
1 parent 6dd1ad5 commit e5b6752

File tree

2,509 files changed

+30239
-19875
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,509 files changed

+30239
-19875
lines changed
Lines changed: 21 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,24 @@
1-
#
2-
# Module manifest for module 'Az.Purview'
3-
#
4-
# Generated by: Microsoft Corporation
5-
#
6-
# Generated on: 8/18/2021
7-
#
8-
91
@{
10-
11-
# Script module or binary module file associated with this manifest.
12-
RootModule = './Az.Purview.psm1'
13-
14-
# Version number of this module.
15-
ModuleVersion = '0.1.0'
16-
17-
# Supported PSEditions
18-
CompatiblePSEditions = 'Core', 'Desktop'
19-
20-
# ID used to uniquely identify this module
21-
GUID = 'accceef6-8113-453a-a31c-4f2ce57893d6'
22-
23-
# Author of this module
24-
Author = 'Microsoft Corporation'
25-
26-
# Company or vendor of this module
27-
CompanyName = 'Microsoft Corporation'
28-
29-
# Copyright statement for this module
30-
Copyright = 'Microsoft Corporation. All rights reserved.'
31-
32-
# Description of the functionality provided by this module
33-
Description = 'Microsoft Azure PowerShell: Purview cmdlets'
34-
35-
# Minimum version of the PowerShell engine required by this module
36-
PowerShellVersion = '5.1'
37-
38-
# Name of the PowerShell host required by this module
39-
# PowerShellHostName = ''
40-
41-
# Minimum version of the PowerShell host required by this module
42-
# PowerShellHostVersion = ''
43-
44-
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
45-
DotNetFrameworkVersion = '4.7.2'
46-
47-
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
48-
# ClrVersion = ''
49-
50-
# Processor architecture (None, X86, Amd64) required by this module
51-
# ProcessorArchitecture = ''
52-
53-
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.7.4'; })
55-
56-
# Assemblies that must be loaded prior to importing this module
57-
RequiredAssemblies = './bin/Az.Purview.private.dll'
58-
59-
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
60-
# ScriptsToProcess = @()
61-
62-
# Type files (.ps1xml) to be loaded when importing this module
63-
# TypesToProcess = @()
64-
65-
# Format files (.ps1xml) to be loaded when importing this module
66-
FormatsToProcess = './Az.Purview.format.ps1xml'
67-
68-
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
69-
# NestedModules = @()
70-
71-
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
72-
FunctionsToExport = 'Add-AzPurviewAccountRootCollectionAdmin', 'Get-AzPurviewAccount',
73-
'Get-AzPurviewAccountKey', 'Get-AzPurviewDefaultAccount',
74-
'New-AzPurviewAccount', 'Remove-AzPurviewAccount',
75-
'Remove-AzPurviewDefaultAccount', 'Set-AzPurviewDefaultAccount',
76-
'Test-AzPurviewAccountNameAvailability', 'Update-AzPurviewAccount'
77-
78-
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
79-
CmdletsToExport = @()
80-
81-
# Variables to export from this module
82-
# VariablesToExport = @()
83-
84-
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
85-
AliasesToExport = '*'
86-
87-
# DSC resources to export from this module
88-
# DscResourcesToExport = @()
89-
90-
# List of all modules packaged with this module
91-
# ModuleList = @()
92-
93-
# List of all files packaged with this module
94-
# FileList = @()
95-
96-
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
97-
PrivateData = @{
98-
2+
GUID = 'accceef6-8113-453a-a31c-4f2ce57893d6'
3+
RootModule = './Az.Purview.psm1'
4+
ModuleVersion = '0.1.0'
5+
CompatiblePSEditions = 'Core', 'Desktop'
6+
Author = 'Microsoft Corporation'
7+
CompanyName = 'Microsoft Corporation'
8+
Copyright = 'Microsoft Corporation. All rights reserved.'
9+
Description = 'Microsoft Azure PowerShell: Purview cmdlets'
10+
PowerShellVersion = '5.1'
11+
DotNetFrameworkVersion = '4.7.2'
12+
RequiredAssemblies = './bin/Az.Purview.private.dll'
13+
FormatsToProcess = './Az.Purview.format.ps1xml'
14+
FunctionsToExport = 'Add-AzPurviewAccountRootCollectionAdmin', 'Get-AzPurviewAccount', 'Get-AzPurviewAccountKey', 'Get-AzPurviewDefaultAccount', 'New-AzPurviewAccount', 'Remove-AzPurviewAccount', 'Remove-AzPurviewDefaultAccount', 'Set-AzPurviewDefaultAccount', 'Test-AzPurviewAccountNameAvailability', 'Update-AzPurviewAccount', '*'
15+
AliasesToExport = '*'
16+
PrivateData = @{
9917
PSData = @{
100-
101-
# Tags applied to this module. These help with module discovery in online galleries.
102-
Tags = 'Azure','ResourceManager','ARM','PSModule','Purview'
103-
104-
# A URL to the license for this module.
105-
LicenseUri = 'https://aka.ms/azps-license'
106-
107-
# A URL to the main website for this project.
108-
ProjectUri = 'https://github.com/Azure/azure-powershell'
109-
110-
# A URL to an icon representing this module.
111-
# IconUri = ''
112-
113-
# ReleaseNotes of this module
114-
# ReleaseNotes = ''
115-
116-
# Prerelease string of this module
117-
# Prerelease = ''
118-
119-
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
120-
# RequireLicenseAcceptance = $false
121-
122-
# External dependent modules of this module
123-
# ExternalModuleDependencies = @()
124-
125-
} # End of PSData hashtable
126-
127-
} # End of PrivateData hashtable
128-
129-
# HelpInfo URI of this module
130-
# HelpInfoURI = ''
131-
132-
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
133-
# DefaultCommandPrefix = ''
134-
18+
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Purview'
19+
LicenseUri = 'https://aka.ms/azps-license'
20+
ProjectUri = 'https://github.com/Azure/azure-powershell'
21+
ReleaseNotes = ''
22+
}
23+
}
13524
}
136-

src/Purview/Purview.Autorest/Az.Purview.psm1

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@
2525
}
2626
}
2727
if(-not $accountsModule) {
28-
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.2.3' } | Measure-Object).Count -gt 0
28+
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.7.5' } | Measure-Object).Count -gt 0
2929
if($hasAdequateVersion) {
30-
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.2.3 -Scope Global -PassThru
30+
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.7.5 -Scope Global -PassThru
3131
}
3232
}
3333
}
3434

3535
if(-not $accountsModule) {
36-
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
37-
} elseif (($accountsModule.Version -lt [System.Version]'2.2.3') -and (-not $localAccounts)) {
38-
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
36+
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
37+
} elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) {
38+
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
3939
}
4040
Write-Information "Loaded Module '$($accountsModule.Name)'"
4141

@@ -47,33 +47,41 @@
4747

4848
# Ask for the shared functionality table
4949
$VTable = Register-AzModule
50-
50+
5151
# Tweaks the pipeline on module load
5252
$instance.OnModuleLoad = $VTable.OnModuleLoad
53-
53+
54+
# Following two delegates are added for telemetry
55+
$instance.GetTelemetryId = $VTable.GetTelemetryId
56+
$instance.Telemetry = $VTable.Telemetry
57+
58+
# Delegate to sanitize the output object
59+
$instance.SanitizeOutput = $VTable.SanitizerHandler
60+
61+
# Delegate to get the telemetry info
62+
$instance.GetTelemetryInfo = $VTable.GetTelemetryInfo
5463

5564
# Tweaks the pipeline per call
5665
$instance.OnNewRequest = $VTable.OnNewRequest
57-
66+
5867
# Gets shared parameter values
5968
$instance.GetParameterValue = $VTable.GetParameterValue
60-
69+
6170
# Allows shared module to listen to events from this module
6271
$instance.EventListener = $VTable.EventListener
63-
72+
6473
# Gets shared argument completers
6574
$instance.ArgumentCompleter = $VTable.ArgumentCompleter
66-
75+
6776
# The name of the currently selected Azure profile
6877
$instance.ProfileName = $VTable.ProfileName
6978

70-
7179
# Load the custom module
7280
$customModulePath = Join-Path $PSScriptRoot './custom/Az.Purview.custom.psm1'
7381
if(Test-Path $customModulePath) {
7482
$null = Import-Module -Name $customModulePath
7583
}
76-
84+
7785
# Export nothing to clear implicit exports
7886
Export-ModuleMember
7987

@@ -93,12 +101,12 @@
93101
# Load the last folder if no profile is selected
94102
$profileDirectory = $directories | Select-Object -Last 1
95103
}
96-
104+
97105
if($profileDirectory) {
98106
Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'"
99107
$exportsPath = $profileDirectory.FullName
100108
}
101-
109+
102110
if($exportsPath) {
103111
Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
104112
$cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath

src/Purview/Purview.Autorest/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
This directory contains the PowerShell module for the Purview service.
44

55
---
6-
76
## Info
87
- Modifiable: yes
98
- Generated: all
@@ -15,7 +14,7 @@ This directory contains the PowerShell module for the Purview service.
1514
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.
1615

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

2019
## Authentication
2120
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
@@ -28,7 +27,7 @@ For information on how to develop for `Az.Purview`, see [how-to.md](how-to.md).
2827
> see https://aka.ms/autorest
2928
3029
``` yaml
31-
branch: ebe90b1dfef9ec9706dee06e84676a6c6979ab53
30+
commit: ebe90b1dfef9ec9706dee06e84676a6c6979ab53
3231
require:
3332
- $(this-folder)/../../readme.azure.noprofile.md
3433
# lock the commit
@@ -42,6 +41,10 @@ identity-correction-for-post: true
4241
nested-object-to-string: true
4342
resourcegroup-append: true
4443

44+
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
45+
use-extension:
46+
"@autorest/powershell": "3.x"
47+
4548
directive:
4649
# Following is two common directive which are normally required in all the RPs
4750
# 1. Remove the unexpanded parameter set

src/Purview/Purview.Autorest/build-module.ps1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ $null = New-Item -ItemType Directory -Force -Path $examplesFolder
123123

124124
Write-Host -ForegroundColor Green 'Creating cmdlets for specified models...'
125125
$modelCmdlets = @()
126+
$modelCmdletFolder = Join-Path (Join-Path $PSScriptRoot './custom') 'autogen-model-cmdlets'
127+
if (Test-Path $modelCmdletFolder) {
128+
$null = Remove-Item -Force -Recurse -Path $modelCmdletFolder
129+
}
126130
if ($modelCmdlets.Count -gt 0) {
127131
. (Join-Path $PSScriptRoot 'create-model-cmdlets.ps1')
128132
CreateModelCmdlet($modelCmdlets)
@@ -139,7 +143,8 @@ if($NoDocs) {
139143
$null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
140144
}
141145
$null = New-Item -ItemType Directory -Force -Path $docsFolder
142-
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid
146+
$addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true')
147+
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid -AddComplexInterfaceInfo:$addComplexInterfaceInfo
143148
}
144149

145150
Write-Host -ForegroundColor Green 'Creating format.ps1xml...'
@@ -158,4 +163,10 @@ Export-TestStub -ModuleName $moduleName -ExportsFolder $exportsFolder -OutputFol
158163
Write-Host -ForegroundColor Green 'Creating example stubs...'
159164
Export-ExampleStub -ExportsFolder $exportsFolder -OutputFolder $examplesFolder
160165

166+
if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1'))
167+
{
168+
Write-Host -ForegroundColor Green 'Creating ux metadata...'
169+
. (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')
170+
}
171+
161172
Write-Host -ForegroundColor Green '-------------Done-------------'

src/Purview/Purview.Autorest/check-dependencies.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if(-not $Isolated) {
2525
function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum, [string]$requiredVersion) {
2626
if($predicate) {
2727
$module = Get-Module -ListAvailable -Name $moduleName
28-
if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0)) {
28+
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)) {
2929
$null = New-Item -ItemType Directory -Force -Path $path
3030
Write-Host -ForegroundColor Green "Installing local $moduleName module into '$path'..."
3131
if ($requiredVersion) {
@@ -47,7 +47,7 @@ if(Test-Path -Path $localModulesPath) {
4747
$env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath"
4848
}
4949

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

5353
$tools = Join-Path $PSScriptRoot 'tools'

src/Purview/Purview.Autorest/create-model-cmdlets.ps1

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ function CreateModelCmdlet {
2323
}
2424

2525
$ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models'
26-
$ModuleName = 'Purview'
2726
$OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets'
2827
$null = New-Item -ItemType Directory -Force -Path $OutputDir
28+
if (''.length -gt 0) {
29+
$ModuleName = ''
30+
} else {
31+
$ModuleName = 'Az.Purview'
32+
}
2933

3034
$CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs
3135
$Content = ''
@@ -64,10 +68,10 @@ function CreateModelCmdlet {
6468
$ObjectType = $Model
6569
$ObjectTypeWithNamespace = "${Namespace}.${ObjectType}"
6670
# remove duplicated module name
67-
if ($ObjectType.StartsWith($ModuleName)) {
71+
if ($ObjectType.StartsWith('Purview')) {
6872
$ModulePrefix = ''
6973
} else {
70-
$ModulePrefix = $ModuleName
74+
$ModulePrefix = 'Purview'
7175
}
7276
$OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir
7377

@@ -115,7 +119,9 @@ function CreateModelCmdlet {
115119
# check whether completer is needed
116120
$completer = '';
117121
if($Type.Split('.').Split('.')[-2] -eq 'Support') {
118-
$completer += "`n [ArgumentCompleter([${Type}])]"
122+
# If Type is an array, need to strip []
123+
$strippedType = $Type.Replace('[]', '')
124+
$completer += "`n [ArgumentCompleter([${strippedType}])]"
119125
}
120126
$ParameterDefineScript = "
121127
[Parameter($ParameterDefineProperty)]${completer}
@@ -156,7 +162,7 @@ Create an in-memory object for ${ObjectType}.
156162
.Outputs
157163
${ObjectTypeWithNamespace}
158164
.Link
159-
https://learn.microsoft.com/powershell/module/az.${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
165+
https://learn.microsoft.com/powershell/module/${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
160166
#>
161167
function New-Az${ModulePrefix}${ObjectType}Object {
162168
[OutputType('${ObjectTypeWithNamespace}')]

src/Purview/Purview.Autorest/examples/Test-AzPurviewAccountNameAvailability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Test-AzPurviewAccountNameAvailability -Name test-pa -Type Tenant
66
```output
77
Message NameAvailable Reason
88
------- ------------- ------
9-
The name test-pa is invalid, please use another name. False Invalid
9+
The name test-pa is invalid, please use another name. False Invalid
1010
```
1111

1212
Check if account name 'test-pa' is available.

src/Purview/Purview.Autorest/examples/Update-AzPurviewAccount.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Example 1: Update a purview account
22
```powershell
3-
Update-AzPurviewAccount -Name test-pa -ResourceGroupName test-rg -Tag @{"k"="v"} | fl
3+
Update-AzPurviewAccount -Name test-pa -ResourceGroupName test-rg -Tag @{"k"="v"} | Format-List
44
```
55

66
```output

0 commit comments

Comments
 (0)