@autorest/powershell 4.0.0-dev.7 → 4.0.0-dev.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/package-deps_build.json +58 -54
- package/autorest-configuration.md +1 -1
- package/dist/cmdlets/class.d.ts +7 -0
- package/dist/cmdlets/class.d.ts.map +1 -1
- package/dist/cmdlets/class.js +248 -81
- package/dist/cmdlets/class.js.map +1 -1
- package/dist/cmdlets/namespace.d.ts.map +1 -1
- package/dist/cmdlets/namespace.js +1 -0
- package/dist/cmdlets/namespace.js.map +1 -1
- package/dist/generators/psm1.js +1 -1
- package/dist/generators/script-cmdlet.js +1 -1
- package/dist/internal/powershell-declarations.d.ts +1 -0
- package/dist/internal/powershell-declarations.d.ts.map +1 -1
- package/dist/internal/powershell-declarations.js +2 -1
- package/dist/internal/powershell-declarations.js.map +1 -1
- package/dist/internal/project.d.ts +9 -4
- package/dist/internal/project.d.ts.map +1 -1
- package/dist/internal/project.js +7 -9
- package/dist/internal/project.js.map +1 -1
- package/dist/llcsharp/clientruntime.d.ts +1 -0
- package/dist/llcsharp/clientruntime.d.ts.map +1 -1
- package/dist/llcsharp/clientruntime.js +1 -0
- package/dist/llcsharp/clientruntime.js.map +1 -1
- package/dist/llcsharp/csharp-declarations.d.ts +1 -0
- package/dist/llcsharp/csharp-declarations.d.ts.map +1 -1
- package/dist/llcsharp/csharp-declarations.js +2 -1
- package/dist/llcsharp/csharp-declarations.js.map +1 -1
- package/dist/llcsharp/model/interface.d.ts.map +1 -1
- package/dist/llcsharp/model/interface.js +14 -0
- package/dist/llcsharp/model/interface.js.map +1 -1
- package/dist/llcsharp/model/model-class.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class.js +27 -11
- package/dist/llcsharp/model/model-class.js.map +1 -1
- package/dist/llcsharp/model/namespace.d.ts.map +1 -1
- package/dist/llcsharp/model/namespace.js +3 -11
- package/dist/llcsharp/model/namespace.js.map +1 -1
- package/dist/llcsharp/project.d.ts +2 -1
- package/dist/llcsharp/project.d.ts.map +1 -1
- package/dist/llcsharp/project.js +5 -3
- package/dist/llcsharp/project.js.map +1 -1
- package/dist/llcsharp/schema/array.js +7 -7
- package/dist/llcsharp/schema/array.js.map +1 -1
- package/dist/llcsharp/schema/fixed-array.d.ts +42 -0
- package/dist/llcsharp/schema/fixed-array.d.ts.map +1 -0
- package/dist/llcsharp/schema/fixed-array.js +251 -0
- package/dist/llcsharp/schema/fixed-array.js.map +1 -0
- package/dist/llcsharp/schema/schema-resolver.d.ts +1 -1
- package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.js +12 -10
- package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
- package/dist/plugins/create-commands-v2.d.ts +1 -0
- package/dist/plugins/create-commands-v2.d.ts.map +1 -1
- package/dist/plugins/create-commands-v2.js +39 -6
- package/dist/plugins/create-commands-v2.js.map +1 -1
- package/dist/plugins/cs-namer-v2.d.ts.map +1 -1
- package/dist/plugins/cs-namer-v2.js +10 -7
- package/dist/plugins/cs-namer-v2.js.map +1 -1
- package/dist/plugins/llcsharp-v2.d.ts.map +1 -1
- package/dist/plugins/llcsharp-v2.js +4 -1
- package/dist/plugins/llcsharp-v2.js.map +1 -1
- package/dist/plugins/modifiers-v2.d.ts.map +1 -1
- package/dist/plugins/modifiers-v2.js +21 -2
- package/dist/plugins/modifiers-v2.js.map +1 -1
- package/dist/plugins/plugin-tweak-m4-model.d.ts.map +1 -1
- package/dist/plugins/plugin-tweak-m4-model.js +12 -0
- package/dist/plugins/plugin-tweak-m4-model.js.map +1 -1
- package/dist/plugins/sdk-create-inline-properties.d.ts.map +1 -1
- package/dist/plugins/sdk-create-inline-properties.js +26 -0
- package/dist/plugins/sdk-create-inline-properties.js.map +1 -1
- package/dist/plugins/sdk-cs-namer.d.ts.map +1 -1
- package/dist/plugins/sdk-cs-namer.js +17 -9
- package/dist/plugins/sdk-cs-namer.js.map +1 -1
- package/dist/plugins/sdk-tweak-model.d.ts.map +1 -1
- package/dist/plugins/sdk-tweak-model.js +13 -5
- package/dist/plugins/sdk-tweak-model.js.map +1 -1
- package/dist/utils/resourceName.d.ts +3 -0
- package/dist/utils/resourceName.d.ts.map +1 -0
- package/dist/utils/resourceName.js +29 -0
- package/dist/utils/resourceName.js.map +1 -0
- package/dist/utils/sort-parameters.d.ts +3 -0
- package/dist/utils/sort-parameters.d.ts.map +1 -0
- package/dist/utils/sort-parameters.js +33 -0
- package/dist/utils/sort-parameters.js.map +1 -0
- package/package.json +1 -1
- package/resources/assets/build-module.ps1 +4 -4
- package/resources/assets/check-dependencies.ps1 +3 -3
- package/resources/assets/create-model-cmdlets.ps1 +84 -15
- package/resources/assets/custom/README.md +1 -1
- package/resources/assets/docs/README.md +1 -1
- package/resources/assets/export-surface.ps1 +3 -3
- package/resources/assets/exports/README.md +1 -1
- package/resources/assets/generate-help.ps1 +3 -3
- package/resources/assets/generate-portal-ux.ps1 +3 -3
- package/resources/assets/how-to.md +1 -1
- package/resources/assets/internal/README.md +1 -1
- package/resources/assets/run-module.ps1 +4 -4
- package/resources/assets/test-module.ps1 +6 -6
- package/resources/assets/tools/Resources/custom/New-AzDeployment.ps1 +1 -1
- package/resources/assets/tools/Resources/docs/README.md +1 -1
- package/resources/assets/tools/Resources/how-to.md +1 -1
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.nuspec +1 -1
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 +1 -1
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml +34 -34
- package/resources/modules/Az.Accounts/2.7.5/en-US/about_az.help.txt +1 -1
- package/resources/modules/Az.Accounts/2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp +1 -1
- package/resources/psruntime/Attributes/PSArgumentCompleterAttribute.cs +52 -0
- package/resources/psruntime/BuildTime/Cmdlets/ExportFormatPs1xml.cs +3 -1
- package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +18 -1
- package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +15 -2
- package/resources/psruntime/BuildTime/PsAttributes.cs +5 -0
- package/resources/psruntime/BuildTime/PsExtensions.cs +7 -0
- package/resources/psruntime/TypeConverterExtensions.cs +50 -0
- package/resources/runtime/csharp/json/Nodes/Collections/XNodeArray.cs +5 -0
- package/resources/runtime/csharp/pipeline/ISendAsync.cs +113 -0
- package/resources/templates/methodBodyRestCall.ejs +1 -1
|
@@ -4,7 +4,7 @@ ${$project.pwshCommentHeader}
|
|
|
4
4
|
|
|
5
5
|
function CreateModelCmdlet {
|
|
6
6
|
|
|
7
|
-
param([
|
|
7
|
+
param([Hashtable[]]$Models)
|
|
8
8
|
|
|
9
9
|
if ($Models.Count -eq 0)
|
|
10
10
|
{
|
|
@@ -12,10 +12,13 @@ function CreateModelCmdlet {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
$ModelCsPath = Join-Path (Join-Path $PSScriptRoot '${$lib.path.relative($project.baseFolder, $project.apiFolder)}') 'Models'
|
|
15
|
-
$ModuleName = '${$project.subjectPrefix}'
|
|
16
15
|
$OutputDir = Join-Path $PSScriptRoot '${$lib.path.relative($project.baseFolder, $project.modelCmdletFolder)}'
|
|
17
16
|
$null = New-Item -ItemType Directory -Force -Path $OutputDir
|
|
18
|
-
|
|
17
|
+
if ('${$project.rootModuleName}'.length -gt 0) {
|
|
18
|
+
$ModuleName = '${$project.rootModuleName}'
|
|
19
|
+
} else {
|
|
20
|
+
$ModuleName = '${$project.moduleName}'
|
|
21
|
+
}
|
|
19
22
|
$CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs
|
|
20
23
|
$Content = ''
|
|
21
24
|
$null = $CsFiles | ForEach-Object -Process { if ($_.Name.Split('.').count -eq 2 )
|
|
@@ -24,15 +27,34 @@ function CreateModelCmdlet {
|
|
|
24
27
|
|
|
25
28
|
$Tree = [Microsoft.CodeAnalysis.CSharp.SyntaxFactory]::ParseCompilationUnit($Content)
|
|
26
29
|
$Nodes = $Tree.ChildNodes().ChildNodes()
|
|
30
|
+
$classConstantMember = @{}
|
|
27
31
|
foreach ($Model in $Models)
|
|
28
32
|
{
|
|
29
|
-
$
|
|
33
|
+
$ModelName = $Model.modelName
|
|
34
|
+
$InterfaceNode = $Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq "I$ModelName") }
|
|
35
|
+
$ClassNode = $Nodes | Where-Object { ($_.Keyword.value -eq 'class') -and ($_.Identifier.value -eq "$ModelName") }
|
|
36
|
+
$classConstantMember = @()
|
|
37
|
+
foreach ($class in $ClassNode) {
|
|
38
|
+
foreach ($member in $class.Members) {
|
|
39
|
+
$isConstant = $false
|
|
40
|
+
foreach ($attr in $member.AttributeLists) {
|
|
41
|
+
$memberName = $attr.Attributes.Name.ToString()
|
|
42
|
+
if ($memberName.EndsWith('.Constant')) {
|
|
43
|
+
$isConstant = $true
|
|
44
|
+
break
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (($member.Modifiers.ToString() -eq 'public') -and $isConstant) {
|
|
48
|
+
$classConstantMember += $member.Identifier.Value
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
30
52
|
if ($InterfaceNode.count -eq 0) {
|
|
31
53
|
continue
|
|
32
54
|
}
|
|
33
55
|
# through a queue, we iterate all the parent models.
|
|
34
56
|
$Queue = @($InterfaceNode)
|
|
35
|
-
$visited = @("I$
|
|
57
|
+
$visited = @("I$ModelName")
|
|
36
58
|
$AllInterfaceNodes = @()
|
|
37
59
|
while ($Queue.count -ne 0)
|
|
38
60
|
{
|
|
@@ -50,13 +72,13 @@ function CreateModelCmdlet {
|
|
|
50
72
|
}
|
|
51
73
|
|
|
52
74
|
$Namespace = $InterfaceNode.Parent.Name
|
|
53
|
-
$ObjectType = $
|
|
75
|
+
$ObjectType = $ModelName
|
|
54
76
|
$ObjectTypeWithNamespace = "${Namespace}.${ObjectType}"
|
|
55
77
|
# remove duplicated module name
|
|
56
|
-
if ($ObjectType.StartsWith($
|
|
78
|
+
if ($ObjectType.StartsWith('${$project.subjectPrefix}')) {
|
|
57
79
|
$ModulePrefix = ''
|
|
58
80
|
} else {
|
|
59
|
-
$ModulePrefix = $
|
|
81
|
+
$ModulePrefix = '${$project.subjectPrefix}'
|
|
60
82
|
}
|
|
61
83
|
$OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir
|
|
62
84
|
|
|
@@ -66,6 +88,10 @@ function CreateModelCmdlet {
|
|
|
66
88
|
{
|
|
67
89
|
foreach ($Member in $Node.Members)
|
|
68
90
|
{
|
|
91
|
+
if ($classConstantMember.Contains($Member.Identifier.Value)) {
|
|
92
|
+
# skip constant member
|
|
93
|
+
continue
|
|
94
|
+
}
|
|
69
95
|
$Arguments = $Member.AttributeLists.Attributes.ArgumentList.Arguments
|
|
70
96
|
$Required = $false
|
|
71
97
|
$Description = ""
|
|
@@ -104,6 +130,16 @@ function CreateModelCmdlet {
|
|
|
104
130
|
}
|
|
105
131
|
$Identifier = $Member.Identifier.Value
|
|
106
132
|
$Type = $Member.Type.ToString().replace('?', '').Split("::")[-1]
|
|
133
|
+
$Type = $Member.Type.ToString().replace('?', '').Split("::")[-1]
|
|
134
|
+
if ($Type.StartsWith("System.Collections.Generic.List"))
|
|
135
|
+
{
|
|
136
|
+
# if the type is a list, we need to convert it to array
|
|
137
|
+
$matched = $Type -match '\<(?<Name>.+)\>$'
|
|
138
|
+
if ($matched)
|
|
139
|
+
{
|
|
140
|
+
$Type = $matches.Name + '[]';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
107
143
|
$ParameterDefinePropertyList = New-Object System.Collections.Generic.List[string]
|
|
108
144
|
if ($Required -and $mutability.Create -and $mutability.Update)
|
|
109
145
|
{
|
|
@@ -115,11 +151,9 @@ function CreateModelCmdlet {
|
|
|
115
151
|
}
|
|
116
152
|
$ParameterDefineProperty = [System.String]::Join(", ", $ParameterDefinePropertyList)
|
|
117
153
|
# check whether completer is needed
|
|
118
|
-
$completer = '';
|
|
119
|
-
if($
|
|
120
|
-
|
|
121
|
-
$strippedType = $Type.Replace('[]', '')
|
|
122
|
-
$completer += "`n [ArgumentCompleter([${strippedType}])]"
|
|
154
|
+
$completer = '';
|
|
155
|
+
if(IsEnumType($Member)){
|
|
156
|
+
$completer += GetCompleter($Member)
|
|
123
157
|
}
|
|
124
158
|
$ParameterDefineScript = "
|
|
125
159
|
[Parameter($ParameterDefineProperty)]${completer}
|
|
@@ -135,6 +169,11 @@ function CreateModelCmdlet {
|
|
|
135
169
|
$ParameterDefineScript = $ParameterDefineScriptList | Join-String -Separator ","
|
|
136
170
|
$ParameterAssignScript = $ParameterAssignScriptList | Join-String -Separator ""
|
|
137
171
|
|
|
172
|
+
$cmdletName = "New-Az${ModulePrefix}${ObjectType}Object"
|
|
173
|
+
if ('' -ne $Model.cmdletName) {
|
|
174
|
+
$cmdletName = $Model.cmdletName
|
|
175
|
+
}
|
|
176
|
+
$cmdletNameInLowerCase = $cmdletName.ToLower()
|
|
138
177
|
$Script = "
|
|
139
178
|
# ----------------------------------------------------------------------------------
|
|
140
179
|
${$project.pwshCommentHeaderForCsharp}
|
|
@@ -149,9 +188,9 @@ Create an in-memory object for ${ObjectType}.
|
|
|
149
188
|
.Outputs
|
|
150
189
|
${ObjectTypeWithNamespace}
|
|
151
190
|
.Link
|
|
152
|
-
${$project.helpLinkPrefix}
|
|
191
|
+
${$project.helpLinkPrefix}${ModuleName}/${cmdletNameInLowerCase}
|
|
153
192
|
#>
|
|
154
|
-
function
|
|
193
|
+
function ${cmdletName} {
|
|
155
194
|
[OutputType('${ObjectTypeWithNamespace}')]
|
|
156
195
|
[CmdletBinding(PositionalBinding=`$false)]
|
|
157
196
|
Param(
|
|
@@ -168,3 +207,33 @@ ${ParameterAssignScript}
|
|
|
168
207
|
Set-Content -Path $OutputPath -Value $Script
|
|
169
208
|
}
|
|
170
209
|
}
|
|
210
|
+
|
|
211
|
+
function IsEnumType {
|
|
212
|
+
param (
|
|
213
|
+
[Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax]$property
|
|
214
|
+
)
|
|
215
|
+
$isEnum = $false
|
|
216
|
+
foreach ($attr in $property.AttributeLists) {
|
|
217
|
+
$attributeName = $attr.Attributes.Name.ToString()
|
|
218
|
+
if ($attributeName.Contains('ArgumentCompleter')) {
|
|
219
|
+
$isEnum = $true
|
|
220
|
+
break
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return $isEnum;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function GetCompleter {
|
|
227
|
+
param (
|
|
228
|
+
[Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax]$property
|
|
229
|
+
)
|
|
230
|
+
foreach ($attr in $property.AttributeLists) {
|
|
231
|
+
$attributeName = $attr.Attributes.Name.ToString()
|
|
232
|
+
if ($attributeName.Contains('ArgumentCompleter')) {
|
|
233
|
+
$attributeName = $attributeName.Split("::")[-1]
|
|
234
|
+
$possibleValues = [System.String]::Join(", ", $attr.Attributes.ArgumentList.Arguments)
|
|
235
|
+
$completer += "`n [${attributeName}(${possibleValues})]"
|
|
236
|
+
return $completer
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
@@ -32,7 +32,7 @@ These provide functionality to our HTTP pipeline and other useful features. In s
|
|
|
32
32
|
### Attributes
|
|
33
33
|
For processing the cmdlets, we've created some additional attributes:
|
|
34
34
|
- `${$project.serviceNamespace.fullName}.DescriptionAttribute`
|
|
35
|
-
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://
|
|
35
|
+
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
|
|
36
36
|
- `${$project.serviceNamespace.fullName}.DoNotExportAttribute`
|
|
37
37
|
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `${$project.moduleName}`.
|
|
38
38
|
- `${$project.serviceNamespace.fullName}.InternalExportAttribute`
|
|
@@ -8,4 +8,4 @@ This directory contains the documentation of the cmdlets for the `${$project.mod
|
|
|
8
8
|
- Packaged: yes
|
|
9
9
|
|
|
10
10
|
## Details
|
|
11
|
-
The process of documentation generation loads `${$project.moduleName}` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://
|
|
11
|
+
The process of documentation generation loads `${$project.moduleName}` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `${$lib.path.relative($project.docsFolder, $project.exportsFolder)}` folder. Additionally, when writing custom cmdlets in the `${$lib.path.relative($project.docsFolder, $project.customFolder)}` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `${$lib.path.relative($project.docsFolder, $project.examplesFolder)}` folder.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# ----------------------------------------------------------------------------------
|
|
2
2
|
${$project.pwshCommentHeader}
|
|
3
3
|
# ----------------------------------------------------------------------------------
|
|
4
|
-
param([switch]$
|
|
4
|
+
param([switch]$NotIsolated, [switch]$IncludeGeneralParameters, [switch]$UseExpandedFormat)
|
|
5
5
|
$ErrorActionPreference = 'Stop'
|
|
6
6
|
|
|
7
7
|
$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path
|
|
8
|
-
if(-not $
|
|
8
|
+
if(-not $NotIsolated) {
|
|
9
9
|
Write-Host -ForegroundColor Green 'Creating isolated process...'
|
|
10
|
-
& "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -
|
|
10
|
+
& "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated
|
|
11
11
|
return
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Exports
|
|
2
|
-
This directory contains the cmdlets *exported by* `${$project.moduleName}`. No other cmdlets in this repository are directly exported. What that means is the `${$project.moduleName}` module will run [Export-ModuleMember](https://
|
|
2
|
+
This directory contains the cmdlets *exported by* `${$project.moduleName}`. No other cmdlets in this repository are directly exported. What that means is the `${$project.moduleName}` module will run [Export-ModuleMember](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `${$lib.path.relative($project.exportsFolder, $project.customFolder)}` for all custom implementation.
|
|
3
3
|
|
|
4
4
|
## Info
|
|
5
5
|
- Modifiable: no
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# ----------------------------------------------------------------------------------
|
|
2
2
|
${$project.pwshCommentHeader}
|
|
3
3
|
# ----------------------------------------------------------------------------------
|
|
4
|
-
param([switch]$
|
|
4
|
+
param([switch]$NotIsolated)
|
|
5
5
|
$ErrorActionPreference = 'Stop'
|
|
6
6
|
|
|
7
7
|
$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path
|
|
8
|
-
if(-not $
|
|
8
|
+
if(-not $NotIsolated) {
|
|
9
9
|
Write-Host -ForegroundColor Green 'Creating isolated process...'
|
|
10
|
-
& "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -
|
|
10
|
+
& "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated
|
|
11
11
|
return
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# ----------------------------------------------------------------------------------
|
|
2
2
|
${$project.pwshCommentHeader}
|
|
3
3
|
# ----------------------------------------------------------------------------------
|
|
4
|
-
param([switch]$
|
|
4
|
+
param([switch]$NotIsolated)
|
|
5
5
|
$ErrorActionPreference = 'Stop'
|
|
6
6
|
|
|
7
7
|
$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path
|
|
8
|
-
if(-not $
|
|
8
|
+
if(-not $NotIsolated) {
|
|
9
9
|
Write-Host -ForegroundColor Green 'Creating isolated process...'
|
|
10
|
-
& "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -
|
|
10
|
+
& "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated
|
|
11
11
|
return
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -14,7 +14,7 @@ To generate documentation, the process is now integrated into the `build-module.
|
|
|
14
14
|
To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `${$lib.path.relative($project.baseFolder, $project.testFolder)}` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](${$lib.path.relative($project.baseFolder, $project.examplesFolder)}/README.md) in the `${$lib.path.relative($project.baseFolder, $project.examplesFolder)}` folder.
|
|
15
15
|
|
|
16
16
|
## Packing `${$project.moduleName}`
|
|
17
|
-
To pack `${$project.moduleName}` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://
|
|
17
|
+
To pack `${$project.moduleName}` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team.
|
|
18
18
|
|
|
19
19
|
## Module Script Details
|
|
20
20
|
There are multiple scripts created for performing different actions for developing `${$project.moduleName}`.
|
|
@@ -8,7 +8,7 @@ This directory contains a module to handle *internal only* cmdlets. Cmdlets that
|
|
|
8
8
|
- Packaged: yes
|
|
9
9
|
|
|
10
10
|
## Details
|
|
11
|
-
The `${$lib.path.relative($project.internalFolder, $project.psm1Internal)}` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `${$project.moduleName}`. Instead, this sub-module is imported by the `${$lib.path.relative($project.internalFolder, $project.psm1Custom)}` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://
|
|
11
|
+
The `${$lib.path.relative($project.internalFolder, $project.psm1Internal)}` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `${$project.moduleName}`. Instead, this sub-module is imported by the `${$lib.path.relative($project.internalFolder, $project.psm1Custom)}` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-6#qualified-names). For example, `${$project.moduleName}.internal\Get-Example` would call an internal cmdlet named `Get-Example`.
|
|
12
12
|
|
|
13
13
|
## Purpose
|
|
14
14
|
This allows you to include REST specifications for services that you *do not wish to expose from your module*, but simply want to call within custom cmdlets. For example, if you want to make a custom cmdlet that uses `Storage` services, you could include a simplified `Storage` REST specification that has only the operations you need. When you run the generator and build this module, note the generated `Storage` cmdlets. Then, in your readme configuration, use [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) on the `Storage` cmdlets and they will *only be exposed to the custom cmdlets* you want to write, and not be exported as part of `${$project.moduleName}`.
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# ----------------------------------------------------------------------------------
|
|
2
2
|
${$project.pwshCommentHeader}
|
|
3
3
|
# ----------------------------------------------------------------------------------
|
|
4
|
-
param([switch]$
|
|
4
|
+
param([switch]$NotIsolated, [switch]$Code)
|
|
5
5
|
$ErrorActionPreference = 'Stop'
|
|
6
6
|
|
|
7
|
-
if(-not $
|
|
7
|
+
if(-not $NotIsolated) {
|
|
8
8
|
Write-Host -ForegroundColor Green 'Creating isolated process...'
|
|
9
9
|
$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path
|
|
10
|
-
& "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -
|
|
10
|
+
& "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated
|
|
11
11
|
return
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
$isAzure = $${$project.azure}
|
|
15
15
|
if($isAzure) {
|
|
16
|
-
. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -
|
|
16
|
+
. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -NotIsolated -Accounts
|
|
17
17
|
# Load the latest version of Az.Accounts installed
|
|
18
18
|
Import-Module -Name Az.Accounts -RequiredVersion (Get-Module -Name Az.Accounts -ListAvailable | Sort-Object -Property Version -Descending)[0].Version
|
|
19
19
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# ----------------------------------------------------------------------------------
|
|
2
2
|
${$project.pwshCommentHeader}
|
|
3
3
|
# ----------------------------------------------------------------------------------
|
|
4
|
-
param([switch]$
|
|
4
|
+
param([switch]$NotIsolated, [switch]$Live, [switch]$Record, [switch]$Playback, [switch]$RegenerateSupportModule, [switch]$UsePreviousConfigForRecord, [string[]]$TestName)
|
|
5
5
|
$ErrorActionPreference = 'Stop'
|
|
6
6
|
|
|
7
|
-
if(-not $
|
|
7
|
+
if(-not $NotIsolated)
|
|
8
8
|
{
|
|
9
9
|
Write-Host -ForegroundColor Green 'Creating isolated process...'
|
|
10
10
|
if ($PSBoundParameters.ContainsKey("TestName")) {
|
|
11
11
|
$PSBoundParameters["TestName"] = $PSBoundParameters["TestName"] -join ","
|
|
12
12
|
}
|
|
13
13
|
$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path
|
|
14
|
-
& "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -
|
|
14
|
+
& "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated
|
|
15
15
|
return
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -23,7 +23,7 @@ if ($PSBoundParameters.ContainsKey("TestName") -and ($TestName.count -eq 1) -and
|
|
|
23
23
|
$ProgressPreference = 'SilentlyContinue'
|
|
24
24
|
$baseName = $PSScriptRoot.BaseName
|
|
25
25
|
$requireResourceModule = (($baseName -ne "Resources") -and ($Record.IsPresent -or $Live.IsPresent))
|
|
26
|
-
. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -
|
|
26
|
+
. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -NotIsolated -Accounts:$false -Pester -Resources:$requireResourceModule -RegenerateSupportModule:$RegenerateSupportModule
|
|
27
27
|
. ("$PSScriptRoot\test\utils.ps1")
|
|
28
28
|
|
|
29
29
|
if ($requireResourceModule)
|
|
@@ -67,10 +67,10 @@ try
|
|
|
67
67
|
$testFolder = Join-Path $PSScriptRoot '${$lib.path.relative($project.baseFolder, $project.testFolder)}'
|
|
68
68
|
if ($null -ne $TestName)
|
|
69
69
|
{
|
|
70
|
-
Invoke-Pester -Script @{ Path = $testFolder } -TestName $TestName -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml")
|
|
70
|
+
Invoke-Pester -Script @{ Path = $testFolder } -TestName $TestName -ExcludeTag $ExcludeTag -EnableExit:(-not $NotIsolated) -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml")
|
|
71
71
|
} else
|
|
72
72
|
{
|
|
73
|
-
Invoke-Pester -Script @{ Path = $testFolder } -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml")
|
|
73
|
+
Invoke-Pester -Script @{ Path = $testFolder } -ExcludeTag $ExcludeTag -EnableExit:(-not $NotIsolated) -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml")
|
|
74
74
|
}
|
|
75
75
|
} Finally
|
|
76
76
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function New-AzDeployment {
|
|
2
|
-
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Resources.Models.
|
|
2
|
+
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Resources.Models.IDeploymentExtended')]
|
|
3
3
|
[CmdletBinding(DefaultParameterSetName='CreateWithTemplateFileParameterFile', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
|
|
4
4
|
[Microsoft.Azure.PowerShell.Cmdlets.Resources.Description('You can provide the template and parameters directly in the request or link to JSON files.')]
|
|
5
5
|
param(
|
|
@@ -8,4 +8,4 @@ This directory contains the documentation of the cmdlets for the `Az.Resources`
|
|
|
8
8
|
- Packaged: yes
|
|
9
9
|
|
|
10
10
|
## Details
|
|
11
|
-
The process of documentation generation loads `Az.Resources` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://
|
|
11
|
+
The process of documentation generation loads `Az.Resources` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder.
|
|
@@ -14,7 +14,7 @@ To generate documentation, the process is now integrated into the `build-module.
|
|
|
14
14
|
To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder.
|
|
15
15
|
|
|
16
16
|
## Packing `Az.Resources`
|
|
17
|
-
To pack `Az.Resources` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://
|
|
17
|
+
To pack `Az.Resources` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team.
|
|
18
18
|
|
|
19
19
|
## Module Script Details
|
|
20
20
|
There are multiple scripts created for performing different actions for developing `Az.Resources`.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<projectUrl>https://github.com/Azure/azure-powershell</projectUrl>
|
|
11
11
|
<description>Microsoft Azure PowerShell - Accounts credential management cmdlets for Azure Resource Manager in Windows PowerShell and PowerShell Core.
|
|
12
12
|
|
|
13
|
-
For more information on account credential management, please visit the following: https://
|
|
13
|
+
For more information on account credential management, please visit the following: https://learn.microsoft.com/powershell/azure/authenticate-azureps</description>
|
|
14
14
|
<releaseNotes>* Added 'SshCredentialFactory' to support get ssh credential of vm from msal.
|
|
15
15
|
* Fixed the bug of cmdlet fails when -DefaultProfile is set to service principal login context. [#16617]
|
|
16
16
|
* Fixed the issue that authorization does not work in Dogfood environment</releaseNotes>
|
|
@@ -32,7 +32,7 @@ Copyright = 'Microsoft Corporation. All rights reserved.'
|
|
|
32
32
|
# Description of the functionality provided by this module
|
|
33
33
|
Description = 'Microsoft Azure PowerShell - Accounts credential management cmdlets for Azure Resource Manager in Windows PowerShell and PowerShell Core.
|
|
34
34
|
|
|
35
|
-
For more information on account credential management, please visit the following: https://
|
|
35
|
+
For more information on account credential management, please visit the following: https://learn.microsoft.com/powershell/azure/authenticate-azureps'
|
|
36
36
|
|
|
37
37
|
# Minimum version of the PowerShell engine required by this module
|
|
38
38
|
PowerShellVersion = '5.1'
|