Skip to content

Migrate StackHCIVM from generation to main #24486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2024
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 0 additions & 102 deletions src/StackHCIVM/StackHCIVM.Autorest/Az.StackHCIVM.format.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -2713,108 +2713,6 @@
</TableRowEntries>
</TableControl>
</View>
<View>
<Name>Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.Operation</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.Operation#Multiple</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label>ActionType</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>IsDataAction</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>Name</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>Origin</Label>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>ActionType</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>IsDataAction</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Name</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Origin</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
<View>
<Name>Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.OperationDisplay</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.OperationDisplay#Multiple</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label>Description</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>Operation</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>Provider</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>Resource</Label>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>Description</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Operation</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Provider</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Resource</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
<View>
<Name>Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.OperationListResult</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.OperationListResult#Multiple</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label>NextLink</Label>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>NextLink</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
<View>
<Name>Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.OperationValue</Name>
<ViewSelectedBy>
Expand Down
24 changes: 14 additions & 10 deletions src/StackHCIVM/StackHCIVM.Autorest/Az.StackHCIVM.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -47,37 +47,41 @@

# Ask for the shared functionality table
$VTable = Register-AzModule

# 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


# Delegate to sanitize the output object
$instance.SanitizeOutput = $VTable.SanitizerHandler

# Delegate to get the telemetry info
$instance.GetTelemetryInfo = $VTable.GetTelemetryInfo

# Tweaks the pipeline per call
$instance.OnNewRequest = $VTable.OnNewRequest

# Gets shared parameter values
$instance.GetParameterValue = $VTable.GetParameterValue

# Allows shared module to listen to events from this module
$instance.EventListener = $VTable.EventListener

# Gets shared argument completers
$instance.ArgumentCompleter = $VTable.ArgumentCompleter

# The name of the currently selected Azure profile
$instance.ProfileName = $VTable.ProfileName


# Load the custom module
$customModulePath = Join-Path $PSScriptRoot './custom/Az.StackHCIVM.custom.psm1'
if(Test-Path $customModulePath) {
$null = Import-Module -Name $customModulePath
}

# Export nothing to clear implicit exports
Export-ModuleMember

Expand All @@ -97,12 +101,12 @@
# Load the last folder if no profile is selected
$profileDirectory = $directories | Select-Object -Last 1
}

if($profileDirectory) {
Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'"
$exportsPath = $profileDirectory.FullName
}

