Skip to content

[PS] Migrate StackHCI module to autorest v4 #28363

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
27 changes: 27 additions & 0 deletions src/StackHCI/StackHCI.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the ""License"");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an ""AS IS"" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - StackHci")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.6.1")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.6.1")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]

36 changes: 27 additions & 9 deletions src/StackHCI/StackHCI.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ subject-prefix: $(service-name)

inlining-threshold: 50

resourcegroup-append: true

# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
use-extension:
"@autorest/powershell": "3.x"

directive:
# Rename function
- where:
Expand All @@ -80,8 +74,14 @@ directive:
set:
subject: ConsentAndInstallDefaultExtension
# Remove the unexpanded parameter set
# Generate Create variant for "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity"
- where:
subject: ArcSetting$|Cluster|DeploymentSetting|EdgeDevice|Extension|SecuritySetting|Update$|UpdateRun|UpdateSummary
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))|^CreateViaIdentityExpanded$
remove: true
- where:
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
subject: ExtendClusterSoftwareAssuranceBenefit
variant: ^(Extend)(?!.*?(Expanded|JsonFilePath|JsonString))
remove: true
- where:
verb: Set
Expand Down Expand Up @@ -115,8 +115,8 @@ directive:
# Remove Update-AzStackHciArcSetting
- where:
verb: Update
subject: ArcSetting
remove: true
subject: ArcSetting|DeploymentSetting|EdgeDevice|SecuritySetting|Update$|UpdateRun|UpdateSummary
remove: true
# Hide aadClientId from Update-AzStackHCICluster
- where:
verb: Update
Expand Down Expand Up @@ -208,4 +208,22 @@ directive:
- ResourceGroupName
labels:
ResourceGroupName: Resource Group
- from: source-file-csharp
where: $
transform: $ = $.replace(/"Get the get run for a specified update"/g, '"Get the Update run for a specified update"');
- from: source-file-csharp
where: $
transform: $ = $.replace(/"Get all get summaries under the HCI cluster"/g, '"Get all Update summaries under the HCI cluster"');
- from: source-file-csharp
where: $
transform: $ = $.replace(/"Delete specified delete Run"/g, '"Delete specified Update Run"');
- from: source-file-csharp
where: $
transform: $ = $.replace(/"Delete delete Summaries"/g, '"Delete Update Summaries"');
- from: source-file-csharp
where: $
transform: $ = $.replace(/"Put put runs for a specified update"/g, '"Put Update runs for a specified update"');
- from: source-file-csharp
where: $
transform: $ = $.replace(/"Put put summaries under the HCI cluster"/g, '"Put Update summaries under the HCI cluster"');
```
Original file line number Diff line number Diff line change
Expand Up @@ -81,44 +81,6 @@
}
]
},
{
"name": "Invoke-AzStackHciExtendClusterSoftwareAssuranceBenefit",
"description": "Extends Software Assurance Benefit to a cluster",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/extendSoftwareAssuranceBenefit",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.stackhci/invoke-azstackhciextendclustersoftwareassurancebenefit"
},
"parameterSets": [
{
"parameters": [
"-ClusterName <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String>]"
]
}
]
},
"examples": [
{
"description": "Extends Software Assurance Benefit to a cluster",
"parameters": [
{
"name": "-ClusterName",
"value": "[Path.clusterName]"
},
{
"name": "-ResourceGroupName",
"value": "[Path.resourceGroupName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
},
{
"name": "Remove-AzStackHciCluster",
"description": "Delete an HCI cluster.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,39 +70,6 @@
]
}
]
},
{
"name": "Test-AzStackHciEdgeDevice",
"description": "A long-running resource action.",
"path": "/{resourceUri}/providers/Microsoft.AzureStackHCI/edgeDevices/{edgeDeviceName}/validate",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.stackhci/test-azstackhciedgedevice"
},
"parameterSets": [
{
"parameters": [
"-Name <String>",
"-ResourceUri <String>"
]
}
]
},
"examples": [
{
"description": "A long-running resource action.",
"parameters": [
{
"name": "-Name",
"value": "[Path.edgeDeviceName]"
},
{
"name": "-ResourceUri",
"value": "[Path.resourceUri]"
}
]
}
]
}
]
}
4 changes: 3 additions & 1 deletion src/StackHCI/StackHCI.Autorest/custom/stackhci.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ Function Print-FunctionParameters{
}

function Confirm-UserAcknowledgmentToUpgradeOS {
[Microsoft.Azure.PowerShell.Cmdlets.StackHCI.DoNotExportAttribute()]
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')]
param(
[Parameter(Mandatory=$true)]
Expand All @@ -521,6 +522,7 @@ function Confirm-UserAcknowledgmentToUpgradeOS {
}

function Confirm-UserAcknowledgmentUpgradeToSolution {
[Microsoft.Azure.PowerShell.Cmdlets.StackHCI.DoNotExportAttribute()]
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
Expand Down Expand Up @@ -4141,7 +4143,7 @@ function New-ClusterWithRetries {
GraphAccessToken is deprecated.

.PARAMETER AccountId
Specifies the AccoundId. Specifying this along with ArmAccessToken will avoid Azure interactive logon.
Specifies the AccountId. Specifying this along with ArmAccessToken will avoid Azure interactive logon.

.PARAMETER EnvironmentName
Specifies the Azure Environment. Default is AzureCloud. Valid values are AzureCloud, AzureChinaCloud, AzurePPE, AzureCanary, AzureUSGovernment
Expand Down
11 changes: 7 additions & 4 deletions src/StackHCI/StackHCI.Autorest/docs/Az.StackHCI.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Module Name: Az.StackHCI
Module Guid: 18e6b2a3-7e2d-4f6e-a8d2-09edaf462fd8
Module Guid: ecca9195-88b3-4c8f-a865-4fa09629fc69
Download Help Link: https://learn.microsoft.com/powershell/module/az.stackhci
Help Version: 1.0.0.0
Locale: en-US
Expand Down Expand Up @@ -80,6 +80,9 @@ Apply Update
### [New-AzStackHciArcSetting](New-AzStackHciArcSetting.md)
Create ArcSetting for HCI cluster.

### [New-AzStackHciArcSettingIdentity](New-AzStackHciArcSettingIdentity.md)
Create Aad identity for arc settings.

### [New-AzStackHciCluster](New-AzStackHciCluster.md)
Create an HCI cluster.

Expand Down Expand Up @@ -135,13 +138,13 @@ Remove-AzStackHCIVMAttestation removes guests from AzureStack HCI IMDS Attestati
Set-AzStackHCI modifies resource properties of the Microsoft.AzureStackHCI cloud resource representing the on-premises cluster to enable or disable features.

### [Set-AzStackHciDeploymentSetting](Set-AzStackHciDeploymentSetting.md)
Create a DeploymentSetting
Update a DeploymentSetting

### [Set-AzStackHciEdgeDevice](Set-AzStackHciEdgeDevice.md)
Create a EdgeDevice
Update a EdgeDevice

### [Set-AzStackHciSecuritySetting](Set-AzStackHciSecuritySetting.md)
Create a security setting
Update a security setting

### [Set-AzStackHciUpdate](Set-AzStackHciUpdate.md)
Put specified Update
Expand Down
26 changes: 23 additions & 3 deletions src/StackHCI/StackHCI.Autorest/docs/Get-AzStackHciArcSetting.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ Get-AzStackHciArcSetting -ClusterName <String> -Name <String> -ResourceGroupName
Get-AzStackHciArcSetting -InputObject <IStackHciIdentity> [-DefaultProfile <PSObject>] [<CommonParameters>]
```

