Skip to content

Commit f97dea5

Browse files
cherry-pick 3ca5ebc from generation
1 parent 75f1667 commit f97dea5

Some content is hidden

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

56 files changed

+618
-138
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

src/AksArc/AksArc.Autorest/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
bin
2+
obj
3+
.vs
4+
generated
5+
internal
6+
exports
7+
tools
8+
custom/*.psm1
9+
custom/autogen-model-cmdlets
10+
test/*-TestResults.xml
11+
/*.ps1
12+
/*.ps1xml
13+
/*.psm1
14+
/*.snk
15+
/*.csproj
16+
/*.nuspec
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@{
2+
GUID = 'b12bc6f4-a4bf-4e80-89e4-f13e640b7f12'
3+
RootModule = './Az.AksArc.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: AksArc cmdlets'
10+
PowerShellVersion = '5.1'
11+
DotNetFrameworkVersion = '4.7.2'
12+
RequiredAssemblies = './bin/Az.AksArc.private.dll'
13+
FormatsToProcess = './Az.AksArc.format.ps1xml'
14+
FunctionsToExport = 'Get-AzAksArcCluster', 'Get-AzAksArcClusterAdminKubeconfig', 'Get-AzAksArcClusterUpgrade', 'Get-AzAksArcClusterUserKubeconfig', 'Get-AzAksArcKubernetesVersion', 'Get-AzAksArcLog', 'Get-AzAksArcNodepool', 'Get-AzAksArcVirtualNetwork', 'Get-AzAksArcVMSku', 'Invoke-AzAksArcClusterUpgrade', 'New-AzAksArcCluster', 'New-AzAksArcNodepool', 'New-AzAksArcVirtualNetwork', 'Remove-AzAksArcCluster', 'Remove-AzAksArcNodepool', 'Remove-AzAksArcVirtualNetwork', 'Update-AzAksArcCluster', 'Update-AzAksArcNodepool'
15+
PrivateData = @{
16+
PSData = @{
17+
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'AksArc'
18+
LicenseUri = 'https://aka.ms/azps-license'
19+
ProjectUri = 'https://github.com/Azure/azure-powershell'
20+
ReleaseNotes = ''
21+
}
22+
}
23+
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ if(-not $Debugger) {
9797
$null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path (Join-Path $binFolder 'Debug'), (Join-Path $binFolder 'Release')
9898
}
9999

100-
$dll = Join-Path $PSScriptRoot 'bin\Az.AksArc.private.dll'
100+
$dll = Join-Path $PSScriptRoot 'bin/Az.AksArc.private.dll'
101101
if(-not (Test-Path $dll)) {
102102
Write-Error "Unable to find output assembly in '$binFolder'."
103103
}
@@ -106,7 +106,7 @@ if(-not (Test-Path $dll)) {
106106
$null = Import-Module -Name $dll
107107

108108
$modulePaths = $dll
109-
$customPsm1 = Join-Path $PSScriptRoot 'custom\Az.AksArc.custom.psm1'
109+
$customPsm1 = Join-Path $PSScriptRoot 'custom/Az.AksArc.custom.psm1'
110110
if(Test-Path $customPsm1) {
111111
$modulePaths = @($dll, $customPsm1)
112112
}
@@ -178,8 +178,8 @@ if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1'))
178178
}
179179

180180
if (-not $DisableAfterBuildTasks){
181-
$afterBuildTasksPath = Join-Path $PSScriptRoot ''
182-
$afterBuildTasksArgs = ConvertFrom-Json 'true' -AsHashtable
181+
$afterBuildTasksPath = Join-Path $PSScriptRoot '../../../tools/BuildScripts/AdaptAutorestModule.ps1'
182+
$afterBuildTasksArgs = ConvertFrom-Json '{"SubModuleName":"AksArc","ModuleRootName":"$(root-module-name)"}' -AsHashtable
183183
if(Test-Path -Path $afterBuildTasksPath -PathType leaf){
184184
Write-Host -ForegroundColor Green 'Running after build tasks...'
185185
. $afterBuildTasksPath @afterBuildTasksArgs

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ function CreateModelCmdlet {
2222
return
2323
}
2424

25-
$ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models'
26-
$OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets'
25+
$ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated/api') 'Models'
26+
$OutputDir = Join-Path $PSScriptRoot 'custom/autogen-model-cmdlets'
2727
$null = New-Item -ItemType Directory -Force -Path $OutputDir
2828
if (''.length -gt 0) {
2929
$ModuleName = ''

src/AksArc/AksArc.Autorest/custom/Az.AksArc.custom.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# region Generated
22
# Load the private module dll
3-
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.AksArc.private.dll')
3+
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '../bin/Az.AksArc.private.dll')
44

55
# Load the internal module
6-
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.AksArc.internal.psm1'
6+
$internalModulePath = Join-Path $PSScriptRoot '../internal/Az.AksArc.internal.psm1'
77
if(Test-Path $internalModulePath) {
88
$null = Import-Module -Name $internalModulePath
99
}

src/AksArc/AksArc.Autorest/custom/Invoke-AzAksArcClusterUpgrade.ps1

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,9 @@ function Invoke-AzAksArcClusterUpgrade {
121121
if ($PSBoundParameters.ContainsKey("KubernetesVersion"))
122122
{
123123
$Upgrades = Get-AzAksArcClusterUpgrade -ClusterName $ClusterName -ResourceGroupName $ResourceGroupName -SubscriptionId $SubscriptionId
124-
if ($upgrades.ControlPlaneProfileUpgrade.KubernetesVersion -contains $KubernetesVersion) {
125-
continue
126-
} else {
124+
if (!($upgrades.ControlPlaneProfileUpgrade.KubernetesVersion -contains $KubernetesVersion)) {
127125
throw "Kubernetes Version $KubernetesVersion is not a valid upgradable version."
128-
}
126+
}
129127
} else {
130128
$Upgrades = Get-AzAksArcClusterUpgrade -ClusterName $ClusterName -ResourceGroupName $ResourceGroupName -SubscriptionId $SubscriptionId
131129
$UpgradeListLength = $upgrades.ControlPlaneProfileUpgrade.KubernetesVersion.Length
@@ -137,8 +135,7 @@ function Invoke-AzAksArcClusterUpgrade {
137135

138136
$null = $PSBoundParameters.Add("KubernetesVersion", $LatestUpgrade)
139137
}
140-
138+
141139
Az.AksArc.internal\Update-AzAksArcCluster @PSBoundParameters
142140
}
143-
}
144-
141+
}

src/AksArc/AksArc.Autorest/custom/New-AzAksArcCluster.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,8 @@ function New-AzAksArcCluster {
475475
$null = $PSBoundParameters.Add("LicenseProfileAzureHybridBenefit", $false)
476476
}
477477
$null = $PSBoundParameters.Remove("EnableAzureHybridBenefit")
478+
$null = $PSBoundParameters.Remove("NodeTaint")
479+
$null = $PSBoundParameters.Remove("NodeLabel")
478480
Az.AksArc.internal\New-AzAksArcCluster @PSBoundParameters
479481
}
480482
}

src/AksArc/AksArc.Autorest/custom/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Custom
2-
This directory contains custom implementation for non-generated cmdlets for the `Az.AksArc` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.AksArc.custom.psm1`. This file should not be modified.
2+
This directory contains custom implementation for non-generated cmdlets for the `Az.AksArc` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `../exports` folder. The only generated file into this folder is the `Az.AksArc.custom.psm1`. This file should not be modified.
33

44
## Info
55
- Modifiable: yes
@@ -15,10 +15,10 @@ For C# cmdlets, they are compiled with the rest of the generated low-level cmdle
1515
For script cmdlets, these are loaded via the `Az.AksArc.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.
1616

1717
## Purpose
18-
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder.
18+
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `../exports` folder.
1919

2020
## Usage
21-
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
21+
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `../exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
2222
- Break
2323
- DefaultProfile
2424
- HttpPipelineAppend
@@ -36,6 +36,6 @@ For processing the cmdlets, we've created some additional attributes:
3636
- `Microsoft.Azure.PowerShell.Cmdlets.AksArc.DoNotExportAttribute`
3737
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.AksArc`.
3838
- `Microsoft.Azure.PowerShell.Cmdlets.AksArc.InternalExportAttribute`
39-
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.AksArc`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder.
39+
- Used in C# cmdlets to route exported cmdlets to the `../internal`, which are *not exposed* by `Az.AksArc`. For more information, see [README.md](../internal/README.md) in the `../internal` folder.
4040
- `Microsoft.Azure.PowerShell.Cmdlets.AksArc.ProfileAttribute`
4141
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.

src/AksArc/AksArc.Autorest/help/Az.AksArc.md renamed to src/AksArc/AksArc.Autorest/docs/Az.AksArc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: Az.AksArc
3-
Module Guid: 0e2f96c9-10b2-4c68-b181-d29e3bdfdeed
3+
Module Guid: b12bc6f4-a4bf-4e80-89e4-f13e640b7f12
44
Download Help Link: https://learn.microsoft.com/powershell/module/az.aksarc
55
Help Version: 1.0.0.0
66
Locale: en-US
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Docs
2-
This directory contains the documentation of the cmdlets for the `Az.AksArc` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `..\examples` folder.
2+
This directory contains the documentation of the cmdlets for the `Az.AksArc` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `../examples` folder.
33

44
## Info
55
- Modifiable: no
@@ -8,4 +8,4 @@ This directory contains the documentation of the cmdlets for the `Az.AksArc` mod
88
- Packaged: yes
99

1010
## Details
11-
The process of documentation generation loads `Az.AksArc` 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.
11+
The process of documentation generation loads `Az.AksArc` 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.

src/AksArc/AksArc.Autorest/export-surface.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if(-not $NotIsolated) {
2222
return
2323
}
2424

25-
$dll = Join-Path $PSScriptRoot 'bin\Az.AksArc.private.dll'
25+
$dll = Join-Path $PSScriptRoot 'bin/Az.AksArc.private.dll'
2626
if(-not (Test-Path $dll)) {
2727
Write-Error "Unable to find output assembly in '$binFolder'."
2828
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"generate_Id": "8592e13b-4bcc-4035-bad8-60abdadadc3a"
2+
"generate_Id": "dfc356f4-00c0-4645-b4dd-6819bb3a7773"
33
}

0 commit comments

Comments
 (0)