if($exportsPath) {
Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
$cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath
Expand Down
18 changes: 9 additions & 9 deletions src/StackHCIVM/StackHCIVM.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ In this directory, run AutoRest:
> see https://aka.ms/autorest

```yaml
commit: 59883fd93ea3f0911d2070a533a3724bf9c2516a
commit: 812f964651d5f1f7148b54ed2cc35cb97be12523
require:
- $(this-folder)/../../readme.azure.noprofile.md
repo: azure-rest-api-specs

input-file:
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/common.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/galleryImages.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/marketplaceGalleryImages.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/networkInterfaces.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/storageContainers.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/virtualHardDisks.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/virtualMachineInstances.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/logicalNetworks.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2024-01-01/common.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2024-01-01/galleryImages.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2024-01-01/marketplaceGalleryImages.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2024-01-01/networkInterfaces.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2024-01-01/storageContainers.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2024-01-01/virtualHardDisks.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2024-01-01/virtualMachineInstances.json
- $(repo)/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2024-01-01/logicalNetworks.json
- $(repo)/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-03-15-preview/HybridCompute.json

module-version: 0.1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "logicalNetworks",
"apiVersion": "2023-09-01-preview",
"apiVersion": "2024-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.stackhcivm"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "networkInterfaces",
"apiVersion": "2023-09-01-preview",
"apiVersion": "2024-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.stackhcivm"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "storageContainers",
"apiVersion": "2023-09-01-preview",
"apiVersion": "2024-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.stackhcivm"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "virtualHardDisks",
"apiVersion": "2023-09-01-preview",
"apiVersion": "2024-01-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.stackhcivm"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,12 @@ function New-AzStackHCIVMImage{
}

} catch {
Write-Error $_.Exception.Message -ErrorAction Stop
$e = $_
if ($e.FullyQualifiedErrorId -match "MissingAzureKubernetesMapping" ){
Write-Error "An older version of the Arc VM cluster extension is installed on your cluster. Please downgrade the Az.StackHCIVm version to 1.0.1 to proceed." -ErrorAction Stop
} else {
Write-Error $e.Exception.Message -ErrorAction Stop
}
}


Expand Down Expand Up @@ -397,16 +402,29 @@ function New-AzStackHCIVMImage{
}

} catch {
Write-Error $_.Exception.Message -ErrorAction Stop
$e = $_
if ($e.FullyQualifiedErrorId -match "MissingAzureKubernetesMapping" ){
Write-Error "An older version of the Arc VM cluster extension is installed on your cluster. Please downgrade the Az.StackHCIVm version to 1.0.1 to proceed." -ErrorAction Stop
} else {
Write-Error $e.Exception.Message -ErrorAction Stop
}
}


}

if ($PSCmdlet.ParameterSetName -eq "GalleryImage")
{

Az.StackHCIVM.internal\New-AzStackHCIVMGalleryImage @PSBoundParameters
try{
Az.StackHCIVM.internal\New-AzStackHCIVMGalleryImage -ErrorAction Stop @PSBoundParameters
} catch {
$e = $_
if ($e.FullyQualifiedErrorId -match "MissingAzureKubernetesMapping" ){
Write-Error "An older version of the Arc VM cluster extension is installed on your cluster. Please downgrade the Az.StackHCIVm version to 1.0.1 to proceed." -ErrorAction Stop
} else {
Write-Error $e.Exception.Message -ErrorAction Stop
}
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,17 @@ function New-AzStackHCIVMLogicalNetwork {
$PSBoundParameters.Add("Subnet", $SubnetNew)

}

try{
Az.StackHCIVM.internal\New-AzStackHCIVMLogicalNetwork -ErrorAction Stop @PSBoundParameters
} catch {
$e = $_
if ($e.FullyQualifiedErrorId -match "MissingAzureKubernetesMapping" ){
Write-Error "An older version of the Arc VM cluster extension is installed on your cluster. Please downgrade the Az.StackHCIVm version to 1.0.1 to proceed." -ErrorAction Stop
} else {
Write-Error $e.Exception.Message -ErrorAction Stop
}
}

return Az.StackHCIVM.internal\New-AzStackHCIVMLogicalNetwork @PSBoundParameters
}

Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,16 @@ param(
if ($Tag){
$PSBoundParameters.Add("Tag", $Tag)
}
return Az.StackHCIVM.internal\New-AzStackHCIVMNetworkInterface @PSBoundParameters


try{
Az.StackHCIVM.internal\New-AzStackHCIVMNetworkInterface -ErrorAction Stop @PSBoundParameters
} catch {
$e = $_
if ($e.FullyQualifiedErrorId -match "MissingAzureKubernetesMapping" ){
Write-Error "An older version of the Arc VM cluster extension is installed on your cluster. Please downgrade the Az.StackHCIVm version to 1.0.1 to proceed." -ErrorAction Stop
} else {
Write-Error $e.Exception.Message -ErrorAction Stop
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ param(
}


return Az.StackHCIVM.internal\New-AzStackHCIVMStoragePath @PSBoundParameters
try{
Az.StackHCIVM.internal\New-AzStackHCIVMStoragePath -ErrorAction Stop @PSBoundParameters
} catch {
$e = $_
if ($e.FullyQualifiedErrorId -match "MissingAzureKubernetesMapping" ){
Write-Error "An older version of the Arc VM cluster extension is installed on your cluster. Please downgrade the Az.StackHCIVm version to 1.0.1 to proceed." -ErrorAction Stop
} else {
Write-Error $e.Exception.Message -ErrorAction Stop
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,16 @@ param(
$null = $PSBoundParameters.Remove("StoragePathResourceGroup")
}

return Az.StackHCIVM.internal\New-AzStackHCIVMVirtualHardDisk @PSBoundParameters
try{
Az.StackHCIVM.internal\New-AzStackHCIVMVirtualHardDisk -ErrorAction Stop @PSBoundParameters
} catch {
$e = $_
if ($e.FullyQualifiedErrorId -match "MissingAzureKubernetesMapping" ){
Write-Error "An older version of the Arc VM cluster extension is installed on your cluster. Please downgrade the Az.StackHCIVm version to 1.0.1 to proceed." -ErrorAction Stop
} else {
Write-Error $e.Exception.Message -ErrorAction Stop
}
}

}

Loading