Skip to content

Commit

Permalink
StackHCIVM 2024-01-01 api version (Azure#24422)
Browse files Browse the repository at this point in the history
* post autogeneration

* delete

* removing alb changes?

* removing alb changes

* fixing readme file to match folder structure of central repo

* removing example changes

* fix

* fixes for examples

* fix

* fix

* fix

* vm agent fixes

* removing module versin change

* adding storage path recording

* adding disk recording

* adding networking recoridng

* adding image and nic recordings

* vm recording

* image recording

* merge

* report api error

---------

Co-authored-by: Harika Vedati <havedati@microsoft.com>
  • Loading branch information
2 people authored and qinzhouxu committed Jun 5, 2024
1 parent 24e14b3 commit 2a86d5c
Show file tree
Hide file tree
Showing 26 changed files with 2,037 additions and 3,175 deletions.
18 changes: 9 additions & 9 deletions src/StackHCIVM/StackHCIVM.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,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
}
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,11 @@ function New-AzStackHCIVMVirtualMachine {
$PSBoundParameters.Add("WindowConfigurationProvisionVMConfigAgent", $true)
if(-not $ProvisionVMAgent){
$null = $PSBoundParameters.Remove("WindowConfigurationProvisionVMAgent")
$PSBoundParameters.Add("WindowConfigurationProvisionVMAgent", $false)
}
if (-not $ProvisionVMConfigAgent){
$null = $PSBoundParameters.Remove("WindowConfigurationProvisionVMConfigAgent")
$PSBoundParameters.Add("WindowConfigurationProvisionVMConfigAgent", $true)
}
$null = $PSBoundParameters.Remove("ProvisionVMAgent")
$null = $PSBoundParameters.Remove("ProvisionVMConfigAgent")
Expand Down Expand Up @@ -580,9 +582,11 @@ function New-AzStackHCIVMVirtualMachine {
$PSBoundParameters.Add("LinuxConfigurationProvisionVMConfigAgent", $true)
if(-not $ProvisionVMAgent){
$null = $PSBoundParameters.Remove("LinuxConfigurationProvisionVMAgent")
$PSBoundParameters.Add("LinuxConfigurationProvisionVMAgent", $false)
}
if (-not $ProvisionVMConfigAgent){
$null = $PSBoundParameters.Remove("LinuxConfigurationProvisionVMConfigAgent")
$PSBoundParameters.Add("LinuxConfigurationProvisionVMConfigAgent", $false)
}
$null = $PSBoundParameters.Remove("ProvisionVMAgent")
$null = $PSBoundParameters.Remove("ProvisionVMConfigAgent")
Expand Down Expand Up @@ -671,7 +675,7 @@ function New-AzStackHCIVMVirtualMachine {
if ($EnableTpm.IsPresent){
$PSBoundParameters.Add('EnableTpm', $EnableTpm)
}
IF($SecureBootEnabled.IsPresent){
if($SecureBootEnabled.IsPresent){
$PSBoundParameters.Add('SecureBootEnabled', $SecureBootEnabled)
}
$null = $PSBoundParameters.Remove("Name")
Expand All @@ -684,6 +688,16 @@ function New-AzStackHCIVMVirtualMachine {
$null = $PSBoundParameters.Remove("Location")
$null = $PSBoundParameters.Remove("OSType")
$null = $PSBoundParameters.Remove("IdentityType")
return Az.StackHCIVM.internal\New-AzStackHCIVMVirtualMachine @PSBoundParameters

try{
Az.StackHCIVM.internal\New-AzStackHCIVMVirtualMachine -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 @@ -131,7 +131,17 @@ function Restart-AzStackHCIVMVirtualMachine {
$null = $PSBoundParameters.Remove("ResourceGroupName")
$null = $PSBoundParameters.Remove("ResourceId")
$null = $PSBoundParameters.Remove("Name")
return Az.StackHCIVM.internal\Restart-AzStackHCIVMVirtualMachine @PSBoundParameters
try{
Az.StackHCIVM.internal\Restart-AzStackHCIVMVirtualMachine -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
}
}

} else {
Write-Error "One or more input parameters are invalid. Resource ID is: $ResourceId, name is $name, resource group name is $resourcegroupname, subscription id is $subscriptionid"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,18 @@ function Start-AzStackHCIVMVirtualMachine {
$null = $PSBoundParameters.Remove("ResourceGroupName")
$null = $PSBoundParameters.Remove("ResourceId")
$null = $PSBoundParameters.Remove("Name")
return Az.StackHCIVM.internal\Start-AzStackHCIVMVirtualMachine @PSBoundParameters

try{
Az.StackHCIVM.internal\Start-AzStackHCIVMVirtualMachine -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
}
}

} else {
Write-Error "One or more input parameters are invalid. Resource ID is: $ResourceId, name is $name, resource group name is $resourcegroupname, subscription id is $subscriptionid"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,18 @@ function Stop-AzStackHCIVMVirtualMachine {
$null = $PSBoundParameters.Remove("ResourceGroupName")
$null = $PSBoundParameters.Remove("ResourceId")
$null = $PSBoundParameters.Remove("Name")
return Az.StackHCIVM.internal\Stop-AzStackHCIVMVirtualMachine @PSBoundParameters

try{
Az.StackHCIVM.internal\Stop-AzStackHCIVMVirtualMachine -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
}
}

} else {
Write-Error "One or more input parameters are invalid. Resource ID is: $ResourceId, name is $name, resource group name is $resourcegroupname, subscription id is $subscriptionid"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,30 @@ function Update-AzStackHCIVMImage{


if ($isGalleryImage){
return Az.StackHCIVM.internal\Update-AzStackHCIVMGalleryImage @PSBoundParameters
try{
Az.StackHCIVM.internal\Update-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
}
}
}

if ($isMarketplaceGalleryImage){
return Az.StackHCIVM.internal\Update-AzStackHCIVMMarketplaceGalleryImage @PSBoundParameters
try{
Az.StackHCIVM.internal\Update-AzStackHCIVMMarketplaceGalleryImage -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
}
}

}

} elseif ($PSCmdlet.ParameterSetName -eq "ByResourceId"){
Expand All @@ -143,7 +162,16 @@ function Update-AzStackHCIVMImage{
$null = $PSBoundParameters.Remove("SubscriptionId")
$PSBoundParameters.Add("SubscriptionId", $subscriptionId)

return Az.StackHCIVM.internal\Update-AzStackHCIVMGalleryImage @PSBoundParameters
try{
Az.StackHCIVM.internal\Update-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
}
}

} elseif ($ResourceId -match $marketplaceGalImageRegex){
$subscriptionId = $($Matches['subscriptionId'])
Expand All @@ -154,8 +182,16 @@ function Update-AzStackHCIVMImage{
$PSBoundParameters.Add("ResourceGroupName", $resourceGroupName)
$null = $PSBoundParameters.Remove("SubscriptionId")
$PSBoundParameters.Add("SubscriptionId", $subscriptionId)

return Az.StackHCIVM.internal\Update-AzStackHCIVMMarketplaceGalleryImage @PSBoundParameters
try{
Az.StackHCIVM.internal\Update-AzStackHCIVMMarketplaceGalleryImage -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
}
}

} else {
Write-Error "Resource ID is invalid: $ResourceId"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,17 @@ param(
$PSBoundParameters.Add("ResourceGroupName", $resourceGroupName)
$null = $PSBoundParameters.Remove("SubscriptionId")
$PSBoundParameters.Add("SubscriptionId", $subscriptionId)

return Az.StackHCIVM\Update-AzStackHCIVMLogicalNetwork @PSBoundParameters

try{
Az.StackHCIVM\Update-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
}
}

} else {
Write-Error "Resource ID is invalid: $ResourceId"
Expand Down
Loading

0 comments on commit 2a86d5c

Please sign in to comment.