### GetViaIdentityCluster
```
Get-AzStackHciArcSetting -ClusterInputObject <IStackHciIdentity> -Name <String> [-DefaultProfile <PSObject>]
[<CommonParameters>]
```

## DESCRIPTION
Get ArcSetting resource details of HCI Cluster.

Expand All @@ -50,6 +56,21 @@ To see the details use : "Write-Host( $arcSettings | Format-List | Out-String)"

## PARAMETERS

### -ClusterInputObject
Identity Parameter

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.IStackHciIdentity
Parameter Sets: GetViaIdentityCluster
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

### -ClusterName
The name of the cluster.

Expand Down Expand Up @@ -83,7 +104,6 @@ Accept wildcard characters: False

### -InputObject
Identity Parameter
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.IStackHciIdentity
Expand All @@ -102,7 +122,7 @@ The name of the proxy resource holding details of HCI ArcSetting information.

```yaml
Type: System.String
Parameter Sets: Get
Parameter Sets: Get, GetViaIdentityCluster
Aliases: ArcSettingName

Required: True
Expand Down Expand Up @@ -153,7 +173,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.Api20240401.IArcSetting
### Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.IArcSetting

## NOTES

Expand Down
3 changes: 1 addition & 2 deletions src/StackHCI/StackHCI.Autorest/docs/Get-AzStackHciCluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ Accept wildcard characters: False

### -InputObject
Identity Parameter
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.IStackHciIdentity
Expand Down Expand Up @@ -158,7 +157,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.Api20240401.ICluster
### Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.ICluster

## NOTES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ Get-AzStackHciDeploymentSetting -InputObject <IStackHciIdentity> [-DefaultProfil
[<CommonParameters>]
```

### GetViaIdentityCluster
```
Get-AzStackHciDeploymentSetting -ClusterInputObject <IStackHciIdentity> -SName <String>
[-DefaultProfile <PSObject>] [<CommonParameters>]
```

## DESCRIPTION
Get a DeploymentSetting

Expand All @@ -50,6 +56,21 @@ Gets the deployment setting in the cluster

## PARAMETERS

### -ClusterInputObject
Identity Parameter

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.IStackHciIdentity
Parameter Sets: GetViaIdentityCluster
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

### -ClusterName
The name of the cluster.

Expand Down Expand Up @@ -83,7 +104,6 @@ Accept wildcard characters: False

### -InputObject
Identity Parameter
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.IStackHciIdentity
Expand Down Expand Up @@ -118,7 +138,7 @@ Name of Deployment Setting

```yaml
Type: System.String
Parameter Sets: Get
Parameter Sets: Get, GetViaIdentityCluster
Aliases: DeploymentSettingsName

Required: True
Expand Down Expand Up @@ -153,7 +173,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.Api20240401.IDeploymentSetting
### Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.IDeploymentSetting

## NOTES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ Accept wildcard characters: False

### -InputObject
Identity Parameter
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.IStackHciIdentity
Expand Down Expand Up @@ -119,7 +118,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.Api20240401.IEdgeDevice
### Microsoft.Azure.PowerShell.Cmdlets.StackHCI.Models.IEdgeDevice

## NOTES

Expand Down
Loading
Loading